diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt
index e3d2bed6f4..ba7aa6c932 100644
--- a/cmake_targets/CMakeLists.txt
+++ b/cmake_targets/CMakeLists.txt
@@ -126,10 +126,26 @@ add_list_string_option(CMAKE_BUILD_TYPE "RelWithDebInfo" "Choose the type of bui
Message("Architecture is ${CMAKE_SYSTEM_PROCESSOR}")
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7l")
- set(C_FLAGS_PROCESSOR "-mfloat-abi=softfp -mfpu=neon")
+ set(C_FLAGS_PROCESSOR "-gdwarf-2 -mfloat-abi=hard -mfpu=neon -lgcc -lrt")
else (CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7l")
- set(C_FLAGS_PROCESSOR "-msse4.2")
+ file(STRINGS "/proc/cpuinfo" CPUINFO REGEX flags LIMIT_COUNT 1)
+ #Message("CPUINFO is ${CPUINFO}")
+ if (CPUINFO MATCHES "avx2")
+ set(C_FLAGS_PROCESSOR "${C_FLAGS_PROCESSOR} -mavx2")
+ endif()
+ if (CPUINFO MATCHES "sse4_2")
+ set(C_FLAGS_PROCESSOR "${C_FLAGS_PROCESSOR} -msse4.2")
+ endif()
+ if (CPUINFO MATCHES "sse4_1")
+ set(C_FLAGS_PROCESSOR "${C_FLAGS_PROCESSOR} -msse4.1")
+ endif()
+ if (CPUINFO MATCHES "ssse3")
+ set(C_FLAGS_PROCESSOR "${C_FLAGS_PROCESSOR} -mssse3")
+ endif()
endif()
+Message("C_FLAGS_PROCESSOR is ${C_FLAGS_PROCESSOR}")
+
+
#
set(CMAKE_C_FLAGS
"${CMAKE_C_FLAGS} ${C_FLAGS_PROCESSOR} -std=gnu99 -Wall -Wstrict-prototypes -fno-strict-aliasing -rdynamic -funroll-loops -Wno-packed-bitfield-compat -fPIC ")
@@ -137,11 +153,14 @@ set(CMAKE_C_FLAGS
set(CMAKE_C_FLAGS
"${CMAKE_C_FLAGS} -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FCNTL_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_STRERROR=1 -DHAVE_SOCKET=1 -DHAVE_MEMSET=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DHAVE_LIBSCTP"
)
+set(CMAKE_CXX_FLAGS
+ "${CMAKE_CXX_FLAGS} ${C_FLAGS_PROCESSOR}"
+)
# set a flag for changes in the source code
# these changes are related to hardcoded path to include .h files
add_definitions(-DCMAKER)
-set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -ggdb -DMALLOC_CHECK_=3")
-set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -ggdb -DMALLOC_CHECK_=3 -O2")
+set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g -DMALLOC_CHECK_=3")
+set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -g -DMALLOC_CHECK_=3 -O2")
# Below has been put in comment because does not work with
# SVN authentication.
@@ -170,10 +189,15 @@ add_boolean_option(MSG_PRINT False "print debug messages")
add_boolean_option(DISABLE_XER_PRINT False "print XER Format")
add_boolean_option(XER_PRINT False "print XER Format")
add_boolean_option(RRC_MSG_PRINT False "print RRC messages")
-add_boolean_option(PDCP_MSG_PRINT False "print PDCP messages")
+add_boolean_option(PDCP_MSG_PRINT False "print PDCP messages to /tmp/pdcp.log")
+add_boolean_option(DEBUG_PDCP_PAYLOAD False "print PDCP PDU to stdout") # if true, make sure that global and PDCP log levels are trace
+add_boolean_option(DEBUG_MAC_INTERFACE False "print MAC-RLC PDU exchange to stdout") # if true, make sure that global and PDCP log levels are trace
+add_boolean_option(TRACE_RLC_PAYLOAD False "print RLC PDU to stdout") # if true, make sure that global and PDCP log levels are trace
add_boolean_option(TEST_OMG False "???")
add_boolean_option(DEBUG_OMG False "???")
add_boolean_option(XFORMS False "This adds the possibility to see the signal oscilloscope")
+add_boolean_option(PRINT_STATS False "This adds the possibility to see the status")
+
add_boolean_option(DEBUG_CONSOLE False "makes debugging easier, disables stdout/stderr buffering")
add_boolean_option(ENABLE_ITTI True "ITTI is internal messaging, should remain enabled for most targets")
@@ -272,7 +296,7 @@ set(S1AP_ASN_FILES
${S1AP_ASN_DIR}/S1AP-PDU.asn
)
set(S1AP_C_DIR ${asn1_generated_dir}/${ASN1RELDIR})
-
+#message("calling ${asn1c_call} ${S1AP_C_DIR} ${S1AP_ASN_FILES}")
execute_process(COMMAND ${asn1c_call} ${S1AP_C_DIR} ${S1AP_ASN_FILES})
file(GLOB S1AP_source ${S1AP_C_DIR}/*.c)
@@ -327,6 +351,58 @@ add_library(S1AP_EPC
${S1AP_DIR}/s1ap_mme_retransmission.c
${S1AP_DIR}/s1ap_mme_ta.c
)
+
+#X2AP
+# Same limitation as described in RRC/S1AP: unknown generated file list
+# so we generate it at cmake time
+##############
+add_list1_option(X2AP_VERSION R11 "X2AP Asn.1 grammar version" R10 R11)
+set(X2AP_DIR ${OPENAIR2_DIR}/X2AP)
+if (${X2AP_VERSION} STREQUAL "R11")
+ set (ASN1RELDIR R11.2)
+elseif (${X2AP_VERSION} STREQUAL "R10")
+ set (ASN1RELDIR R.UNKNOWN)
+endif(${X2AP_VERSION} STREQUAL "R11")
+set(X2AP_ASN_DIR ${X2AP_DIR}/MESSAGES/ASN1/${ASN1RELDIR})
+set(X2AP_ASN_FILES
+ ${X2AP_ASN_DIR}/X2AP-CommonDataTypes.asn
+ ${X2AP_ASN_DIR}/X2AP-Constants.asn
+ ${X2AP_ASN_DIR}/X2AP-IEs.asn
+ ${X2AP_ASN_DIR}/X2AP-PDU.asn
+ ${X2AP_ASN_DIR}/X2AP-Containers.asn
+ )
+
+set(X2AP_C_DIR ${asn1_generated_dir}/${ASN1RELDIR})
+#message("calling ${asn1c_call} ${X2AP_C_DIR} ${X2AP_ASN_FILES}")
+execute_process(COMMAND ${asn1c_call} ${X2AP_C_DIR} ${X2AP_ASN_FILES})
+file(GLOB X2AP_source ${X2AP_C_DIR}/*.c)
+
+set(X2AP_OAI_generated
+ ${X2AP_C_DIR}/x2ap_decoder.c
+ ${X2AP_C_DIR}/x2ap_encoder.c
+ ${X2AP_C_DIR}/x2ap_xer_print.c
+ ${X2AP_C_DIR}/x2ap_ies_defs.h
+ )
+file(GLOB x2ap_h ${X2AP_C_DIR}/*.h)
+set(x2ap_h ${x2ap_h} )
+
+#message("calling ${X2AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f ${X2AP_ASN_DIR}/X2AP-PDU-Contents.asn -o ${X2AP_C_DIR}")
+add_custom_command (
+ OUTPUT ${X2AP_OAI_generated}
+ COMMAND ${asn1c_call} ${X2AP_C_DIR} ${X2AP_ASN_FILES}
+ COMMAND python ${X2AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f ${X2AP_ASN_DIR}/X2AP-PDU-Contents.asn -o ${X2AP_C_DIR}
+ DEPENDS ${X2AP_ASN_FILES}
+ )
+
+add_library(X2AP_LIB
+ ${X2AP_OAI_generated}
+ ${X2AP_source}
+ ${X2AP_DIR}/x2ap_common.c
+ )
+
+include_directories ("${X2AP_C_DIR}")
+include_directories ("${X2AP_DIR}")
+
# Hardware dependant options
###################################
add_list1_option(NB_ANTENNAS_RX "2" "Number of antennas in reception" "1" "2" "4")
@@ -359,15 +435,17 @@ elseif (${RF_BOARD} STREQUAL "OAI_BLADERF")
set(HW_SOURCE ${HW_SOURCE}
${OPENAIR_TARGETS}/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.c
)
- LINK_DIRECTORIES("/usr/lib/x86_64-linux-gnu/")
+ LINK_DIRECTORIES("/usr/lib/x86_64-linux-gnu")
set(option_HW_lib "bladeRF")
+#set(LOWLATENCY False)
elseif (${RF_BOARD} STREQUAL "ETHERNET")
include_directories ("${OPENAIR_TARGETS}/ARCH/ETHERNET/USERSPACE/LIB")
set(HW_SOURCE ${HW_SOURCE}
- ${OPENAIR_TARGETS}/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c
- )
-
+ ${OPENAIR_TARGETS}/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c
+ )
+ set(LOWLATENCY True)
+
elseif (${RF_BOARD} STREQUAL "CPRIGW")
set(HW_SOURCE ${HW_SOURCE}
${OPENAIR_TARGETS}/ARCH/CPRIGW/USERSPACE/LIB/cprigw_lib.c
@@ -389,21 +467,16 @@ add_boolean_option(USER_MODE True "????")
add_boolean_option(OAI_NW_DRIVER_TYPE_ETHERNET False "????")
add_boolean_option(DISABLE_USE_NAS False "???")
-add_boolean_option(ENABLE_PDCP_NETLINK_FIFO False "????")
add_boolean_option(ENABLE_STANDALONE_EPC True "Compile MME, SGW and PGW in a single executable")
-add_boolean_option(ENABLE_USE_GTPU_IN_KERNEL True "as per name")
-add_boolean_option(ENABLE_USE_NETFILTER_FOR_SGI False "SGI option")
-add_boolean_option(ENABLE_USE_PCAP_FOR_SGI False "SGI option")
-add_boolean_option(ENABLE_USE_RAW_SOCKET_FOR_SGI False "As per name")
add_boolean_option(EPC_BUILD False "???")
-add_boolean_option(LOWLATENCY True "Use the Linux scheduler SCHED_DEADLINE: kernel >= 3.14")
+add_boolean_option(LOWLATENCY True "Use the Linux scheduler SCHED_DEADLINE: kernel >= 3.14")
add_boolean_option(NAS_ADDRESS_FIX False "specific to oaisim: for nasmesh driver")
add_boolean_option(NAS_NETLINK False "???? Must be True to compile nasmesh driver without rtai")
add_boolean_option(OAISIM False "specific to oaisim")
add_boolean_option(OAI_NW_DRIVER_USE_NETLINK True "????")
add_boolean_option(USE_MME False "this flag is used only one time in lte-softmodem.c")
add_list_string_option(PACKAGE_NAME "NotDefined" "As per attribute name")
-add_boolean_option(MESSAGE_CHART_GENERATOR True "For generating sequence diagrams")
+add_boolean_option(MESSAGE_CHART_GENERATOR False "For generating sequence diagrams")
add_boolean_option(MESSAGE_CHART_GENERATOR_RLC_MAC False "trace RLC-MAC exchanges in sequence diagrams")
add_boolean_option(MESSAGE_CHART_GENERATOR_PHY False "trace some PHY exchanges in sequence diagrams")
########################
@@ -455,6 +528,9 @@ add_boolean_option(PHY_EMUL False "not clear: must remain False f
add_boolean_option(PUCCH True "????")
add_boolean_option(RANDOM_BF False "????")
add_boolean_option(SMBV False "Rohde&Schwarz SMBV100A vector signal generator")
+add_boolean_option(DEBUG_PHY False "Enable PHY layer debugging options")
+add_boolean_option(DEBUG_PHY_PROC False "Enable debugging of PHY layer procedures")
+add_boolean_option(DEBUG_DLSCH False "Enable debugging of DLSCH physical layer channel")
##########################
# 802.21 options
@@ -523,14 +599,14 @@ add_boolean_option(RRC_DEFAULT_RAB_IS_AM False "Otherwise it is UM, confi
##########################
# S1AP LAYER OPTIONS
##########################
-add_boolean_option(S1AP_LIMIT_STREAM_ID_TO_1 True "FIXME: Despite Eurecom has implemented the spec concerning management of stream ids, there are always issues with other EPCs than EURECOM")
+# none
##########################
# PROJECTS (IST, FRENCH COLL., etc)
# SPECIFIC OPTIONS
##########################
add_boolean_option(SPECTRA False "???")
-add_boolean_option(MIH_C_MEDIEVAL_EXTENSIONS True "EXTENSIONS TO MIH 802.21 IN CONTEXT OF IST PROJECT CALLED MEDIEVAL")
+add_boolean_option(MIH_C_MEDIEVAL_EXTENSIONS False "EXTENSIONS TO MIH 802.21 IN CONTEXT OF IST PROJECT CALLED MEDIEVAL")
@@ -582,16 +658,16 @@ include_directories("${OPENAIR3_DIR}/RAL-LTE/LTE_RAL_ENB/INCLUDE")
include_directories("${OPENAIR3_DIR}/RAL-LTE/LTE_RAL_UE/INCLUDE")
include_directories("${OPENAIR_DIR}/common/utils")
include_directories("${OPENAIR_DIR}/common/utils/itti")
-include_directories("${OPENAIRCN_DIR}/NAS/EURECOM-NAS/src/api/network")
-include_directories("${OPENAIRCN_DIR}/NAS/EURECOM-NAS/src/include")
-include_directories("${OPENAIRCN_DIR}/NAS/EURECOM-NAS/src/ies")
-include_directories("${OPENAIRCN_DIR}/NAS/EURECOM-NAS/src/emm/msg")
-include_directories("${OPENAIRCN_DIR}/NAS/EURECOM-NAS/src/esm/msg")
-include_directories("${OPENAIRCN_DIR}/NAS/EURECOM-NAS/src/util")
+include_directories("${OPENAIRCN_DIR}/NAS/COMMON")
+include_directories("${OPENAIRCN_DIR}/NAS/COMMON/API/NETWORK")
+include_directories("${OPENAIRCN_DIR}/NAS/COMMON/EMM/MSG")
+include_directories("${OPENAIRCN_DIR}/NAS/COMMON/ESM/MSG")
+include_directories("${OPENAIRCN_DIR}/NAS/COMMON/IES")
+include_directories("${OPENAIRCN_DIR}/NAS/COMMON/UTIL")
include_directories("${OPENAIRCN_DIR}/SECU")
include_directories("${OPENAIRCN_DIR}/SCTP")
-include_directories("${OPENAIR2_DIR}/X2AP")
include_directories("${OPENAIRCN_DIR}/S1AP")
+include_directories("${OPENAIR2_DIR}/X2AP")
include_directories("${OPENAIRCN_DIR}/UDP")
include_directories("${OPENAIRCN_DIR}/GTPV1-U")
include_directories("${OPENAIR_DIR}/targets/COMMON")
@@ -613,27 +689,26 @@ include_directories("${OPENAIR2_DIR}/UTIL/CLI")
include_directories("${OPENAIR2_DIR}/UTIL/OPT")
include_directories("${OPENAIR2_DIR}/UTIL/OMV")
include_directories("${OPENAIR2_DIR}/RRC/LITE/MESSAGES")
-include_directories("${OPENAIRCN_DIR}/NAS")
include_directories("${OPENAIRCN_DIR}/GTPV1-U/nw-gtpv1u/shared")
include_directories("${OPENAIRCN_DIR}/GTPV1-U/nw-gtpv1u/include")
include_directories("${OPENAIRCN_DIR}/SGW-LITE")
include_directories("${OPENAIRCN_DIR}/MME_APP")
-include_directories("${OPENAIRCN_DIR}/SGI")
include_directories("${OPENAIRCN_DIR}/S6A")
include_directories("${OPENAIR_DIR}")
# Utilities Library
################
add_library(HASHTABLE
- ${OPENAIRCN_DIR}/UTILS/HASHTABLE/hashtable.c
- ${OPENAIRCN_DIR}/UTILS/HASHTABLE/obj_hashtable.c
+ ${OPENAIR_DIR}/common/utils/collection/hashtable/hashtable.c
+ ${OPENAIR_DIR}/common/utils/collection/hashtable/obj_hashtable.c
)
-include_directories(${OPENAIRCN_DIR}/UTILS/HASHTABLE)
+include_directories(${OPENAIR_DIR}/common/utils/collection/hashtable)
if (MESSAGE_CHART_GENERATOR)
- add_library(MSC
+ add_library(MSC
${OPENAIR_DIR}/common/utils/msc/msc.c
- )
+ )
+ set(MSC_LIB MSC)
endif()
include_directories(${OPENAIR_DIR}/common/utils/msc)
@@ -785,7 +860,6 @@ set(PHY_SRC
${OPENAIR1_DIR}/PHY/TOOLS/log2_approx.c
${OPENAIR1_DIR}/PHY/TOOLS/cmult_sv.c
${OPENAIR1_DIR}/PHY/TOOLS/cmult_vv.c
- ${OPENAIR1_DIR}/PHY/TOOLS/cadd_vv.c
${OPENAIR1_DIR}/PHY/TOOLS/cdot_prod.c
${OPENAIR1_DIR}/PHY/TOOLS/signal_energy.c
${OPENAIR1_DIR}/PHY/TOOLS/dB_routines.c
@@ -908,7 +982,7 @@ if (${ENABLE_RAL})
set(RAL_LIB RAL)
endif()
-if(MIH_C_MEDIEVAL_EXTENSIONS)
+if(${MIH_C_MEDIEVAL_EXTENSIONS})
set(MIH_SRC
${RAL_LTE_DIR}INTERFACE-802.21/C/MIH_C_header_codec.c
${RAL_LTE_DIR}INTERFACE-802.21/C/MIH_C_msg_codec.c
@@ -970,15 +1044,15 @@ string(REGEX REPLACE "[a-zA-Z .\r\n]" "" IPTVERSION ${iptables_version})
string(REGEX REPLACE "[a-zA-Z \r\n]" "" IPTABLES_VERSION_STRING ${iptables_version})
# From original Polaris code, added _lib because cmake doesn't accept two targets with the same name
-# and the driver is also named xt_GTPUAH
+# and the driver is also named xt_GTPUSP
# the _lib suffix is removed during installation in /lib/xtables
-add_library(xt_GTPUAH_lib SHARED ${OPENAIRCN_DIR}/GTPV1-U/GTPUAH/libxt_GTPUAH.c)
-target_compile_definitions(xt_GTPUAH_lib PRIVATE
+add_library(xt_GTPUSP_lib SHARED ${OPENAIRCN_DIR}/GTPV1-U/GTPU_SP/libxt_GTPUSP.c)
+target_compile_definitions(xt_GTPUSP_lib PRIVATE
-D_LARGEFILE_SOURCE=1
-D_LARGE_FILES
-D_FILE_OFFSET_BITS=64
-D_REENTRANT
--D_INIT=libxt_GTPUAH_init
+-D_INIT=libxt_GTPUSP_init
-DKVERSION=3
-DPIC
IPTVERSION=${IPTVERSION} -DIPTABLES_VERSION_STRING=\"${IPTABLES_VERSION_STRING}\"
@@ -986,27 +1060,6 @@ IPTVERSION=${IPTVERSION} -DIPTABLES_VERSION_STRING=\"${IPTABLES_VERSION_STRING}\
-set(SGI_DIR ${OPENAIRCN_DIR}/SGI)
-set(SGI_SRC
- ${SGI_DIR}/sgi_task.c
- ${SGI_DIR}/sgi_socket.c
- ${SGI_DIR}/sgi_egress.c
- ${SGI_DIR}/sgi_util.c
-)
-if(ENABLE_USE_PCAP_FOR_SGI)
- set(SGI_SRC ${SGI_SRC}
- ${SGI_DIR}/sgi_pcap.c
- )
- set(SGI_option_lib ${SGI_option_lib} pcap)
-endif()
-if (ENABLE_USE_NETFILTER_FOR_SGI)
- set(SGI_SRC ${SGI_SRC}
- ${SGI_DIR}/sgi_nf.c
- )
- set(SGI_option_lib ${SGI_option_lib} netfilter_queue nfnetlink)
-endif()
-add_library(SGI ${SGI_SRC})
-
set(SCTP_SRC
${OPENAIRCN_DIR}/SCTP/sctp_common.c
${OPENAIRCN_DIR}/SCTP/sctp_eNB_task.c
@@ -1070,284 +1123,361 @@ add_library(MME_APP
${MME_DIR}/s6a_2_nas_cause.c
)
-set(NAS_SRC ${OPENAIRCN_DIR}/NAS/EURECOM-NAS/src/)
+
+
+
+set(NAS_SRC ${OPENAIRCN_DIR}/NAS/)
set(libnas_api_OBJS
- ${NAS_SRC}api/mme/mme_api.c
- ${NAS_SRC}api/network/nas_message.c
- ${NAS_SRC}api/network/as_message.c
- ${NAS_SRC}api/network/network_api.c
+ ${NAS_SRC}COMMON/API/NETWORK/as_message.c
+ ${NAS_SRC}COMMON/API/NETWORK/nas_message.c
+ ${NAS_SRC}COMMON/API/NETWORK/network_api.c
)
-
-set(libnas_emm_OBJS
- ${NAS_SRC}emm/Attach.c
- ${NAS_SRC}emm/Authentication.c
- ${NAS_SRC}emm/Detach.c
- ${NAS_SRC}emm/EmmCommon.c
- ${NAS_SRC}emm/emm_data_ctx.c
- ${NAS_SRC}emm/emm_main.c
- ${NAS_SRC}emm/EmmStatusHdl.c
- ${NAS_SRC}emm/Identification.c
- ${NAS_SRC}emm/IdleMode.c
- ${NAS_SRC}emm/LowerLayer.c
- ${NAS_SRC}emm/SecurityModeControl.c
- ${NAS_SRC}emm/ServiceRequestHdl.c
- ${NAS_SRC}emm/TrackingAreaUpdate.c
- )
-
+
set(libnas_emm_msg_OBJS
- ${NAS_SRC}emm/msg/AttachAccept.c
- ${NAS_SRC}emm/msg/AuthenticationFailure.c
- ${NAS_SRC}emm/msg/CsServiceNotification.c
- ${NAS_SRC}emm/msg/ExtendedServiceRequest.c
- ${NAS_SRC}emm/msg/IdentityResponse.c
- ${NAS_SRC}emm/msg/EmmInformation.c
- ${NAS_SRC}emm/msg/ServiceReject.c
- ${NAS_SRC}emm/msg/TrackingAreaUpdateReject.c
- ${NAS_SRC}emm/msg/AttachComplete.c
- ${NAS_SRC}emm/msg/AuthenticationReject.c
- ${NAS_SRC}emm/msg/DetachAccept.c
- ${NAS_SRC}emm/msg/GutiReallocationCommand.c
- ${NAS_SRC}emm/msg/emm_msg.c
- ${NAS_SRC}emm/msg/SecurityModeCommand.c
- ${NAS_SRC}emm/msg/ServiceRequest.c
- ${NAS_SRC}emm/msg/TrackingAreaUpdateRequest.c
- ${NAS_SRC}emm/msg/AttachReject.c
- ${NAS_SRC}emm/msg/AuthenticationRequest.c
- ${NAS_SRC}emm/msg/DetachRequest.c
- ${NAS_SRC}emm/msg/GutiReallocationComplete.c
- ${NAS_SRC}emm/msg/SecurityModeComplete.c
- ${NAS_SRC}emm/msg/TrackingAreaUpdateAccept.c
- ${NAS_SRC}emm/msg/UplinkNasTransport.c
- ${NAS_SRC}emm/msg/AttachRequest.c
- ${NAS_SRC}emm/msg/AuthenticationResponse.c
- ${NAS_SRC}emm/msg/DownlinkNasTransport.c
- ${NAS_SRC}emm/msg/EmmStatus.c
- ${NAS_SRC}emm/msg/IdentityRequest.c
- ${NAS_SRC}emm/msg/SecurityModeReject.c
- ${NAS_SRC}emm/msg/TrackingAreaUpdateComplete.c
+ ${NAS_SRC}COMMON/EMM/MSG/AttachAccept.c
+ ${NAS_SRC}COMMON/EMM/MSG/AttachComplete.c
+ ${NAS_SRC}COMMON/EMM/MSG/AttachReject.c
+ ${NAS_SRC}COMMON/EMM/MSG/AttachRequest.c
+ ${NAS_SRC}COMMON/EMM/MSG/AuthenticationFailure.c
+ ${NAS_SRC}COMMON/EMM/MSG/AuthenticationReject.c
+ ${NAS_SRC}COMMON/EMM/MSG/AuthenticationRequest.c
+ ${NAS_SRC}COMMON/EMM/MSG/AuthenticationResponse.c
+ ${NAS_SRC}COMMON/EMM/MSG/CsServiceNotification.c
+ ${NAS_SRC}COMMON/EMM/MSG/DetachAccept.c
+ ${NAS_SRC}COMMON/EMM/MSG/DetachRequest.c
+ ${NAS_SRC}COMMON/EMM/MSG/DownlinkNasTransport.c
+ ${NAS_SRC}COMMON/EMM/MSG/EmmInformation.c
+ ${NAS_SRC}COMMON/EMM/MSG/emm_msg.c
+ ${NAS_SRC}COMMON/EMM/MSG/EmmStatus.c
+ ${NAS_SRC}COMMON/EMM/MSG/ExtendedServiceRequest.c
+ ${NAS_SRC}COMMON/EMM/MSG/GutiReallocationCommand.c
+ ${NAS_SRC}COMMON/EMM/MSG/GutiReallocationComplete.c
+ ${NAS_SRC}COMMON/EMM/MSG/IdentityRequest.c
+ ${NAS_SRC}COMMON/EMM/MSG/IdentityResponse.c
+ ${NAS_SRC}COMMON/EMM/MSG/SecurityModeCommand.c
+ ${NAS_SRC}COMMON/EMM/MSG/SecurityModeComplete.c
+ ${NAS_SRC}COMMON/EMM/MSG/SecurityModeReject.c
+ ${NAS_SRC}COMMON/EMM/MSG/ServiceReject.c
+ ${NAS_SRC}COMMON/EMM/MSG/ServiceRequest.c
+ ${NAS_SRC}COMMON/EMM/MSG/TrackingAreaUpdateAccept.c
+ ${NAS_SRC}COMMON/EMM/MSG/TrackingAreaUpdateComplete.c
+ ${NAS_SRC}COMMON/EMM/MSG/TrackingAreaUpdateReject.c
+ ${NAS_SRC}COMMON/EMM/MSG/TrackingAreaUpdateRequest.c
+ ${NAS_SRC}COMMON/EMM/MSG/UplinkNasTransport.c
)
-
-set(libnas_emm_sap_OBJS
- ${NAS_SRC}emm/sap/emm_as.c
- ${NAS_SRC}emm/sap/emm_cn.c
- ${NAS_SRC}emm/sap/EmmDeregisteredNoImsi.c
- ${NAS_SRC}emm/sap/emm_reg.c
- ${NAS_SRC}emm/sap/EmmRegisteredUpdateNeeded.c
- ${NAS_SRC}emm/sap/EmmDeregisteredNormalService.c
- ${NAS_SRC}emm/sap/emm_sap.c
- ${NAS_SRC}emm/sap/EmmDeregisteredPlmnSearch.c
- ${NAS_SRC}emm/sap/emm_esm.c
- ${NAS_SRC}emm/sap/EmmRegisteredAttemptingToUpdate.c
- ${NAS_SRC}emm/sap/emm_send.c
- ${NAS_SRC}emm/sap/EmmCommonProcedureInitiated.c
- ${NAS_SRC}emm/sap/EmmRegistered.c
- ${NAS_SRC}emm/sap/EmmDeregisteredAttachNeeded.c
- ${NAS_SRC}emm/sap/EmmRegisteredImsiDetachInitiated.c
- ${NAS_SRC}emm/sap/EmmServiceRequestInitiated.c
- ${NAS_SRC}emm/sap/EmmDeregisteredAttemptingToAttach.c
- ${NAS_SRC}emm/sap/emm_fsm.c
- ${NAS_SRC}emm/sap/EmmRegisteredInitiated.c
- ${NAS_SRC}emm/sap/EmmTrackingAreaUpdatingInitiated.c
- ${NAS_SRC}emm/sap/EmmDeregistered.c
- ${NAS_SRC}emm/sap/EmmRegisteredLimitedService.c
- ${NAS_SRC}emm/sap/EmmDeregisteredInitiated.c
- ${NAS_SRC}emm/sap/EmmNull.c
- ${NAS_SRC}emm/sap/EmmRegisteredNoCellAvailable.c
- ${NAS_SRC}emm/sap/EmmDeregisteredLimitedService.c
- ${NAS_SRC}emm/sap/emm_recv.c
- ${NAS_SRC}emm/sap/EmmRegisteredNormalService.c
- ${NAS_SRC}emm/sap/EmmDeregisteredNoCellAvailable.c
- ${NAS_SRC}emm/sap/EmmRegisteredPlmnSearch.c
-)
-
-set (libnas_esm_OBJS
- ${NAS_SRC}esm/esm_ebr_context.c
- ${NAS_SRC}esm/PdnConnectivity.c
- ${NAS_SRC}esm/esm_ebr.c
- ${NAS_SRC}esm/EpsBearerContextDeactivation.c
- ${NAS_SRC}esm/DefaultEpsBearerContextActivation.c
- ${NAS_SRC}esm/DedicatedEpsBearerContextActivation.c
- ${NAS_SRC}esm/PdnDisconnect.c
- ${NAS_SRC}esm/EsmStatusHdl.c
- ${NAS_SRC}esm/esm_main.c
- ${NAS_SRC}esm/esm_pt.c
- ${NAS_SRC}esm/esm_ip.c
-)
-
+
set(libnas_esm_msg_OBJS
- ${NAS_SRC}esm/msg/ModifyEpsBearerContextRequest.c
- ${NAS_SRC}esm/msg/DeactivateEpsBearerContextRequest.c
- ${NAS_SRC}esm/msg/BearerResourceAllocationReject.c
- ${NAS_SRC}esm/msg/BearerResourceModificationRequest.c
- ${NAS_SRC}esm/msg/ActivateDedicatedEpsBearerContextRequest.c
- ${NAS_SRC}esm/msg/EsmInformationResponse.c
- ${NAS_SRC}esm/msg/PdnDisconnectReject.c
- ${NAS_SRC}esm/msg/ActivateDedicatedEpsBearerContextAccept.c
- ${NAS_SRC}esm/msg/PdnDisconnectRequest.c
- ${NAS_SRC}esm/msg/BearerResourceModificationReject.c
- ${NAS_SRC}esm/msg/ActivateDefaultEpsBearerContextAccept.c
- ${NAS_SRC}esm/msg/ActivateDedicatedEpsBearerContextReject.c
- ${NAS_SRC}esm/msg/ModifyEpsBearerContextAccept.c
- ${NAS_SRC}esm/msg/DeactivateEpsBearerContextAccept.c
- ${NAS_SRC}esm/msg/esm_msg.c
- ${NAS_SRC}esm/msg/EsmInformationRequest.c
- ${NAS_SRC}esm/msg/ActivateDefaultEpsBearerContextRequest.c
- ${NAS_SRC}esm/msg/ModifyEpsBearerContextReject.c
- ${NAS_SRC}esm/msg/EsmStatus.c
- ${NAS_SRC}esm/msg/PdnConnectivityReject.c
- ${NAS_SRC}esm/msg/ActivateDefaultEpsBearerContextReject.c
- ${NAS_SRC}esm/msg/PdnConnectivityRequest.c
- ${NAS_SRC}esm/msg/BearerResourceAllocationRequest.c
-)
-
-set(libnas_esm_sap_OBJS
- ${NAS_SRC}esm/sap/esm_recv.c
- ${NAS_SRC}esm/sap/esm_send.c
- ${NAS_SRC}esm/sap/esm_sap.c
+ ${NAS_SRC}COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextAccept.c
+ ${NAS_SRC}COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextReject.c
+ ${NAS_SRC}COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextRequest.c
+ ${NAS_SRC}COMMON/ESM/MSG/ActivateDefaultEpsBearerContextAccept.c
+ ${NAS_SRC}COMMON/ESM/MSG/ActivateDefaultEpsBearerContextReject.c
+ ${NAS_SRC}COMMON/ESM/MSG/ActivateDefaultEpsBearerContextRequest.c
+ ${NAS_SRC}COMMON/ESM/MSG/BearerResourceAllocationReject.c
+ ${NAS_SRC}COMMON/ESM/MSG/BearerResourceAllocationRequest.c
+ ${NAS_SRC}COMMON/ESM/MSG/BearerResourceModificationReject.c
+ ${NAS_SRC}COMMON/ESM/MSG/BearerResourceModificationRequest.c
+ ${NAS_SRC}COMMON/ESM/MSG/DeactivateEpsBearerContextAccept.c
+ ${NAS_SRC}COMMON/ESM/MSG/DeactivateEpsBearerContextRequest.c
+ ${NAS_SRC}COMMON/ESM/MSG/EsmInformationRequest.c
+ ${NAS_SRC}COMMON/ESM/MSG/EsmInformationResponse.c
+ ${NAS_SRC}COMMON/ESM/MSG/esm_msg.c
+ ${NAS_SRC}COMMON/ESM/MSG/EsmStatus.c
+ ${NAS_SRC}COMMON/ESM/MSG/ModifyEpsBearerContextAccept.c
+ ${NAS_SRC}COMMON/ESM/MSG/ModifyEpsBearerContextReject.c
+ ${NAS_SRC}COMMON/ESM/MSG/ModifyEpsBearerContextRequest.c
+ ${NAS_SRC}COMMON/ESM/MSG/PdnConnectivityReject.c
+ ${NAS_SRC}COMMON/ESM/MSG/PdnConnectivityRequest.c
+ ${NAS_SRC}COMMON/ESM/MSG/PdnDisconnectReject.c
+ ${NAS_SRC}COMMON/ESM/MSG/PdnDisconnectRequest.c
)
set(libnas_ies_OBJS
- ${NAS_SRC}ies/UeSecurityCapability.c
- ${NAS_SRC}ies/SecurityHeaderType.c
- ${NAS_SRC}ies/RadioPriority.c
- ${NAS_SRC}ies/EpsAttachResult.c
- ${NAS_SRC}ies/ImeisvRequest.c
- ${NAS_SRC}ies/EmergencyNumberList.c
- ${NAS_SRC}ies/SupportedCodecList.c
- ${NAS_SRC}ies/EsmCause.c
- ${NAS_SRC}ies/NetworkName.c
- ${NAS_SRC}ies/AuthenticationResponseParameter.c
- ${NAS_SRC}ies/Cli.c
- ${NAS_SRC}ies/AccessPointName.c
- ${NAS_SRC}ies/DaylightSavingTime.c
- ${NAS_SRC}ies/LcsIndicator.c
- ${NAS_SRC}ies/PagingIdentity.c
- ${NAS_SRC}ies/EpsMobileIdentity.c
- ${NAS_SRC}ies/GutiType.c
- ${NAS_SRC}ies/NasKeySetIdentifier.c
- ${NAS_SRC}ies/CsfbResponse.c
- ${NAS_SRC}ies/PacketFlowIdentifier.c
- ${NAS_SRC}ies/ApnAggregateMaximumBitRate.c
- ${NAS_SRC}ies/EpsBearerContextStatus.c
- ${NAS_SRC}ies/MobileIdentity.c
- ${NAS_SRC}ies/AuthenticationFailureParameter.c
- ${NAS_SRC}ies/EpsUpdateResult.c
- ${NAS_SRC}ies/TimeZone.c
- ${NAS_SRC}ies/MessageType.c
- ${NAS_SRC}ies/EmmCause.c
- ${NAS_SRC}ies/MobileStationClassmark2.c
- ${NAS_SRC}ies/AuthenticationParameterRand.c
- ${NAS_SRC}ies/PdnAddress.c
- ${NAS_SRC}ies/MobileStationClassmark3.c
- ${NAS_SRC}ies/ServiceType.c
- ${NAS_SRC}ies/NasRequestType.c
- ${NAS_SRC}ies/PlmnList.c
- ${NAS_SRC}ies/EpsQualityOfService.c
- ${NAS_SRC}ies/NasMessageContainer.c
- ${NAS_SRC}ies/EsmInformationTransferFlag.c
- ${NAS_SRC}ies/TrafficFlowTemplate.c
- ${NAS_SRC}ies/LinkedEpsBearerIdentity.c
- ${NAS_SRC}ies/NasSecurityAlgorithms.c
- ${NAS_SRC}ies/LlcServiceAccessPointIdentifier.c
- ${NAS_SRC}ies/ShortMac.c
- ${NAS_SRC}ies/TrafficFlowAggregateDescription.c
- ${NAS_SRC}ies/PTmsiSignature.c
- ${NAS_SRC}ies/ProtocolDiscriminator.c
- ${NAS_SRC}ies/EpsBearerIdentity.c
- ${NAS_SRC}ies/TimeZoneAndTime.c
- ${NAS_SRC}ies/TrackingAreaIdentityList.c
- ${NAS_SRC}ies/QualityOfService.c
- ${NAS_SRC}ies/EpsUpdateType.c
- ${NAS_SRC}ies/PdnType.c
- ${NAS_SRC}ies/UeRadioCapabilityInformationUpdateNeeded.c
- ${NAS_SRC}ies/AuthenticationParameterAutn.c
- ${NAS_SRC}ies/EpsAttachType.c
- ${NAS_SRC}ies/IdentityType2.c
- ${NAS_SRC}ies/LcsClientIdentity.c
- ${NAS_SRC}ies/DetachType.c
- ${NAS_SRC}ies/LocationAreaIdentification.c
- ${NAS_SRC}ies/TrackingAreaIdentity.c
- ${NAS_SRC}ies/CipheringKeySequenceNumber.c
- ${NAS_SRC}ies/MsNetworkCapability.c
- ${NAS_SRC}ies/UeNetworkCapability.c
- ${NAS_SRC}ies/ProtocolConfigurationOptions.c
- ${NAS_SRC}ies/AdditionalUpdateType.c
- ${NAS_SRC}ies/TmsiStatus.c
- ${NAS_SRC}ies/EsmMessageContainer.c
- ${NAS_SRC}ies/Nonce.c
- ${NAS_SRC}ies/ProcedureTransactionIdentity.c
- ${NAS_SRC}ies/TransactionIdentifier.c
- ${NAS_SRC}ies/AdditionalUpdateResult.c
- ${NAS_SRC}ies/GprsTimer.c
- ${NAS_SRC}ies/EpsNetworkFeatureSupport.c
- ${NAS_SRC}ies/SsCode.c
- ${NAS_SRC}ies/DrxParameter.c
- ${NAS_SRC}ies/KsiAndSequenceNumber.c
- ${NAS_SRC}ies/VoiceDomainPreferenceAndUeUsageSetting.c
+ ${NAS_SRC}COMMON/IES/AccessPointName.c
+ ${NAS_SRC}COMMON/IES/AdditionalUpdateResult.c
+ ${NAS_SRC}COMMON/IES/AdditionalUpdateType.c
+ ${NAS_SRC}COMMON/IES/ApnAggregateMaximumBitRate.c
+ ${NAS_SRC}COMMON/IES/AuthenticationFailureParameter.c
+ ${NAS_SRC}COMMON/IES/AuthenticationParameterAutn.c
+ ${NAS_SRC}COMMON/IES/AuthenticationParameterRand.c
+ ${NAS_SRC}COMMON/IES/AuthenticationResponseParameter.c
+ ${NAS_SRC}COMMON/IES/CipheringKeySequenceNumber.c
+ ${NAS_SRC}COMMON/IES/Cli.c
+ ${NAS_SRC}COMMON/IES/CsfbResponse.c
+ ${NAS_SRC}COMMON/IES/DaylightSavingTime.c
+ ${NAS_SRC}COMMON/IES/DetachType.c
+ ${NAS_SRC}COMMON/IES/DrxParameter.c
+ ${NAS_SRC}COMMON/IES/EmergencyNumberList.c
+ ${NAS_SRC}COMMON/IES/EmmCause.c
+ ${NAS_SRC}COMMON/IES/EpsAttachResult.c
+ ${NAS_SRC}COMMON/IES/EpsAttachType.c
+ ${NAS_SRC}COMMON/IES/EpsBearerContextStatus.c
+ ${NAS_SRC}COMMON/IES/EpsBearerIdentity.c
+ ${NAS_SRC}COMMON/IES/EpsMobileIdentity.c
+ ${NAS_SRC}COMMON/IES/EpsNetworkFeatureSupport.c
+ ${NAS_SRC}COMMON/IES/EpsQualityOfService.c
+ ${NAS_SRC}COMMON/IES/EpsUpdateResult.c
+ ${NAS_SRC}COMMON/IES/EpsUpdateType.c
+ ${NAS_SRC}COMMON/IES/EsmCause.c
+ ${NAS_SRC}COMMON/IES/EsmInformationTransferFlag.c
+ ${NAS_SRC}COMMON/IES/EsmMessageContainer.c
+ ${NAS_SRC}COMMON/IES/GprsTimer.c
+ ${NAS_SRC}COMMON/IES/GutiType.c
+ ${NAS_SRC}COMMON/IES/IdentityType2.c
+ ${NAS_SRC}COMMON/IES/ImeisvRequest.c
+ ${NAS_SRC}COMMON/IES/KsiAndSequenceNumber.c
+ ${NAS_SRC}COMMON/IES/LcsClientIdentity.c
+ ${NAS_SRC}COMMON/IES/LcsIndicator.c
+ ${NAS_SRC}COMMON/IES/LinkedEpsBearerIdentity.c
+ ${NAS_SRC}COMMON/IES/LlcServiceAccessPointIdentifier.c
+ ${NAS_SRC}COMMON/IES/LocationAreaIdentification.c
+ ${NAS_SRC}COMMON/IES/MessageType.c
+ ${NAS_SRC}COMMON/IES/MobileIdentity.c
+ ${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
+ ${NAS_SRC}COMMON/IES/NasSecurityAlgorithms.c
+ ${NAS_SRC}COMMON/IES/NetworkName.c
+ ${NAS_SRC}COMMON/IES/Nonce.c
+ ${NAS_SRC}COMMON/IES/PacketFlowIdentifier.c
+ ${NAS_SRC}COMMON/IES/PagingIdentity.c
+ ${NAS_SRC}COMMON/IES/PdnAddress.c
+ ${NAS_SRC}COMMON/IES/PdnType.c
+ ${NAS_SRC}COMMON/IES/PlmnList.c
+ ${NAS_SRC}COMMON/IES/ProcedureTransactionIdentity.c
+ ${NAS_SRC}COMMON/IES/ProtocolConfigurationOptions.c
+ ${NAS_SRC}COMMON/IES/ProtocolDiscriminator.c
+ ${NAS_SRC}COMMON/IES/PTmsiSignature.c
+ ${NAS_SRC}COMMON/IES/QualityOfService.c
+ ${NAS_SRC}COMMON/IES/RadioPriority.c
+ ${NAS_SRC}COMMON/IES/SecurityHeaderType.c
+ ${NAS_SRC}COMMON/IES/ServiceType.c
+ ${NAS_SRC}COMMON/IES/ShortMac.c
+ ${NAS_SRC}COMMON/IES/SsCode.c
+ ${NAS_SRC}COMMON/IES/SupportedCodecList.c
+ ${NAS_SRC}COMMON/IES/TimeZoneAndTime.c
+ ${NAS_SRC}COMMON/IES/TimeZone.c
+ ${NAS_SRC}COMMON/IES/TmsiStatus.c
+ ${NAS_SRC}COMMON/IES/TrackingAreaIdentity.c
+ ${NAS_SRC}COMMON/IES/TrackingAreaIdentityList.c
+ ${NAS_SRC}COMMON/IES/TrafficFlowAggregateDescription.c
+ ${NAS_SRC}COMMON/IES/TrafficFlowTemplate.c
+ ${NAS_SRC}COMMON/IES/TransactionIdentifier.c
+ ${NAS_SRC}COMMON/IES/UeNetworkCapability.c
+ ${NAS_SRC}COMMON/IES/UeRadioCapabilityInformationUpdateNeeded.c
+ ${NAS_SRC}COMMON/IES/UeSecurityCapability.c
+ ${NAS_SRC}COMMON/IES/VoiceDomainPreferenceAndUeUsageSetting.c
)
set (libnas_utils_OBJS
- ${NAS_SRC}util/device.c
- ${NAS_SRC}util/memory.c
- ${NAS_SRC}util/nas_log.c
- ${NAS_SRC}util/nas_timer.c
- ${NAS_SRC}util/socket.c
- ${NAS_SRC}util/stty.c
- ${NAS_SRC}util/TLVEncoder.c
- ${NAS_SRC}util/TLVDecoder.c
- ${NAS_SRC}util/OctetString.c
+ ${NAS_SRC}COMMON/UTIL/device.c
+ ${NAS_SRC}COMMON/UTIL/memory.c
+ ${NAS_SRC}COMMON/UTIL/nas_log.c
+ ${NAS_SRC}COMMON/UTIL/nas_timer.c
+ ${NAS_SRC}COMMON/UTIL/socket.c
+ ${NAS_SRC}COMMON/UTIL/stty.c
+ ${NAS_SRC}COMMON/UTIL/TLVEncoder.c
+ ${NAS_SRC}COMMON/UTIL/TLVDecoder.c
+ ${NAS_SRC}COMMON/UTIL/OctetString.c
)
-set (libnas_user_OBJS
- ${NAS_SRC}api/user/user_api.c
- ${NAS_SRC}api/user/user_indication.c
- ${NAS_SRC}api/user/at_command.c
- ${NAS_SRC}api/user/at_error.c
- ${NAS_SRC}api/user/at_response.c
-)
-
-set(libnas_usim_OBJS
- ${NAS_SRC}api/usim/aka_functions.c
- ${NAS_SRC}api/usim/usim_api.c
-)
-
-add_library(NAS_UE
- ${OPENAIRCN_DIR}/NAS/nas_ue_task.c
-)
-
-set(libnas_OBJS
-
- ${OPENAIRCN_DIR}/NAS/nas_itti_messaging.c
- ${NAS_SRC}nas_parser.c
- ${NAS_SRC}nas_proc.c
- ${NAS_SRC}nas_user.c
- ${NAS_SRC}nas_network.c
- ${libnas_utils_OBJS}
- ${libnas_user_OBJS}
- ${libnas_usim_OBJS}
- ${libnas_emm_OBJS}
- ${libnas_emm_msg_OBJS}
- ${libnas_emm_sap_OBJS}
- ${libnas_esm_OBJS}
- ${libnas_esm_msg_OBJS}
- ${libnas_esm_sap_OBJS}
- ${libnas_ies_OBJS}
- ${libnas_api_OBJS}
+if(NAS_UE)
+ set(libnas_ue_api_OBJS
+ ${NAS_SRC}UE/API/USER/at_command.c
+ ${NAS_SRC}UE/API/USER/at_error.c
+ ${NAS_SRC}UE/API/USER/at_response.c
+ ${NAS_SRC}UE/API/USER/user_api.c
+ ${NAS_SRC}UE/API/USER/user_indication.c
+ ${NAS_SRC}UE/API/USIM/aka_functions.c
+ ${NAS_SRC}UE/API/USIM/usim_api.c
)
-add_library(NAS ${libnas_OBJS})
+ set(libnas_ue_emm_OBJS
+ ${NAS_SRC}UE/EMM/Attach.c
+ ${NAS_SRC}UE/EMM/Authentication.c
+ ${NAS_SRC}UE/EMM/Detach.c
+ ${NAS_SRC}UE/EMM/emm_main.c
+ ${NAS_SRC}UE/EMM/EmmStatusHdl.c
+ ${NAS_SRC}UE/EMM/Identification.c
+ ${NAS_SRC}UE/EMM/IdleMode.c
+ ${NAS_SRC}UE/EMM/LowerLayer.c
+ ${NAS_SRC}UE/EMM/SecurityModeControl.c
+ ${NAS_SRC}UE/EMM/ServiceRequestHdl.c
+ ${NAS_SRC}UE/EMM/TrackingAreaUpdate.c
+ )
+ set(libnas_ue_emm_sap_OBJS
+ ${NAS_SRC}UE/EMM/SAP/emm_as.c
+ ${NAS_SRC}UE/EMM/SAP/EmmDeregisteredAttachNeeded.c
+ ${NAS_SRC}UE/EMM/SAP/EmmDeregisteredAttemptingToAttach.c
+ ${NAS_SRC}UE/EMM/SAP/EmmDeregistered.c
+ ${NAS_SRC}UE/EMM/SAP/EmmDeregisteredInitiated.c
+ ${NAS_SRC}UE/EMM/SAP/EmmDeregisteredLimitedService.c
+ ${NAS_SRC}UE/EMM/SAP/EmmDeregisteredNoCellAvailable.c
+ ${NAS_SRC}UE/EMM/SAP/EmmDeregisteredNoImsi.c
+ ${NAS_SRC}UE/EMM/SAP/EmmDeregisteredNormalService.c
+ ${NAS_SRC}UE/EMM/SAP/EmmDeregisteredPlmnSearch.c
+ ${NAS_SRC}UE/EMM/SAP/emm_esm.c
+ ${NAS_SRC}UE/EMM/SAP/emm_fsm.c
+ ${NAS_SRC}UE/EMM/SAP/EmmNull.c
+ ${NAS_SRC}UE/EMM/SAP/emm_recv.c
+ ${NAS_SRC}UE/EMM/SAP/emm_reg.c
+ ${NAS_SRC}UE/EMM/SAP/EmmRegisteredAttemptingToUpdate.c
+ ${NAS_SRC}UE/EMM/SAP/EmmRegistered.c
+ ${NAS_SRC}UE/EMM/SAP/EmmRegisteredImsiDetachInitiated.c
+ ${NAS_SRC}UE/EMM/SAP/EmmRegisteredInitiated.c
+ ${NAS_SRC}UE/EMM/SAP/EmmRegisteredLimitedService.c
+ ${NAS_SRC}UE/EMM/SAP/EmmRegisteredNoCellAvailable.c
+ ${NAS_SRC}UE/EMM/SAP/EmmRegisteredNormalService.c
+ ${NAS_SRC}UE/EMM/SAP/EmmRegisteredPlmnSearch.c
+ ${NAS_SRC}UE/EMM/SAP/EmmRegisteredUpdateNeeded.c
+ ${NAS_SRC}UE/EMM/SAP/emm_sap.c
+ ${NAS_SRC}UE/EMM/SAP/emm_send.c
+ ${NAS_SRC}UE/EMM/SAP/EmmServiceRequestInitiated.c
+ ${NAS_SRC}UE/EMM/SAP/EmmTrackingAreaUpdatingInitiated.c
+ )
+ set (libnas_ue_esm_OBJS
+ ${NAS_SRC}UE/ESM/DedicatedEpsBearerContextActivation.c
+ ${NAS_SRC}UE/ESM/DefaultEpsBearerContextActivation.c
+ ${NAS_SRC}UE/ESM/EpsBearerContextDeactivation.c
+ ${NAS_SRC}UE/ESM/esm_ebr.c
+ ${NAS_SRC}UE/ESM/esm_ebr_context.c
+ ${NAS_SRC}UE/ESM/esm_ip.c
+ ${NAS_SRC}UE/ESM/esm_main.c
+ ${NAS_SRC}UE/ESM/esm_pt.c
+ ${NAS_SRC}UE/ESM/EsmStatusHdl.c
+ ${NAS_SRC}UE/ESM/PdnConnectivity.c
+ ${NAS_SRC}UE/ESM/PdnDisconnect.c
+ )
+ set(libnas_ue_esm_sap_OBJS
+ ${NAS_SRC}UE/ESM/SAP/esm_recv.c
+ ${NAS_SRC}UE/ESM/SAP/esm_send.c
+ ${NAS_SRC}UE/ESM/SAP/esm_sap.c
+ )
+ add_library(LIB_NAS_UE
+ ${NAS_SRC}UE/nas_itti_messaging.c
+ ${NAS_SRC}UE/nas_network.c
+ ${NAS_SRC}UE/nas_parser.c
+ ${NAS_SRC}UE/nas_proc.c
+ ${NAS_SRC}UE/nas_user.c
+ ${libnas_api_OBJS}
+ ${libnas_ue_api_OBJS}
+ ${libnas_emm_msg_OBJS}
+ ${libnas_esm_msg_OBJS}
+ ${libnas_ies_OBJS}
+ ${libnas_utils_OBJS}
+ ${libnas_ue_emm_OBJS}
+ ${libnas_ue_emm_sap_OBJS}
+ ${libnas_ue_esm_OBJS}
+ ${libnas_ue_esm_sap_OBJS}
+ )
+ set(NAS_UE_LIB LIB_NAS_UE)
-if(NAS_UE)
- set(NAS_LIB NAS NAS_UE)
+ include_directories(${NAS_SRC}UE)
+ include_directories(${NAS_SRC}UE/API/USER)
+ include_directories(${NAS_SRC}UE/API/USIM)
+ include_directories(${NAS_SRC}UE/EMM)
+ include_directories(${NAS_SRC}UE/EMM/SAP)
+ include_directories(${NAS_SRC}UE/ESM)
+ include_directories(${NAS_SRC}UE/ESM/SAP)
endif()
-include_directories(${NAS_SRC})
-include_directories(${NAS_SRC}/api/user)
-include_directories(${NAS_SRC}/esm)
-include_directories(${NAS_SRC}/esm/sap)
-include_directories(${NAS_SRC}/emm)
-include_directories(${NAS_SRC}/emm/sap)
-include_directories(${NAS_SRC}/api/usim)
-include_directories(${NAS_SRC}/api/mme)
+if(NAS_MME)
+ set(libnas_mme_api_OBJS
+ ${NAS_SRC}MME/API/MME/mme_api.c
+ )
+ set(libnas_mme_emm_OBJS
+ ${NAS_SRC}MME/EMM/Attach.c
+ ${NAS_SRC}MME/EMM/Authentication.c
+ ${NAS_SRC}MME/EMM/Detach.c
+ ${NAS_SRC}MME/EMM/EmmCommon.c
+ ${NAS_SRC}MME/EMM/emm_data_ctx.c
+ ${NAS_SRC}MME/EMM/emm_main.c
+ ${NAS_SRC}MME/EMM/EmmStatusHdl.c
+ ${NAS_SRC}MME/EMM/Identification.c
+ ${NAS_SRC}MME/EMM/IdleMode.c
+ ${NAS_SRC}MME/EMM/LowerLayer.c
+ ${NAS_SRC}MME/EMM/SecurityModeControl.c
+ ${NAS_SRC}MME/EMM/ServiceRequestHdl.c
+ ${NAS_SRC}MME/EMM/TrackingAreaUpdate.c
+ )
+ set(libnas_mme_emm_sap_OBJS
+ ${NAS_SRC}MME/EMM/SAP/emm_as.c
+ ${NAS_SRC}MME/EMM/SAP/emm_cn.c
+ ${NAS_SRC}MME/EMM/SAP/EmmCommonProcedureInitiated.c
+ ${NAS_SRC}MME/EMM/SAP/EmmDeregisteredAttachNeeded.c
+ ${NAS_SRC}MME/EMM/SAP/EmmDeregisteredAttemptingToAttach.c
+ ${NAS_SRC}MME/EMM/SAP/EmmDeregistered.c
+ ${NAS_SRC}MME/EMM/SAP/EmmDeregisteredInitiated.c
+ ${NAS_SRC}MME/EMM/SAP/EmmDeregisteredLimitedService.c
+ ${NAS_SRC}MME/EMM/SAP/EmmDeregisteredNoCellAvailable.c
+ ${NAS_SRC}MME/EMM/SAP/EmmDeregisteredNoImsi.c
+ ${NAS_SRC}MME/EMM/SAP/EmmDeregisteredNormalService.c
+ ${NAS_SRC}MME/EMM/SAP/EmmDeregisteredPlmnSearch.c
+ ${NAS_SRC}MME/EMM/SAP/emm_esm.c
+ ${NAS_SRC}MME/EMM/SAP/emm_fsm.c
+ ${NAS_SRC}MME/EMM/SAP/EmmNull.c
+ ${NAS_SRC}MME/EMM/SAP/emm_recv.c
+ ${NAS_SRC}MME/EMM/SAP/emm_reg.c
+ ${NAS_SRC}MME/EMM/SAP/EmmRegisteredAttemptingToUpdate.c
+ ${NAS_SRC}MME/EMM/SAP/EmmRegistered.c
+ ${NAS_SRC}MME/EMM/SAP/EmmRegisteredImsiDetachInitiated.c
+ ${NAS_SRC}MME/EMM/SAP/EmmRegisteredInitiated.c
+ ${NAS_SRC}MME/EMM/SAP/EmmRegisteredLimitedService.c
+ ${NAS_SRC}MME/EMM/SAP/EmmRegisteredNoCellAvailable.c
+ ${NAS_SRC}MME/EMM/SAP/EmmRegisteredNormalService.c
+ ${NAS_SRC}MME/EMM/SAP/EmmRegisteredPlmnSearch.c
+ ${NAS_SRC}MME/EMM/SAP/EmmRegisteredUpdateNeeded.c
+ ${NAS_SRC}MME/EMM/SAP/emm_sap.c
+ ${NAS_SRC}MME/EMM/SAP/emm_send.c
+ ${NAS_SRC}MME/EMM/SAP/EmmServiceRequestInitiated.c
+ ${NAS_SRC}MME/EMM/SAP/EmmTrackingAreaUpdatingInitiated.c
+ )
+ set (libnas_mme_esm_OBJS
+ ${NAS_SRC}MME/ESM/DedicatedEpsBearerContextActivation.c
+ ${NAS_SRC}MME/ESM/DefaultEpsBearerContextActivation.c
+ ${NAS_SRC}MME/ESM/EpsBearerContextDeactivation.c
+ ${NAS_SRC}MME/ESM/esm_ebr.c
+ ${NAS_SRC}MME/ESM/esm_ebr_context.c
+ ${NAS_SRC}MME/ESM/esm_ip.c
+ ${NAS_SRC}MME/ESM/esm_main.c
+ ${NAS_SRC}MME/ESM/esm_pt.c
+ ${NAS_SRC}MME/ESM/EsmStatusHdl.c
+ ${NAS_SRC}MME/ESM/PdnConnectivity.c
+ ${NAS_SRC}MME/ESM/PdnDisconnect.c
+ )
+ set(libnas_mme_esm_sap_OBJS
+ ${NAS_SRC}MME/ESM/SAP/esm_recv.c
+ ${NAS_SRC}MME/ESM/SAP/esm_send.c
+ ${NAS_SRC}MME/ESM/SAP/esm_sap.c
+ )
+ add_library(LIB_NAS_MME
+ ${NAS_SRC}MME/nas_itti_messaging.c
+ ${NAS_SRC}MME/nas_network.c
+ ${NAS_SRC}MME/nas_parser.c
+ ${NAS_SRC}MME/nas_proc.c
+ ${libnas_api_OBJS}
+ ${libnas_mme_api_OBJS}
+ ${libnas_emm_msg_OBJS}
+ ${libnas_esm_msg_OBJS}
+ ${libnas_ies_OBJS}
+ ${libnas_utils_OBJS}
+ ${libnas_mme_emm_OBJS}
+ ${libnas_mme_emm_sap_OBJS}
+ ${libnas_mme_esm_OBJS}
+ ${libnas_mme_esm_sap_OBJS}
+ )
+ include_directories(${NAS_SRC}MME)
+ include_directories(${NAS_SRC}MME/API/MME)
+ include_directories(${NAS_SRC}MME/EMM)
+ include_directories(${NAS_SRC}MME/EMM/SAP)
+ include_directories(${NAS_SRC}MME/ESM)
+ include_directories(${NAS_SRC}MME/ESM/SAP)
+endif()
+
+
# Make lfds as a own source code (even if it is a outside library)
# For better intergration with compilation flags & structure of cmake
@@ -1356,7 +1486,7 @@ set(lfds ${OPENAIR2_DIR}/UTIL/LFDS/liblfds6.1.1/liblfds611/src/)
file(GLOB lfds_queue ${lfds}/lfds611_queue/*.c)
file(GLOB lfds_ring ${lfds}/lfds611_ringbuffer/*.c)
file(GLOB lfds_slist ${lfds}/lfds611_slist/*.c)
-file(GLOB lfds_stack ${lfds}/lfds611_stack/*.c/)
+file(GLOB lfds_stack ${lfds}/lfds611_stack/*.c)
file(GLOB lfds_freelist ${lfds}/lfds611_freelist/*.c)
include_directories(${lfds})
@@ -1484,23 +1614,59 @@ add_executable(lte-softmodem
${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
${OPENAIR_TARGETS}/SIMU/USER/init_lte.c
${OPENAIR_TARGETS}/COMMON/create_tasks.c
+ ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
+ ${OPENAIRCN_DIR}/NAS/UE/nas_ue_task.c
${GTPU_need_ITTI}
${HW_SOURCE}
${RTAI_SOURCE}
${XFORMS_SOURCE}
${XFORMS_SOURCE_SOFTMODEM}
)
+
target_link_libraries (lte-softmodem
-Wl,--start-group
- RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS L2 ${RAL_LIB} ${NAS_LIB} ${ITTI_LIB} ${MIH_LIB}
+ RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${MIH_LIB}
-Wl,--end-group )
+
+
target_link_libraries (lte-softmodem ${LIBXML2_LIBRARIES})
target_link_libraries (lte-softmodem pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${option_HW_lib} ${XFORMS_LIBRARIES} )
target_link_libraries (lte-softmodem ${LIBBOOST_LIBRARIES})
-if (MESSAGE_CHART_GENERATOR)
- target_link_libraries (lte-softmodem MSC)
-endif()
+
+# lte-softmodem-nos1 is both eNB and UE implementation
+###################################################
+add_executable(lte-softmodem-nos1
+ ${rrc_h}
+ ${s1ap_h}
+ ${OPENAIR_BIN_DIR}/messages_xml.h
+ ${OPENAIR_TARGETS}/RT/USER/sched_dlsch.c
+ ${OPENAIR_TARGETS}/RT/USER/sched_rx_pdsch.c
+ ${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
+ ${OPENAIR_TARGETS}/RT/USER/lte-ue.c
+ ${OPENAIR_TARGETS}/RT/USER/lte-softmodem.c
+ ${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
+ ${OPENAIR_TARGETS}/SIMU/USER/init_lte.c
+ ${OPENAIR_TARGETS}/COMMON/create_tasks.c
+ ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
+ #${OPENAIR2_DIR}/RRC/NAS/nas_config.c # enable if you want rrc to mount ip interface
+ #${OPENAIR2_DIR}/RRC/NAS/rb_config.c
+ ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
+ ${HW_SOURCE}
+ ${RTAI_SOURCE}
+ ${XFORMS_SOURCE}
+ ${XFORMS_SOURCE_SOFTMODEM}
+ )
+target_link_libraries (lte-softmodem-nos1
+ -Wl,--start-group
+ RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${ITTI_LIB} ${MIH_LIB}
+ -Wl,--end-group )
+
+target_link_libraries (lte-softmodem-nos1 ${LIBXML2_LIBRARIES})
+target_link_libraries (lte-softmodem-nos1 pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${option_HW_lib} ${XFORMS_LIBRARIES} )
+target_link_libraries (lte-softmodem-nos1 ${LIBBOOST_LIBRARIES})
+
+
# EPC is ??? nodes implementation in one process
################################
@@ -1510,17 +1676,15 @@ add_executable(mme_gw
${OPENAIRCN_DIR}/OAI_EPC/oai_epc.c
${GTPV1U_DIR}/gtpv1u_task.c
${OPENAIRCN_DIR}/SCTP/sctp_primitives_server.c
- ${OPENAIRCN_DIR}/NAS/nas_main.c
+ ${OPENAIRCN_DIR}/NAS/MME/nas_mme_task.c
)
target_link_libraries (mme_gw
-Wl,--start-group
- NAS S1AP_LIB S1AP_EPC GTPV1U GTPV2C SCTP_SERVER UDP_SERVER SECU_CN SECU_OSA SGI S6A SGW MME_APP LFDS ${ITTI_LIB} CN_UTILS HASHTABLE
+ LIB_NAS_MME S1AP_LIB S1AP_EPC GTPV1U GTPV2C SCTP_SERVER UDP_SERVER SECU_CN SECU_OSA S6A SGW MME_APP LFDS ${MSC_LIB} ${ITTI_LIB} CN_UTILS HASHTABLE
-Wl,--end-group
pthread m sctp rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES} fdproto fdcore
)
-if (MESSAGE_CHART_GENERATOR)
- target_link_libraries (mme_gw MSC)
-endif()
+
# Default parameters
# Does not work on simple install (fqdn in /etc/hosts 127.0.1.1)
@@ -1603,35 +1767,62 @@ add_executable(oai_sgw
)
target_link_libraries (oai_sgw
-Wl,--start-group
- GTPV1U SECU_CN SECU_OSA SGI S6A SGW CN_UTILS LFDS ${ITTI_LIB}
+ GTPV1U SECU_CN SECU_OSA S6A SGW CN_UTILS LFDS ${MSC_LIB} ${ITTI_LIB}
-Wl,--end-group
pthread m sctp rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES} fdproto fdcore
)
-if (MESSAGE_CHART_GENERATOR)
- target_link_libraries (oai_sgw MSC)
-endif()
+
+
+
+# rrh
+################################
+set(DRIVER2013)
+
+#Note: only on RF type is currently supported for RRH
+add_executable(rrh_gw
+ ${OPENAIR_TARGETS}/RT/USER/rrh_gw.c
+ ${OPENAIR_TARGETS}/RT/USER/eNB_transport_IQ.c
+ ${OPENAIR_TARGETS}/RT/USER/UE_transport_IQ.c
+ ${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
+ ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
+ ${OPENAIR_TARGETS}/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c
+ ${HW_SOURCE}
+ )
+# assert and common_lib.h
+target_include_directories(rrh_gw PRIVATE ${OPENAIR_DIR}/common/utils/itti ${OPENAIR_TARGETS}/ARCH/COMMON ${OPENAIR_TARGETS}/ARCH/ETHERNET/USERSPACE/LIB/ )
+
+target_link_libraries(rrh_gw
+ -Wl,--start-group
+ UTIL LFDS
+ -Wl,--end-group )
+target_link_libraries (rrh_gw rt pthread m )
+target_link_libraries (rrh_gw ${option_HW_lib} ${LIBBOOST_LIBRARIES} )
+
+#Message("-- default_HW_lib=ETHERNET") # only in case of RRH
+Message("-- option_HW_lib=${option_HW_lib}")
+Message("-- HW_SOURCE=${HW_SOURCE}")
# USIM process
#################
#add_executable(usim
-# ${OPENAIRCN_DIR}/NAS/EURECOM-NAS/tools/usim_data.c
-# ${OPENAIRCN_DIR}/NAS/EURECOM-NAS/src/api/usim/usim_api.c
-# ${OPENAIRCN_DIR}/NAS/EURECOM-NAS/src/api/usim/aka_functions.c
-# ${OPENAIRCN_DIR}/NAS/EURECOM-NAS/src/util/memory.c
-# ${OPENAIRCN_DIR}/NAS/EURECOM-NAS/src/util/nas_log.c
-# ${OPENAIRCN_DIR}/NAS/EURECOM-NAS/src/util/OctetString.c
-# ${OPENAIRCN_DIR}/NAS/EURECOM-NAS/src/util/TLVEncoder.c
+# ${OPENAIRCN_DIR}/NAS/TOOLS/usim_data.c
+# ${OPENAIRCN_DIR}/NAS/USER/API/USIM/usim_api.c
+# ${OPENAIRCN_DIR}/NAS/USER/API/USIM/aka_functions.c
+# ${OPENAIRCN_DIR}/NAS/COMMON/UTIL/memory.c
+# ${OPENAIRCN_DIR}/NAS/COMMON/UTIL/nas_log.c
+# ${OPENAIRCN_DIR}/NAS/COMMON/UTIL/OctetString.c
+# ${OPENAIRCN_DIR}/NAS/COMMON/UTIL/TLVEncoder.c
# )
#target_link_libraries (usim ${NAS_LIB} UTIL ${ITTI_LIB} LFDS pthread rt nettle crypto m)
# ???
#####################
#add_executable(nvram
-# ${OPENAIRCN_DIR}/NAS/EURECOM-NAS/tools/ue_data.c
-# ${OPENAIRCN_DIR}/NAS/EURECOM-NAS/src/util/memory.c
-# ${OPENAIRCN_DIR}/NAS/EURECOM-NAS/src/util/nas_log.c
+# ${OPENAIRCN_DIR}/NAS/TOOLS/ue_data.c
+# ${OPENAIRCN_DIR}/NAS/COMMON/UTIL/memory.c
+# ${OPENAIRCN_DIR}/NAS/COMMON/UTIL/nas_log.c
# )
-#target_link_libraries (nvram ${NAS_LIB} UTIL ${ITTI_LIB} LFDS pthread rt nettle crypto m)
+#target_link_libraries (nvram LIB_NAS_UE UTIL ${ITTI_LIB} LFDS pthread rt nettle crypto m)
###################################"
@@ -1643,6 +1834,7 @@ endif()
add_executable(oaisim
${rrc_h}
${s1ap_h}
+ ${x2ap_h}
${OPENAIR_BIN_DIR}/messages_xml.h
${OPENAIR_TARGETS}/SIMU/USER/channel_sim.c
${OPENAIR_TARGETS}/SIMU/USER/init_lte.c
@@ -1655,24 +1847,26 @@ add_executable(oaisim
${OPENAIR2_DIR}/RRC/NAS/nas_config.c
${OPENAIR2_DIR}/RRC/NAS/rb_config.c
${OPENAIR2_DIR}/UTIL/OMG/sumo.c
+ ${OPENAIRCN_DIR}/NAS/UE/nas_ue_task.c
${GTPU_need_ITTI}
${OPENAIR_TARGETS}/COMMON/create_tasks.c
${HW_SOURCE}
${XFORMS_SOURCE}
)
+
+
target_include_directories(oaisim PUBLIC ${OPENAIR_TARGETS}/SIMU/USER)
target_link_libraries (oaisim
-Wl,--start-group
- RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS L2 ${RAL_LIB} ${NAS_LIB} SIMU SIMU_ETH SECU_OSA ${ITTI_LIB} ${MIH_LIB}
+ RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB GTPV1U SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS ${MSC_LIB} L2 ${RAL_LIB} LIB_NAS_UE SIMU SIMU_ETH SECU_OSA ${ITTI_LIB} ${MIH_LIB}
-Wl,--end-group )
+
target_link_libraries (oaisim ${LIBXML2_LIBRARIES} ${LAPACK_LIBRARIES})
target_link_libraries (oaisim pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${option_HW_lib}
${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${OPENPGM_LIBRARIES})
#Force link with forms, regardless XFORMS option
target_link_libraries (oaisim forms)
-if (MESSAGE_CHART_GENERATOR)
- target_link_libraries (oaisim MSC)
-endif()
+
# A all in one network simulator
@@ -1680,6 +1874,7 @@ endif()
add_executable(oaisim_nos1
${rrc_h}
${s1ap_h}
+ ${x2ap_h}
${OPENAIR_BIN_DIR}/messages_xml.h
${OPENAIR_TARGETS}/SIMU/USER/channel_sim.c
${OPENAIR_TARGETS}/SIMU/USER/init_lte.c
@@ -1699,16 +1894,14 @@ add_executable(oaisim_nos1
target_include_directories(oaisim_nos1 PUBLIC ${OPENAIR_TARGETS}/SIMU/USER)
target_link_libraries (oaisim_nos1
-Wl,--start-group
- RRC_LIB SECU_CN UTIL HASHTABLE UDP SCHED_LIB PHY LFDS L2 ${RAL_LIB} ${NAS_LIB} SIMU SIMU_ETH SECU_OSA ${ITTI_LIB} ${MIH_LIB}
+ RRC_LIB X2AP_LIB SECU_CN UTIL HASHTABLE SCHED_LIB PHY LFDS ${MSC_LIB} L2 ${RAL_LIB} SIMU SIMU_ETH SECU_OSA ${ITTI_LIB} ${MIH_LIB}
-Wl,--end-group )
+
target_link_libraries (oaisim_nos1 ${LIBXML2_LIBRARIES} ${LAPACK_LIBRARIES})
target_link_libraries (oaisim_nos1 pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${option_HW_lib}
${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${OPENPGM_LIBRARIES})
#Force link with forms, regardless XFORMS option
target_link_libraries (oaisim_nos1 forms)
-if (MESSAGE_CHART_GENERATOR)
- target_link_libraries (oaisim_nos1 MSC)
-endif()
# Unitary tests for each piece of L1: example, mbmssim is MBMS L1 simulator
@@ -1716,11 +1909,12 @@ endif()
foreach(myExe dlsim ulsim pbchsim scansim mbmssim pdcchsim pucchsim prachsim syncsim)
add_executable(${myExe}
+ ${OPENAIR_BIN_DIR}/messages_xml.h
${OPENAIR1_DIR}/SIMULATION/LTE_PHY/${myExe}.c
${XFORMS_SOURCE}
)
target_link_libraries (${myExe}
- -Wl,--start-group SIMU UTIL SCHED_LIB PHY LFDS MSC ${ITTI_LIB} -Wl,--end-group
+ -Wl,--start-group SIMU UTIL SCHED_LIB PHY LFDS ${ITTI_LIB} -Wl,--end-group
pthread m rt ${CONFIG_LIBRARIES} ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES}
)
endforeach(myExe)
@@ -1750,13 +1944,21 @@ add_executable(test_s1c_mme
${OPENAIRCN_DIR}/TEST/oaisim_mme_test_s1c.c
${OPENAIRCN_DIR}/TEST/oaisim_mme_test_s1c_scenario.h
${OPENAIRCN_DIR}/TEST/oaisim_mme_test_s1c_scenario1.c
+ ${OPENAIRCN_DIR}/TEST/oaisim_mme_test_s1c_scenario.c
+ ${OPENAIRCN_DIR}/TEST/oaisim_mme_test_s1c_scenario.h
+ ${OPENAIRCN_DIR}/TEST/oaisim_mme_test_s1c_s1ap.c
+ ${OPENAIRCN_DIR}/TEST/oaisim_mme_test_s1c_s1ap.h
${OPENAIR2_DIR}/ENB_APP/enb_config.c
${OPENAIR2_DIR}/ENB_APP/enb_config.h
- ${s1ap_h}
+ ${OPENAIR2_DIR}/COMMON/commonDef.h
+ ${OPENAIR2_DIR}/COMMON/messages_def.h
+ ${OPENAIR2_DIR}/COMMON/messages_types.h
+ ${OPENAIRCN_DIR}/S1AP/s1ap_eNB_defs.h
+ ${S1AP_DIR}/s1ap_eNB_management_procedures.c
${OPENAIR_BIN_DIR}/messages_xml.h
)
target_link_libraries (test_s1c_mme
- -Wl,--start-group SECU_CN S1AP_LIB S1AP_ENB SCTP_CLIENT UTIL LFDS ${ITTI_LIB} -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES} fdproto fdcore
+ -Wl,--start-group SECU_CN S1AP_LIB SCTP_CLIENT UTIL LFDS ${ITTI_LIB} -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES} fdproto fdcore
)
@@ -1767,21 +1969,19 @@ target_link_libraries (test_s1c_mme
# ???
###########################
-add_executable(oaisim_mme
- ${OPENAIR_BIN_DIR}/messages_xml.h
- ${OPENAIRCN_DIR}/OAISIM_MME/oai_mme_log.c
- ${OPENAIRCN_DIR}/OAISIM_MME/oaisim_mme.c
- ${OPENAIRCN_DIR}/NAS/nas_main.c
-)
-target_link_libraries (oaisim_mme
- -Wl,--start-group
- NAS S1AP_LIB S1AP_EPC GTPV1U GTPV2C SCTP_SERVER UDP_SERVER SECU_CN SECU_OSA SGI S6A S11 SGW MME_APP LFDS MSC ${ITTI_LIB} CN_UTILS HASHTABLE
- -Wl,--end-group
- pthread m sctp rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES} fdproto fdcore
-)
-if (MESSAGE_CHART_GENERATOR)
- target_link_libraries (oaisim_mme MSC)
-endif()
+#add_executable(oaisim_mme
+# ${OPENAIR_BIN_DIR}/messages_xml.h
+# ${OPENAIRCN_DIR}/OAISIM_MME/oai_mme_log.c
+# ${OPENAIRCN_DIR}/OAISIM_MME/oaisim_mme.c
+# ${OPENAIRCN_DIR}/NAS/nas_main.c
+#)
+#target_link_libraries (oaisim_mme
+# -Wl,--start-group
+# NAS S1AP_LIB S1AP_EPC GTPV1U GTPV2C SCTP_SERVER UDP_SERVER SECU_CN SECU_OSA S6A S11 SGW MME_APP LFDS MSC ${ITTI_LIB} CN_UTILS HASHTABLE
+# -Wl,--end-group
+# pthread m sctp rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES} fdproto fdcore
+#)
+
##################################################
# Generated specific cases is not regular code
@@ -1914,7 +2114,7 @@ make_driver(ue_ip ${OPENAIR2_DIR}/NETWORK_DRIVER/UE_IP ${ue_ip_src})
########################
# KVERSION is not used in the code, but required
set(module_cc_opt "${module_cc_opt} -DKVERSION=3")
-make_driver(xt_GTPUAH ${OPENAIRCN_DIR}/GTPV1-U/GTPUAH "")
+make_driver(xt_GTPUSP ${OPENAIRCN_DIR}/GTPV1-U/GTPU_SP "")
# add the install targets
#install (TARGETS Tutorial DESTINATION bin)
@@ -1953,3 +2153,37 @@ ADD_CUSTOM_TARGET(oarf
DEPENDS ${OCT_FILES}
)
+#CMAKE INSTALL and CPACK
+
+#INSTALL(PROGRAMS lte-softmodem ${OPENAIR_DIR}/targets DESTINATION bin)
+#INSTALL(PROGRAMS oaisim ${OPENAIR_DIR}/targets DESTINATION bin)
+
+
+#SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "OpenAirInterface")
+#SET(CPACK_PACKAGE_VENDOR "Eurecom")
+#SET(CPACK_PACKAGE_DESCRIPTION_FILE "${OPENAIR_DIR}/README.txt")
+#SET(CPACK_RESOURCE_FILE_LICENSE "${OPENAIR_DIR}/COPYING")
+#SET(CPACK_PACKAGE_VERSION_MAJOR "1")
+#SET(CPACK_PACKAGE_VERSION_MINOR "1")
+#SET(CPACK_PACKAGE_VERSION_PATCH "1")
+
+#SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}")
+#SET(CPACK_STRIP_FILES "${OPENAIR_TARGETS}/bin")
+#SET(CPACK_SOURCE_STRIP_FILES "")
+
+##debian specific
+#SET(CPACK_DEBIAN_PACKAGE_NAME "OAI")
+#SET(CPACK_DEBIAN_PACKAGE_VERSION "${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}")
+##dpkg --print-architecture (do not use i686
+#SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
+
+#SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.3.1-6), libgcc1 (>= 1:3.4.2-12)")
+#SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libpthread.so.0 libm.so.6 libconfig.so.9 librt.so.1 libcrypt.so.1 libcrypto.so.1.0.0 libnettle.so.4 libsctp.so.1 libc.so.6")
+#SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "EURECOM-OSA")
+
+#SET(CPACK_PACKAGE_EXECUTABLES "lte-softmodem" "mme_gw.Rel10" "openair-hss")
+
+#SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION "OpenAirInterface")
+#SET(CPACK_DEBIAN_PACKAGE_Section "Beta-Release")
+
+#INCLUDE(CPack)
diff --git a/cmake_targets/at_commands/CMakeLists.txt b/cmake_targets/at_commands/CMakeLists.txt
index 83180c41f9..cfdb6ec2aa 100755
--- a/cmake_targets/at_commands/CMakeLists.txt
+++ b/cmake_targets/at_commands/CMakeLists.txt
@@ -15,7 +15,7 @@
# 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 .
+# see .
#
# Contact Information
# OpenAirInterface Admin: openair_admin@eurecom.fr
@@ -51,7 +51,7 @@ set(OPENAIRCN_DIR ${OPENAIR_DIR}/openair-cn)
set(OPENAIR_TARGETS ${OPENAIR_DIR}/targets)
set(OPENAIR_CMAKE_SCRIPTS ${OPENAIR_DIR}/cmake_targets/tools)
set(OPENAIR_BIN_DIR ${OPENAIR_DIR}/targets/bin)
-set(OPENAIR_NAS_DIR ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS)
+set(OPENAIR_NAS_DIR ${OPENAIR_DIR}/openair-cn/NAS)
set(CMAKE_MODULE_PATH "${OPENAIR_DIR}/cmake_targets/tools/MODULES" "${CMAKE_MODULE_PATH}")
@@ -151,229 +151,229 @@ target_include_directories(secu_cn PRIVATE
# UTIL LIB
################################################################################
set(util_SRC
- ${OPENAIR_NAS_DIR}/src/util/device.c
- ${OPENAIR_NAS_DIR}/src/util/memory.c
- ${OPENAIR_NAS_DIR}/src/util/nas_log.c
- ${OPENAIR_NAS_DIR}/src/util/nas_timer.c
- ${OPENAIR_NAS_DIR}/src/util/OctetString.c
- ${OPENAIR_NAS_DIR}/src/util/parser.c
- ${OPENAIR_NAS_DIR}/src/util/TLVDecoder.c
- ${OPENAIR_NAS_DIR}/src/util/TLVEncoder.c
- ${OPENAIR_NAS_DIR}/src/util/socket.c
- ${OPENAIR_NAS_DIR}/src/util/stty.c
+ ${OPENAIR_NAS_DIR}/COMMON/UTIL/device.c
+ ${OPENAIR_NAS_DIR}/COMMON/UTIL/memory.c
+ ${OPENAIR_NAS_DIR}/COMMON/UTIL/nas_log.c
+ ${OPENAIR_NAS_DIR}/COMMON/UTIL/nas_timer.c
+ ${OPENAIR_NAS_DIR}/COMMON/UTIL/OctetString.c
+ ${OPENAIR_NAS_DIR}/COMMON/UTIL/parser.c
+ ${OPENAIR_NAS_DIR}/COMMON/UTIL/TLVDecoder.c
+ ${OPENAIR_NAS_DIR}/COMMON/UTIL/TLVEncoder.c
+ ${OPENAIR_NAS_DIR}/COMMON/UTIL/socket.c
+ ${OPENAIR_NAS_DIR}/COMMON/UTIL/stty.c
)
set(util_HDR
- ${OPENAIR_NAS_DIR}/src/util/device.h
- ${OPENAIR_NAS_DIR}/src/util/memory.h
- ${OPENAIR_NAS_DIR}/src/util/nas_log.h
- ${OPENAIR_NAS_DIR}/src/util/nas_timer.h
- ${OPENAIR_NAS_DIR}/src/util/OctetString.h
- ${OPENAIR_NAS_DIR}/src/util/parser.h
- ${OPENAIR_NAS_DIR}/src/util/TLVDecoder.h
- ${OPENAIR_NAS_DIR}/src/util/TLVEncoder.h
- ${OPENAIR_NAS_DIR}/src/util/socket.h
+ ${OPENAIR_NAS_DIR}/COMMON/UTIL/device.h
+ ${OPENAIR_NAS_DIR}/COMMON/UTIL/memory.h
+ ${OPENAIR_NAS_DIR}/COMMON/UTIL/nas_log.h
+ ${OPENAIR_NAS_DIR}/COMMON/UTIL/nas_timer.h
+ ${OPENAIR_NAS_DIR}/COMMON/UTIL/OctetString.h
+ ${OPENAIR_NAS_DIR}/COMMON/UTIL/parser.h
+ ${OPENAIR_NAS_DIR}/COMMON/UTIL/TLVDecoder.h
+ ${OPENAIR_NAS_DIR}/COMMON/UTIL/TLVEncoder.h
+ ${OPENAIR_NAS_DIR}/COMMON/UTIL/socket.h
)
add_library(util ${util_SRC} ${util_HDR})
-target_include_directories(util PRIVATE ${OPENAIR_NAS_DIR}/src/util)
+target_include_directories(util PRIVATE ${OPENAIR_NAS_DIR}/COMMON/UTIL
+ ${OPENAIR_NAS_DIR}/COMMON
+ )
################################################################################
# api_user LIB
################################################################################
set(api_user_SRC
- ${OPENAIR_NAS_DIR}/src/api/user/at_command.c
- ${OPENAIR_NAS_DIR}/src/api/user/at_error.c
- ${OPENAIR_NAS_DIR}/src/api/user/at_response.c
- ${OPENAIR_NAS_DIR}/src/api/user/user_api.c
- ${OPENAIR_NAS_DIR}/src/api/user/user_indication.c
+ ${OPENAIR_NAS_DIR}/UE/API/USER/at_command.c
+ ${OPENAIR_NAS_DIR}/UE/API/USER/at_error.c
+ ${OPENAIR_NAS_DIR}/UE/API/USER/at_response.c
+ ${OPENAIR_NAS_DIR}/UE/API/USER/user_api.c
+ ${OPENAIR_NAS_DIR}/UE/API/USER/user_indication.c
)
set(api_user_HDR
- ${OPENAIR_NAS_DIR}/src/api/user/at_command.h
- ${OPENAIR_NAS_DIR}/src/api/user/at_error.h
- ${OPENAIR_NAS_DIR}/src/api/user/at_response.h
- ${OPENAIR_NAS_DIR}/src/api/user/user_api.h
- ${OPENAIR_NAS_DIR}/src/api/user/user_indication.h
+ ${OPENAIR_NAS_DIR}/UE/API/USER/at_command.h
+ ${OPENAIR_NAS_DIR}/UE/API/USER/at_error.h
+ ${OPENAIR_NAS_DIR}/UE/API/USER/at_response.h
+ ${OPENAIR_NAS_DIR}/UE/API/USER/user_api.h
+ ${OPENAIR_NAS_DIR}/UE/API/USER/user_indication.h
)
add_library(api_user ${api_user_SRC} ${api_user_HDR})
-target_include_directories(api_user PRIVATE ${OPENAIR_NAS_DIR}/src/api/user)
+target_include_directories(api_user PRIVATE ${OPENAIR_NAS_DIR}/UE/API/USER
+ ${OPENAIR_NAS_DIR}/UE
+ ${OPENAIR_NAS_DIR}/COMMON
+ )
################################################################################
# api_usim LIB
################################################################################
set(api_usim_SRC
- ${OPENAIR_NAS_DIR}/src/api/usim/aka_functions.c
- ${OPENAIR_NAS_DIR}/src/api/usim/usim_api.c
+ ${OPENAIR_NAS_DIR}/UE/API/USIM/aka_functions.c
+ ${OPENAIR_NAS_DIR}/UE/API/USIM/usim_api.c
)
set(api_usim_HDR
- ${OPENAIR_NAS_DIR}/src/api/usim/aka_functions.h
- ${OPENAIR_NAS_DIR}/src/api/usim/usim_api.h
+ ${OPENAIR_NAS_DIR}/UE/API/USIM/aka_functions.h
+ ${OPENAIR_NAS_DIR}/UE/API/USIM/usim_api.h
)
add_library(api_usim ${api_usim_SRC} ${api_usim_HDR})
-target_include_directories(api_usim PRIVATE ${OPENAIR_NAS_DIR}/src/api/usim)
+target_include_directories(api_usim PRIVATE ${OPENAIR_NAS_DIR}/UE/API/USIM)
################################################################################
# api_network LIB
################################################################################
set(api_network_SRC
- ${OPENAIR_NAS_DIR}/src/api/network/as_message.c
- ${OPENAIR_NAS_DIR}/src/api/network/nas_message.c
- ${OPENAIR_NAS_DIR}/src/api/network/network_api.c
+ ${OPENAIR_NAS_DIR}/COMMON/API/NETWORK/as_message.c
+ ${OPENAIR_NAS_DIR}/COMMON/API/NETWORK/nas_message.c
+ ${OPENAIR_NAS_DIR}/COMMON/API/NETWORK/network_api.c
)
set(api_network_HDR
- ${OPENAIR_NAS_DIR}/src/api/network/as_message.h
- ${OPENAIR_NAS_DIR}/src/api/network/nas_message.h
- ${OPENAIR_NAS_DIR}/src/api/network/network_api.h
+ ${OPENAIR_NAS_DIR}/COMMON/API/NETWORK/as_message.h
+ ${OPENAIR_NAS_DIR}/COMMON/API/NETWORK/nas_message.h
+ ${OPENAIR_NAS_DIR}/COMMON/API/NETWORK/network_api.h
)
add_library(api_network ${api_network_SRC} ${api_network_HDR})
-target_include_directories(api_network PRIVATE ${OPENAIR_NAS_DIR}/src/api/network)
+target_include_directories(api_network PRIVATE ${OPENAIR_NAS_DIR}/COMMON/API/NETWORK
+ ${OPENAIR_NAS_DIR}/COMMON
+ )
################################################################################
# emm LIB
################################################################################
set(emm_SRC
- ${OPENAIR_NAS_DIR}/src/emm//Attach.c
- ${OPENAIR_NAS_DIR}/src/emm//Authentication.c
- ${OPENAIR_NAS_DIR}/src/emm//Detach.c
- ${OPENAIR_NAS_DIR}/src/emm//EmmCommon.c
- ${OPENAIR_NAS_DIR}/src/emm//emm_data_ctx.c
- ${OPENAIR_NAS_DIR}/src/emm//emm_main.c
- ${OPENAIR_NAS_DIR}/src/emm//EmmStatusHdl.c
- ${OPENAIR_NAS_DIR}/src/emm//Identification.c
- ${OPENAIR_NAS_DIR}/src/emm//IdleMode.c
- ${OPENAIR_NAS_DIR}/src/emm//LowerLayer.c
- ${OPENAIR_NAS_DIR}/src/emm//SecurityModeControl.c
- ${OPENAIR_NAS_DIR}/src/emm//ServiceRequestHdl.c
- ${OPENAIR_NAS_DIR}/src/emm//TrackingAreaUpdate.c
+ ${OPENAIR_NAS_DIR}/UE/EMM/Attach.c
+ ${OPENAIR_NAS_DIR}/UE/EMM/Authentication.c
+ ${OPENAIR_NAS_DIR}/UE/EMM/Detach.c
+ ${OPENAIR_NAS_DIR}/UE/EMM/emm_main.c
+ ${OPENAIR_NAS_DIR}/UE/EMM/EmmStatusHdl.c
+ ${OPENAIR_NAS_DIR}/UE/EMM/Identification.c
+ ${OPENAIR_NAS_DIR}/UE/EMM/IdleMode.c
+ ${OPENAIR_NAS_DIR}/UE/EMM/LowerLayer.c
+ ${OPENAIR_NAS_DIR}/UE/EMM/SecurityModeControl.c
+ ${OPENAIR_NAS_DIR}/UE/EMM/ServiceRequestHdl.c
+ ${OPENAIR_NAS_DIR}/UE/EMM/TrackingAreaUpdate.c
- ${OPENAIR_NAS_DIR}/src/emm/msg/emm_msg.c
- ${OPENAIR_NAS_DIR}/src/emm/msg/AttachAccept.c
- ${OPENAIR_NAS_DIR}/src/emm/msg/AttachComplete.c
- ${OPENAIR_NAS_DIR}/src/emm/msg/AttachReject.c
- ${OPENAIR_NAS_DIR}/src/emm/msg/AttachAccept.c
- ${OPENAIR_NAS_DIR}/src/emm/msg/AttachComplete.c
- ${OPENAIR_NAS_DIR}/src/emm/msg/AttachReject.c
- ${OPENAIR_NAS_DIR}/src/emm/msg/AttachRequest.c
- ${OPENAIR_NAS_DIR}/src/emm/msg/AuthenticationFailure.c
- ${OPENAIR_NAS_DIR}/src/emm/msg/AuthenticationReject.c
- ${OPENAIR_NAS_DIR}/src/emm/msg/AuthenticationRequest.c
- ${OPENAIR_NAS_DIR}/src/emm/msg/AuthenticationResponse.c
- ${OPENAIR_NAS_DIR}/src/emm/msg/CsServiceNotification.c
- ${OPENAIR_NAS_DIR}/src/emm/msg/DetachAccept.c
- ${OPENAIR_NAS_DIR}/src/emm/msg/DetachRequest.c
- ${OPENAIR_NAS_DIR}/src/emm/msg/DownlinkNasTransport.c
- ${OPENAIR_NAS_DIR}/src/emm/msg/EmmInformation.c
- ${OPENAIR_NAS_DIR}/src/emm/msg/emm_msg.c
- ${OPENAIR_NAS_DIR}/src/emm/msg/EmmStatus.c
- ${OPENAIR_NAS_DIR}/src/emm/msg/ExtendedServiceRequest.c
- ${OPENAIR_NAS_DIR}/src/emm/msg/GutiReallocationCommand.c
- ${OPENAIR_NAS_DIR}/src/emm/msg/GutiReallocationComplete.c
- ${OPENAIR_NAS_DIR}/src/emm/msg/IdentityRequest.c
- ${OPENAIR_NAS_DIR}/src/emm/msg/IdentityResponse.c
- ${OPENAIR_NAS_DIR}/src/emm/msg/SecurityModeCommand.c
- ${OPENAIR_NAS_DIR}/src/emm/msg/SecurityModeComplete.c
- ${OPENAIR_NAS_DIR}/src/emm/msg/SecurityModeReject.c
- ${OPENAIR_NAS_DIR}/src/emm/msg/ServiceReject.c
- ${OPENAIR_NAS_DIR}/src/emm/msg/ServiceRequest.c
- ${OPENAIR_NAS_DIR}/src/emm/msg/TrackingAreaUpdateAccept.c
- ${OPENAIR_NAS_DIR}/src/emm/msg/TrackingAreaUpdateComplete.c
- ${OPENAIR_NAS_DIR}/src/emm/msg/TrackingAreaUpdateReject.c
- ${OPENAIR_NAS_DIR}/src/emm/msg/TrackingAreaUpdateRequest.c
- ${OPENAIR_NAS_DIR}/src/emm/msg/UplinkNasTransport.c
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/emm_msg.c
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/AttachAccept.c
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/AttachComplete.c
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/AttachReject.c
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/AttachAccept.c
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/AttachComplete.c
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/AttachReject.c
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/AttachRequest.c
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/AuthenticationFailure.c
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/AuthenticationReject.c
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/AuthenticationRequest.c
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/AuthenticationResponse.c
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/CsServiceNotification.c
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/DetachAccept.c
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/DetachRequest.c
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/DownlinkNasTransport.c
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/EmmInformation.c
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/emm_msg.c
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/EmmStatus.c
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/ExtendedServiceRequest.c
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/GutiReallocationCommand.c
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/GutiReallocationComplete.c
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/IdentityRequest.c
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/IdentityResponse.c
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/SecurityModeCommand.c
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/SecurityModeComplete.c
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/SecurityModeReject.c
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/ServiceReject.c
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/ServiceRequest.c
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/TrackingAreaUpdateAccept.c
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/TrackingAreaUpdateComplete.c
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/TrackingAreaUpdateReject.c
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/TrackingAreaUpdateRequest.c
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/UplinkNasTransport.c
- ${OPENAIR_NAS_DIR}/src/emm/sap//emm_as.c
-# ${OPENAIR_NAS_DIR}/src/emm/sap//emm_cn.c
- ${OPENAIR_NAS_DIR}/src/emm/sap//EmmCommonProcedureInitiated.c
- ${OPENAIR_NAS_DIR}/src/emm/sap//EmmDeregisteredAttachNeeded.c
- ${OPENAIR_NAS_DIR}/src/emm/sap//EmmDeregisteredAttemptingToAttach.c
- ${OPENAIR_NAS_DIR}/src/emm/sap//EmmDeregistered.c
- ${OPENAIR_NAS_DIR}/src/emm/sap//EmmDeregisteredInitiated.c
- ${OPENAIR_NAS_DIR}/src/emm/sap//EmmDeregisteredLimitedService.c
- ${OPENAIR_NAS_DIR}/src/emm/sap//EmmDeregisteredNoCellAvailable.c
- ${OPENAIR_NAS_DIR}/src/emm/sap//EmmDeregisteredNoImsi.c
- ${OPENAIR_NAS_DIR}/src/emm/sap//EmmDeregisteredNormalService.c
- ${OPENAIR_NAS_DIR}/src/emm/sap//EmmDeregisteredPlmnSearch.c
- ${OPENAIR_NAS_DIR}/src/emm/sap//emm_esm.c
- ${OPENAIR_NAS_DIR}/src/emm/sap//emm_fsm.c
- ${OPENAIR_NAS_DIR}/src/emm/sap//EmmNull.c
- ${OPENAIR_NAS_DIR}/src/emm/sap//emm_recv.c
- ${OPENAIR_NAS_DIR}/src/emm/sap//emm_reg.c
- ${OPENAIR_NAS_DIR}/src/emm/sap//EmmRegisteredAttemptingToUpdate.c
- ${OPENAIR_NAS_DIR}/src/emm/sap//EmmRegistered.c
- ${OPENAIR_NAS_DIR}/src/emm/sap//EmmRegisteredImsiDetachInitiated.c
- ${OPENAIR_NAS_DIR}/src/emm/sap//EmmRegisteredInitiated.c
- ${OPENAIR_NAS_DIR}/src/emm/sap//EmmRegisteredLimitedService.c
- ${OPENAIR_NAS_DIR}/src/emm/sap//EmmRegisteredNoCellAvailable.c
- ${OPENAIR_NAS_DIR}/src/emm/sap//EmmRegisteredNormalService.c
- ${OPENAIR_NAS_DIR}/src/emm/sap//EmmRegisteredPlmnSearch.c
- ${OPENAIR_NAS_DIR}/src/emm/sap//EmmRegisteredUpdateNeeded.c
- ${OPENAIR_NAS_DIR}/src/emm/sap//emm_sap.c
- ${OPENAIR_NAS_DIR}/src/emm/sap//emm_send.c
- ${OPENAIR_NAS_DIR}/src/emm/sap//EmmServiceRequestInitiated.c
- ${OPENAIR_NAS_DIR}/src/emm/sap//EmmTrackingAreaUpdatingInitiated.c
+ ${OPENAIR_NAS_DIR}/UE/EMM/SAP/emm_as.c
+ ${OPENAIR_NAS_DIR}/UE/EMM/SAP/EmmDeregisteredAttachNeeded.c
+ ${OPENAIR_NAS_DIR}/UE/EMM/SAP/EmmDeregisteredAttemptingToAttach.c
+ ${OPENAIR_NAS_DIR}/UE/EMM/SAP/EmmDeregistered.c
+ ${OPENAIR_NAS_DIR}/UE/EMM/SAP/EmmDeregisteredInitiated.c
+ ${OPENAIR_NAS_DIR}/UE/EMM/SAP/EmmDeregisteredLimitedService.c
+ ${OPENAIR_NAS_DIR}/UE/EMM/SAP/EmmDeregisteredNoCellAvailable.c
+ ${OPENAIR_NAS_DIR}/UE/EMM/SAP/EmmDeregisteredNoImsi.c
+ ${OPENAIR_NAS_DIR}/UE/EMM/SAP/EmmDeregisteredNormalService.c
+ ${OPENAIR_NAS_DIR}/UE/EMM/SAP/EmmDeregisteredPlmnSearch.c
+ ${OPENAIR_NAS_DIR}/UE/EMM/SAP/emm_esm.c
+ ${OPENAIR_NAS_DIR}/UE/EMM/SAP/emm_fsm.c
+ ${OPENAIR_NAS_DIR}/UE/EMM/SAP/EmmNull.c
+ ${OPENAIR_NAS_DIR}/UE/EMM/SAP/emm_recv.c
+ ${OPENAIR_NAS_DIR}/UE/EMM/SAP/emm_reg.c
+ ${OPENAIR_NAS_DIR}/UE/EMM/SAP/EmmRegisteredAttemptingToUpdate.c
+ ${OPENAIR_NAS_DIR}/UE/EMM/SAP/EmmRegistered.c
+ ${OPENAIR_NAS_DIR}/UE/EMM/SAP/EmmRegisteredImsiDetachInitiated.c
+ ${OPENAIR_NAS_DIR}/UE/EMM/SAP/EmmRegisteredInitiated.c
+ ${OPENAIR_NAS_DIR}/UE/EMM/SAP/EmmRegisteredLimitedService.c
+ ${OPENAIR_NAS_DIR}/UE/EMM/SAP/EmmRegisteredNoCellAvailable.c
+ ${OPENAIR_NAS_DIR}/UE/EMM/SAP/EmmRegisteredNormalService.c
+ ${OPENAIR_NAS_DIR}/UE/EMM/SAP/EmmRegisteredPlmnSearch.c
+ ${OPENAIR_NAS_DIR}/UE/EMM/SAP/EmmRegisteredUpdateNeeded.c
+ ${OPENAIR_NAS_DIR}/UE/EMM/SAP/emm_sap.c
+ ${OPENAIR_NAS_DIR}/UE/EMM/SAP/emm_send.c
+ ${OPENAIR_NAS_DIR}/UE/EMM/SAP/EmmServiceRequestInitiated.c
+ ${OPENAIR_NAS_DIR}/UE/EMM/SAP/EmmTrackingAreaUpdatingInitiated.c
)
set(emm_HDR
- ${OPENAIR_NAS_DIR}/src/emm//EmmCommon.h
- ${OPENAIR_NAS_DIR}/src/emm//emmData.h
- ${OPENAIR_NAS_DIR}/src/emm//emm_main.h
- ${OPENAIR_NAS_DIR}/src/emm//emm_proc.h
- ${OPENAIR_NAS_DIR}/src/emm//IdleMode.h
- ${OPENAIR_NAS_DIR}/src/emm//LowerLayer.h
+ ${OPENAIR_NAS_DIR}/UE/EMM/emmData.h
+ ${OPENAIR_NAS_DIR}/UE/EMM/emm_main.h
+ ${OPENAIR_NAS_DIR}/UE/EMM/emm_proc.h
+ ${OPENAIR_NAS_DIR}/UE/EMM/IdleMode.h
+ ${OPENAIR_NAS_DIR}/UE/EMM/LowerLayer.h
- ${OPENAIR_NAS_DIR}/src/emm/msg/AttachAccept.h
- ${OPENAIR_NAS_DIR}/src/emm/msg/AttachComplete.h
- ${OPENAIR_NAS_DIR}/src/emm/msg/AttachReject.h
- ${OPENAIR_NAS_DIR}/src/emm/msg/AttachRequest.h
- ${OPENAIR_NAS_DIR}/src/emm/msg/AuthenticationFailure.h
- ${OPENAIR_NAS_DIR}/src/emm/msg/AuthenticationReject.h
- ${OPENAIR_NAS_DIR}/src/emm/msg/AuthenticationRequest.h
- ${OPENAIR_NAS_DIR}/src/emm/msg/AuthenticationResponse.h
- ${OPENAIR_NAS_DIR}/src/emm/msg/CsServiceNotification.h
- ${OPENAIR_NAS_DIR}/src/emm/msg/DetachAccept.h
- ${OPENAIR_NAS_DIR}/src/emm/msg/DetachRequest.h
- ${OPENAIR_NAS_DIR}/src/emm/msg/DownlinkNasTransport.h
- ${OPENAIR_NAS_DIR}/src/emm/msg/emm_cause.h
- ${OPENAIR_NAS_DIR}/src/emm/msg/EmmInformation.h
- ${OPENAIR_NAS_DIR}/src/emm/msg/emm_msgDef.h
- ${OPENAIR_NAS_DIR}/src/emm/msg/emm_msg.h
- ${OPENAIR_NAS_DIR}/src/emm/msg/EmmStatus.h
- ${OPENAIR_NAS_DIR}/src/emm/msg/ExtendedServiceRequest.h
- ${OPENAIR_NAS_DIR}/src/emm/msg/GutiReallocationCommand.h
- ${OPENAIR_NAS_DIR}/src/emm/msg/GutiReallocationComplete.h
- ${OPENAIR_NAS_DIR}/src/emm/msg/IdentityRequest.h
- ${OPENAIR_NAS_DIR}/src/emm/msg/IdentityResponse.h
- ${OPENAIR_NAS_DIR}/src/emm/msg/NASSecurityModeCommand.h
- ${OPENAIR_NAS_DIR}/src/emm/msg/NASSecurityModeComplete.h
- ${OPENAIR_NAS_DIR}/src/emm/msg/SecurityModeReject.h
- ${OPENAIR_NAS_DIR}/src/emm/msg/ServiceReject.h
- ${OPENAIR_NAS_DIR}/src/emm/msg/ServiceRequest.h
- ${OPENAIR_NAS_DIR}/src/emm/msg/TrackingAreaUpdateAccept.h
- ${OPENAIR_NAS_DIR}/src/emm/msg/TrackingAreaUpdateComplete.h
- ${OPENAIR_NAS_DIR}/src/emm/msg/TrackingAreaUpdateReject.h
- ${OPENAIR_NAS_DIR}/src/emm/msg/TrackingAreaUpdateRequest.h
- ${OPENAIR_NAS_DIR}/src/emm/msg/UplinkNasTransport.h
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/AttachAccept.h
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/AttachComplete.h
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/AttachReject.h
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/AttachRequest.h
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/AuthenticationFailure.h
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/AuthenticationReject.h
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/AuthenticationRequest.h
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/AuthenticationResponse.h
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/CsServiceNotification.h
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/DetachAccept.h
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/DetachRequest.h
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/DownlinkNasTransport.h
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/emm_cause.h
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/EmmInformation.h
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/emm_msgDef.h
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/emm_msg.h
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/EmmStatus.h
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/ExtendedServiceRequest.h
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/GutiReallocationCommand.h
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/GutiReallocationComplete.h
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/IdentityRequest.h
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/IdentityResponse.h
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/NASSecurityModeCommand.h
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/NASSecurityModeComplete.h
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/SecurityModeReject.h
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/ServiceReject.h
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/ServiceRequest.h
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/TrackingAreaUpdateAccept.h
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/TrackingAreaUpdateComplete.h
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/TrackingAreaUpdateReject.h
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/TrackingAreaUpdateRequest.h
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/UplinkNasTransport.h
- ${OPENAIR_NAS_DIR}/src/emm/sap//emm_asDef.h
- ${OPENAIR_NAS_DIR}/src/emm/sap//emm_as.h
- ${OPENAIR_NAS_DIR}/src/emm/sap//emm_cnDef.h
- ${OPENAIR_NAS_DIR}/src/emm/sap//emm_cn.h
- ${OPENAIR_NAS_DIR}/src/emm/sap//emm_esmDef.h
- ${OPENAIR_NAS_DIR}/src/emm/sap//emm_esm.h
- ${OPENAIR_NAS_DIR}/src/emm/sap//emm_fsm.h
- ${OPENAIR_NAS_DIR}/src/emm/sap//emm_recv.h
- ${OPENAIR_NAS_DIR}/src/emm/sap//emm_regDef.h
- ${OPENAIR_NAS_DIR}/src/emm/sap//emm_reg.h
- ${OPENAIR_NAS_DIR}/src/emm/sap//emm_sap.h
- ${OPENAIR_NAS_DIR}/src/emm/sap//emm_send.h
+ ${OPENAIR_NAS_DIR}/UE/EMM/SAP/emm_asDef.h
+ ${OPENAIR_NAS_DIR}/UE/EMM/SAP/emm_as.h
+ ${OPENAIR_NAS_DIR}/UE/EMM/SAP/emm_esmDef.h
+ ${OPENAIR_NAS_DIR}/UE/EMM/SAP/emm_esm.h
+ ${OPENAIR_NAS_DIR}/UE/EMM/SAP/emm_fsm.h
+ ${OPENAIR_NAS_DIR}/UE/EMM/SAP/emm_recv.h
+ ${OPENAIR_NAS_DIR}/UE/EMM/SAP/emm_regDef.h
+ ${OPENAIR_NAS_DIR}/UE/EMM/SAP/emm_reg.h
+ ${OPENAIR_NAS_DIR}/UE/EMM/SAP/emm_sap.h
+ ${OPENAIR_NAS_DIR}/UE/EMM/SAP/emm_send.h
)
@@ -381,12 +381,13 @@ add_library(emm ${emm_SRC} ${emm_HDR})
target_include_directories(emm PRIVATE
${OPENAIR_DIR}/common/utils/msc
- ${OPENAIR_NAS_DIR}/src/api/usim
- ${OPENAIR_NAS_DIR}/src/api/mme
- ${OPENAIR_NAS_DIR}/src/emm
- ${OPENAIR_NAS_DIR}/src/emm/msg
- ${OPENAIR_NAS_DIR}/src/emm/sap
- ${OPENAIR_NAS_DIR}/src/ies
+ ${OPENAIR_DIR}/common/utils
+ ${OPENAIR_DIR}/openair2/COMMON
+ ${OPENAIR_NAS_DIR}/UE/API/USIM
+ ${OPENAIR_NAS_DIR}/UE/EMM
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG
+ ${OPENAIR_NAS_DIR}/UE/EMM/SAP
+ ${OPENAIR_NAS_DIR}/COMMON/IES
)
@@ -394,258 +395,259 @@ target_include_directories(emm PRIVATE
# esm LIB
################################################################################
set(esm_SRC
- ${OPENAIR_NAS_DIR}/src/esm/esm_main.c
- ${OPENAIR_NAS_DIR}/src/esm/DedicatedEpsBearerContextActivation.c
- ${OPENAIR_NAS_DIR}/src/esm/DefaultEpsBearerContextActivation.c
- ${OPENAIR_NAS_DIR}/src/esm/EpsBearerContextDeactivation.c
- ${OPENAIR_NAS_DIR}/src/esm/esm_ebr.c
- ${OPENAIR_NAS_DIR}/src/esm/esm_ebr_context.c
- ${OPENAIR_NAS_DIR}/src/esm/esm_ip.c
- ${OPENAIR_NAS_DIR}/src/esm/esm_main.c
- ${OPENAIR_NAS_DIR}/src/esm/esm_pt.c
- ${OPENAIR_NAS_DIR}/src/esm/EsmStatusHdl.c
- ${OPENAIR_NAS_DIR}/src/esm/PdnConnectivity.c
- ${OPENAIR_NAS_DIR}/src/esm/PdnDisconnect.c
+ ${OPENAIR_NAS_DIR}/UE/ESM/esm_main.c
+ ${OPENAIR_NAS_DIR}/UE/ESM/DedicatedEpsBearerContextActivation.c
+ ${OPENAIR_NAS_DIR}/UE/ESM/DefaultEpsBearerContextActivation.c
+ ${OPENAIR_NAS_DIR}/UE/ESM/EpsBearerContextDeactivation.c
+ ${OPENAIR_NAS_DIR}/UE/ESM/esm_ebr.c
+ ${OPENAIR_NAS_DIR}/UE/ESM/esm_ebr_context.c
+ ${OPENAIR_NAS_DIR}/UE/ESM/esm_ip.c
+ ${OPENAIR_NAS_DIR}/UE/ESM/esm_main.c
+ ${OPENAIR_NAS_DIR}/UE/ESM/esm_pt.c
+ ${OPENAIR_NAS_DIR}/UE/ESM/EsmStatusHdl.c
+ ${OPENAIR_NAS_DIR}/UE/ESM/PdnConnectivity.c
+ ${OPENAIR_NAS_DIR}/UE/ESM/PdnDisconnect.c
- ${OPENAIR_NAS_DIR}/src/esm/msg/ActivateDedicatedEpsBearerContextAccept.c
- ${OPENAIR_NAS_DIR}/src/esm/msg/ActivateDedicatedEpsBearerContextReject.c
- ${OPENAIR_NAS_DIR}/src/esm/msg/ActivateDedicatedEpsBearerContextRequest.c
- ${OPENAIR_NAS_DIR}/src/esm/msg/ActivateDefaultEpsBearerContextAccept.c
- ${OPENAIR_NAS_DIR}/src/esm/msg/ActivateDefaultEpsBearerContextReject.c
- ${OPENAIR_NAS_DIR}/src/esm/msg/ActivateDefaultEpsBearerContextRequest.c
- ${OPENAIR_NAS_DIR}/src/esm/msg/BearerResourceAllocationReject.c
- ${OPENAIR_NAS_DIR}/src/esm/msg/BearerResourceAllocationRequest.c
- ${OPENAIR_NAS_DIR}/src/esm/msg/BearerResourceModificationReject.c
- ${OPENAIR_NAS_DIR}/src/esm/msg/BearerResourceModificationRequest.c
- ${OPENAIR_NAS_DIR}/src/esm/msg/DeactivateEpsBearerContextAccept.c
- ${OPENAIR_NAS_DIR}/src/esm/msg/DeactivateEpsBearerContextRequest.c
- ${OPENAIR_NAS_DIR}/src/esm/msg/EsmInformationRequest.c
- ${OPENAIR_NAS_DIR}/src/esm/msg/EsmInformationResponse.c
- ${OPENAIR_NAS_DIR}/src/esm/msg/esm_msg.c
- ${OPENAIR_NAS_DIR}/src/esm/msg/EsmStatus.c
- ${OPENAIR_NAS_DIR}/src/esm/msg/ModifyEpsBearerContextAccept.c
- ${OPENAIR_NAS_DIR}/src/esm/msg/ModifyEpsBearerContextReject.c
- ${OPENAIR_NAS_DIR}/src/esm/msg/ModifyEpsBearerContextRequest.c
- ${OPENAIR_NAS_DIR}/src/esm/msg/PdnConnectivityReject.c
- ${OPENAIR_NAS_DIR}/src/esm/msg/PdnConnectivityRequest.c
- ${OPENAIR_NAS_DIR}/src/esm/msg/PdnDisconnectReject.c
- ${OPENAIR_NAS_DIR}/src/esm/msg/PdnDisconnectRequest.c
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextAccept.c
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextReject.c
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextRequest.c
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextAccept.c
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextReject.c
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextRequest.c
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/BearerResourceAllocationReject.c
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/BearerResourceAllocationRequest.c
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/BearerResourceModificationReject.c
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/BearerResourceModificationRequest.c
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/DeactivateEpsBearerContextAccept.c
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/DeactivateEpsBearerContextRequest.c
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/EsmInformationRequest.c
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/EsmInformationResponse.c
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/esm_msg.c
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/EsmStatus.c
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/ModifyEpsBearerContextAccept.c
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/ModifyEpsBearerContextReject.c
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/ModifyEpsBearerContextRequest.c
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/PdnConnectivityReject.c
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/PdnConnectivityRequest.c
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/PdnDisconnectReject.c
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/PdnDisconnectRequest.c
- ${OPENAIR_NAS_DIR}/src/esm/sap/esm_recv.c
- ${OPENAIR_NAS_DIR}/src/esm/sap/esm_sap.c
- ${OPENAIR_NAS_DIR}/src/esm/sap/esm_send.c
+ ${OPENAIR_NAS_DIR}/UE/ESM/SAP/esm_recv.c
+ ${OPENAIR_NAS_DIR}/UE/ESM/SAP/esm_sap.c
+ ${OPENAIR_NAS_DIR}/UE/ESM/SAP/esm_send.c
)
set(esm_HDR
- ${OPENAIR_NAS_DIR}/src/esm/esm_main.h
- ${OPENAIR_NAS_DIR}/src/esm/msg/ActivateDedicatedEpsBearerContextAccept.h
- ${OPENAIR_NAS_DIR}/src/esm/msg/ActivateDedicatedEpsBearerContextReject.h
- ${OPENAIR_NAS_DIR}/src/esm/msg/ActivateDedicatedEpsBearerContextRequest.h
- ${OPENAIR_NAS_DIR}/src/esm/msg/ActivateDefaultEpsBearerContextAccept.h
- ${OPENAIR_NAS_DIR}/src/esm/msg/ActivateDefaultEpsBearerContextReject.h
- ${OPENAIR_NAS_DIR}/src/esm/msg/ActivateDefaultEpsBearerContextRequest.h
- ${OPENAIR_NAS_DIR}/src/esm/msg/BearerResourceAllocationReject.h
- ${OPENAIR_NAS_DIR}/src/esm/msg/BearerResourceAllocationRequest.h
- ${OPENAIR_NAS_DIR}/src/esm/msg/BearerResourceModificationReject.h
- ${OPENAIR_NAS_DIR}/src/esm/msg/BearerResourceModificationRequest.h
- ${OPENAIR_NAS_DIR}/src/esm/msg/DeactivateEpsBearerContextAccept.h
- ${OPENAIR_NAS_DIR}/src/esm/msg/DeactivateEpsBearerContextRequest.h
- ${OPENAIR_NAS_DIR}/src/esm/msg/esm_cause.h
- ${OPENAIR_NAS_DIR}/src/esm/msg/EsmInformationRequest.h
- ${OPENAIR_NAS_DIR}/src/esm/msg/EsmInformationResponse.h
- ${OPENAIR_NAS_DIR}/src/esm/msg/esm_msgDef.h
- ${OPENAIR_NAS_DIR}/src/esm/msg/esm_msg.h
- ${OPENAIR_NAS_DIR}/src/esm/msg/EsmStatus.h
- ${OPENAIR_NAS_DIR}/src/esm/msg/ModifyEpsBearerContextAccept.h
- ${OPENAIR_NAS_DIR}/src/esm/msg/ModifyEpsBearerContextReject.h
- ${OPENAIR_NAS_DIR}/src/esm/msg/ModifyEpsBearerContextRequest.h
- ${OPENAIR_NAS_DIR}/src/esm/msg/PdnConnectivityReject.h
- ${OPENAIR_NAS_DIR}/src/esm/msg/PdnConnectivityRequest.h
- ${OPENAIR_NAS_DIR}/src/esm/msg/PdnDisconnectReject.h
- ${OPENAIR_NAS_DIR}/src/esm/msg/PdnDisconnectRequest.h
- ${OPENAIR_NAS_DIR}/src/esm/sap/esm_recv.h
- ${OPENAIR_NAS_DIR}/src/esm/sap/esm_sap.h
- ${OPENAIR_NAS_DIR}/src/esm/sap/esm_send.h
+ ${OPENAIR_NAS_DIR}/UE/ESM/esm_main.h
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextAccept.h
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextReject.h
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextRequest.h
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextAccept.h
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextReject.h
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextRequest.h
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/BearerResourceAllocationReject.h
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/BearerResourceAllocationRequest.h
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/BearerResourceModificationReject.h
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/BearerResourceModificationRequest.h
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/DeactivateEpsBearerContextAccept.h
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/DeactivateEpsBearerContextRequest.h
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/esm_cause.h
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/EsmInformationRequest.h
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/EsmInformationResponse.h
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/esm_msgDef.h
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/esm_msg.h
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/EsmStatus.h
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/ModifyEpsBearerContextAccept.h
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/ModifyEpsBearerContextReject.h
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/ModifyEpsBearerContextRequest.h
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/PdnConnectivityReject.h
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/PdnConnectivityRequest.h
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/PdnDisconnectReject.h
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/PdnDisconnectRequest.h
+ ${OPENAIR_NAS_DIR}/UE/ESM/SAP/esm_recv.h
+ ${OPENAIR_NAS_DIR}/UE/ESM/SAP/esm_sap.h
+ ${OPENAIR_NAS_DIR}/UE/ESM/SAP/esm_send.h
)
add_library(esm ${esm_SRC} ${esm_HDR})
target_include_directories(esm PRIVATE
- ${OPENAIR_NAS_DIR}/src/api/user
- ${OPENAIR_NAS_DIR}/src/api/mme
- ${OPENAIR_NAS_DIR}/src/esm
- ${OPENAIR_NAS_DIR}/src/esm/msg
- ${OPENAIR_NAS_DIR}/src/esm/sap
- ${OPENAIR_NAS_DIR}/src/ies
+ ${OPENAIR_NAS_DIR}/UE/API/USER
+ ${OPENAIR_NAS_DIR}/UE/ESM
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG
+ ${OPENAIR_NAS_DIR}/UE/ESM/SAP
+ ${OPENAIR_NAS_DIR}/COMMON/IES
)
################################################################################
# ies LIB
################################################################################
set(ies_SRC
- ${OPENAIR_NAS_DIR}/src/ies/AccessPointName.c
- ${OPENAIR_NAS_DIR}/src/ies/AdditionalUpdateResult.c
- ${OPENAIR_NAS_DIR}/src/ies/AdditionalUpdateType.c
- ${OPENAIR_NAS_DIR}/src/ies/ApnAggregateMaximumBitRate.c
- ${OPENAIR_NAS_DIR}/src/ies/AuthenticationFailureParameter.c
- ${OPENAIR_NAS_DIR}/src/ies/AuthenticationParameterAutn.c
- ${OPENAIR_NAS_DIR}/src/ies/AuthenticationParameterRand.c
- ${OPENAIR_NAS_DIR}/src/ies/AuthenticationResponseParameter.c
- ${OPENAIR_NAS_DIR}/src/ies/CipheringKeySequenceNumber.c
- ${OPENAIR_NAS_DIR}/src/ies/Cli.c
- ${OPENAIR_NAS_DIR}/src/ies/CsfbResponse.c
- ${OPENAIR_NAS_DIR}/src/ies/DaylightSavingTime.c
- ${OPENAIR_NAS_DIR}/src/ies/DetachType.c
- ${OPENAIR_NAS_DIR}/src/ies/DrxParameter.c
- ${OPENAIR_NAS_DIR}/src/ies/EmergencyNumberList.c
- ${OPENAIR_NAS_DIR}/src/ies/EmmCause.c
- ${OPENAIR_NAS_DIR}/src/ies/EpsAttachResult.c
- ${OPENAIR_NAS_DIR}/src/ies/EpsAttachType.c
- ${OPENAIR_NAS_DIR}/src/ies/EpsBearerContextStatus.c
- ${OPENAIR_NAS_DIR}/src/ies/EpsBearerIdentity.c
- ${OPENAIR_NAS_DIR}/src/ies/EpsMobileIdentity.c
- ${OPENAIR_NAS_DIR}/src/ies/EpsNetworkFeatureSupport.c
- ${OPENAIR_NAS_DIR}/src/ies/EpsQualityOfService.c
- ${OPENAIR_NAS_DIR}/src/ies/EpsUpdateResult.c
- ${OPENAIR_NAS_DIR}/src/ies/EpsUpdateType.c
- ${OPENAIR_NAS_DIR}/src/ies/EsmCause.c
- ${OPENAIR_NAS_DIR}/src/ies/EsmInformationTransferFlag.c
- ${OPENAIR_NAS_DIR}/src/ies/EsmMessageContainer.c
- ${OPENAIR_NAS_DIR}/src/ies/GprsTimer.c
- ${OPENAIR_NAS_DIR}/src/ies/GutiType.c
- ${OPENAIR_NAS_DIR}/src/ies/IdentityType2.c
- ${OPENAIR_NAS_DIR}/src/ies/ImeisvRequest.c
- ${OPENAIR_NAS_DIR}/src/ies/KsiAndSequenceNumber.c
- ${OPENAIR_NAS_DIR}/src/ies/LcsClientIdentity.c
- ${OPENAIR_NAS_DIR}/src/ies/LcsIndicator.c
- ${OPENAIR_NAS_DIR}/src/ies/LinkedEpsBearerIdentity.c
- ${OPENAIR_NAS_DIR}/src/ies/LlcServiceAccessPointIdentifier.c
- ${OPENAIR_NAS_DIR}/src/ies/LocationAreaIdentification.c
- ${OPENAIR_NAS_DIR}/src/ies/MessageType.c
- ${OPENAIR_NAS_DIR}/src/ies/MobileIdentity.c
- ${OPENAIR_NAS_DIR}/src/ies/MobileStationClassmark2.c
- ${OPENAIR_NAS_DIR}/src/ies/MobileStationClassmark3.c
- ${OPENAIR_NAS_DIR}/src/ies/MsNetworkCapability.c
- ${OPENAIR_NAS_DIR}/src/ies/NasKeySetIdentifier.c
- ${OPENAIR_NAS_DIR}/src/ies/NasMessageContainer.c
- ${OPENAIR_NAS_DIR}/src/ies/NasRequestType.c
- ${OPENAIR_NAS_DIR}/src/ies/NasSecurityAlgorithms.c
- ${OPENAIR_NAS_DIR}/src/ies/NetworkName.c
- ${OPENAIR_NAS_DIR}/src/ies/Nonce.c
- ${OPENAIR_NAS_DIR}/src/ies/PacketFlowIdentifier.c
- ${OPENAIR_NAS_DIR}/src/ies/PagingIdentity.c
- ${OPENAIR_NAS_DIR}/src/ies/PdnAddress.c
- ${OPENAIR_NAS_DIR}/src/ies/PdnType.c
- ${OPENAIR_NAS_DIR}/src/ies/PlmnList.c
- ${OPENAIR_NAS_DIR}/src/ies/ProcedureTransactionIdentity.c
- ${OPENAIR_NAS_DIR}/src/ies/ProtocolConfigurationOptions.c
- ${OPENAIR_NAS_DIR}/src/ies/ProtocolDiscriminator.c
- ${OPENAIR_NAS_DIR}/src/ies/PTmsiSignature.c
- ${OPENAIR_NAS_DIR}/src/ies/QualityOfService.c
- ${OPENAIR_NAS_DIR}/src/ies/RadioPriority.c
- ${OPENAIR_NAS_DIR}/src/ies/SecurityHeaderType.c
- ${OPENAIR_NAS_DIR}/src/ies/ServiceType.c
- ${OPENAIR_NAS_DIR}/src/ies/ShortMac.c
- ${OPENAIR_NAS_DIR}/src/ies/SsCode.c
- ${OPENAIR_NAS_DIR}/src/ies/SupportedCodecList.c
- ${OPENAIR_NAS_DIR}/src/ies/TimeZoneAndTime.c
- ${OPENAIR_NAS_DIR}/src/ies/TimeZone.c
- ${OPENAIR_NAS_DIR}/src/ies/TmsiStatus.c
- ${OPENAIR_NAS_DIR}/src/ies/TrackingAreaIdentity.c
- ${OPENAIR_NAS_DIR}/src/ies/TrackingAreaIdentityList.c
- ${OPENAIR_NAS_DIR}/src/ies/TrafficFlowAggregateDescription.c
- ${OPENAIR_NAS_DIR}/src/ies/TrafficFlowTemplate.c
- ${OPENAIR_NAS_DIR}/src/ies/TransactionIdentifier.c
- ${OPENAIR_NAS_DIR}/src/ies/UeNetworkCapability.c
- ${OPENAIR_NAS_DIR}/src/ies/UeRadioCapabilityInformationUpdateNeeded.c
- ${OPENAIR_NAS_DIR}/src/ies/UeSecurityCapability.c
- ${OPENAIR_NAS_DIR}/src/ies/VoiceDomainPreferenceAndUeUsageSetting.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/AccessPointName.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/AdditionalUpdateResult.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/AdditionalUpdateType.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/ApnAggregateMaximumBitRate.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/AuthenticationFailureParameter.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/AuthenticationParameterAutn.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/AuthenticationParameterRand.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/AuthenticationResponseParameter.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/CipheringKeySequenceNumber.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/Cli.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/CsfbResponse.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/DaylightSavingTime.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/DetachType.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/DrxParameter.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/EmergencyNumberList.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/EmmCause.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/EpsAttachResult.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/EpsAttachType.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/EpsBearerContextStatus.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/EpsBearerIdentity.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/EpsMobileIdentity.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/EpsNetworkFeatureSupport.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/EpsQualityOfService.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/EpsUpdateResult.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/EpsUpdateType.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/EsmCause.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/EsmInformationTransferFlag.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/EsmMessageContainer.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/GprsTimer.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/GutiType.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/IdentityType2.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/ImeisvRequest.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/KsiAndSequenceNumber.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/LcsClientIdentity.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/LcsIndicator.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/LinkedEpsBearerIdentity.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/LlcServiceAccessPointIdentifier.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/LocationAreaIdentification.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/MessageType.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/MobileIdentity.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/MobileStationClassmark2.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/MobileStationClassmark3.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/MsNetworkCapability.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/MsNetworkFeatureSupport.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/NasKeySetIdentifier.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/NasMessageContainer.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/NasRequestType.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/NasSecurityAlgorithms.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/NetworkName.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/Nonce.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/PacketFlowIdentifier.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/PagingIdentity.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/PdnAddress.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/PdnType.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/PlmnList.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/ProcedureTransactionIdentity.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/ProtocolConfigurationOptions.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/ProtocolDiscriminator.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/PTmsiSignature.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/QualityOfService.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/RadioPriority.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/SecurityHeaderType.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/ServiceType.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/ShortMac.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/SsCode.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/SupportedCodecList.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/TimeZoneAndTime.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/TimeZone.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/TmsiStatus.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/TrackingAreaIdentity.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/TrackingAreaIdentityList.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/TrafficFlowAggregateDescription.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/TrafficFlowTemplate.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/TransactionIdentifier.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/UeNetworkCapability.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/UeRadioCapabilityInformationUpdateNeeded.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/UeSecurityCapability.c
+ ${OPENAIR_NAS_DIR}/COMMON/IES/VoiceDomainPreferenceAndUeUsageSetting.c
)
set(ies_HDR
- ${OPENAIR_NAS_DIR}/src/ies/AccessPointName.h
- ${OPENAIR_NAS_DIR}/src/ies/AdditionalUpdateResult.h
- ${OPENAIR_NAS_DIR}/src/ies/AdditionalUpdateType.h
- ${OPENAIR_NAS_DIR}/src/ies/ApnAggregateMaximumBitRate.h
- ${OPENAIR_NAS_DIR}/src/ies/AuthenticationFailureParameter.h
- ${OPENAIR_NAS_DIR}/src/ies/AuthenticationParameterAutn.h
- ${OPENAIR_NAS_DIR}/src/ies/AuthenticationParameterRand.h
- ${OPENAIR_NAS_DIR}/src/ies/AuthenticationResponseParameter.h
- ${OPENAIR_NAS_DIR}/src/ies/CipheringKeySequenceNumber.h
- ${OPENAIR_NAS_DIR}/src/ies/Cli.h
- ${OPENAIR_NAS_DIR}/src/ies/CsfbResponse.h
- ${OPENAIR_NAS_DIR}/src/ies/DaylightSavingTime.h
- ${OPENAIR_NAS_DIR}/src/ies/DetachType.h
- ${OPENAIR_NAS_DIR}/src/ies/DrxParameter.h
- ${OPENAIR_NAS_DIR}/src/ies/EmergencyNumberList.h
- ${OPENAIR_NAS_DIR}/src/ies/EmmCause.h
- ${OPENAIR_NAS_DIR}/src/ies/EpsAttachResult.h
- ${OPENAIR_NAS_DIR}/src/ies/EpsAttachType.h
- ${OPENAIR_NAS_DIR}/src/ies/EpsBearerContextStatus.h
- ${OPENAIR_NAS_DIR}/src/ies/EpsBearerIdentity.h
- ${OPENAIR_NAS_DIR}/src/ies/EpsMobileIdentity.h
- ${OPENAIR_NAS_DIR}/src/ies/EpsNetworkFeatureSupport.h
- ${OPENAIR_NAS_DIR}/src/ies/EpsQualityOfService.h
- ${OPENAIR_NAS_DIR}/src/ies/EpsUpdateResult.h
- ${OPENAIR_NAS_DIR}/src/ies/EpsUpdateType.h
- ${OPENAIR_NAS_DIR}/src/ies/EsmCause.h
- ${OPENAIR_NAS_DIR}/src/ies/EsmInformationTransferFlag.h
- ${OPENAIR_NAS_DIR}/src/ies/EsmMessageContainer.h
- ${OPENAIR_NAS_DIR}/src/ies/GprsTimer.h
- ${OPENAIR_NAS_DIR}/src/ies/GutiType.h
- ${OPENAIR_NAS_DIR}/src/ies/IdentityType2.h
- ${OPENAIR_NAS_DIR}/src/ies/ImeisvRequest.h
- ${OPENAIR_NAS_DIR}/src/ies/KsiAndSequenceNumber.h
- ${OPENAIR_NAS_DIR}/src/ies/LcsClientIdentity.h
- ${OPENAIR_NAS_DIR}/src/ies/LcsIndicator.h
- ${OPENAIR_NAS_DIR}/src/ies/LinkedEpsBearerIdentity.h
- ${OPENAIR_NAS_DIR}/src/ies/LlcServiceAccessPointIdentifier.h
- ${OPENAIR_NAS_DIR}/src/ies/LocationAreaIdentification.h
- ${OPENAIR_NAS_DIR}/src/ies/MessageType.h
- ${OPENAIR_NAS_DIR}/src/ies/MobileIdentity.h
- ${OPENAIR_NAS_DIR}/src/ies/MobileStationClassmark2.h
- ${OPENAIR_NAS_DIR}/src/ies/MobileStationClassmark3.h
- ${OPENAIR_NAS_DIR}/src/ies/MsNetworkCapability.h
- ${OPENAIR_NAS_DIR}/src/ies/NasKeySetIdentifier.h
- ${OPENAIR_NAS_DIR}/src/ies/NasMessageContainer.h
- ${OPENAIR_NAS_DIR}/src/ies/NasRequestType.h
- ${OPENAIR_NAS_DIR}/src/ies/NasSecurityAlgorithms.h
- ${OPENAIR_NAS_DIR}/src/ies/NetworkName.h
- ${OPENAIR_NAS_DIR}/src/ies/Nonce.h
- ${OPENAIR_NAS_DIR}/src/ies/PacketFlowIdentifier.h
- ${OPENAIR_NAS_DIR}/src/ies/PagingIdentity.h
- ${OPENAIR_NAS_DIR}/src/ies/PdnAddress.h
- ${OPENAIR_NAS_DIR}/src/ies/PdnType.h
- ${OPENAIR_NAS_DIR}/src/ies/PlmnList.h
- ${OPENAIR_NAS_DIR}/src/ies/ProcedureTransactionIdentity.h
- ${OPENAIR_NAS_DIR}/src/ies/ProtocolConfigurationOptions.h
- ${OPENAIR_NAS_DIR}/src/ies/ProtocolDiscriminator.h
- ${OPENAIR_NAS_DIR}/src/ies/PTmsiSignature.h
- ${OPENAIR_NAS_DIR}/src/ies/QualityOfService.h
- ${OPENAIR_NAS_DIR}/src/ies/RadioPriority.h
- ${OPENAIR_NAS_DIR}/src/ies/SecurityHeaderType.h
- ${OPENAIR_NAS_DIR}/src/ies/ServiceType.h
- ${OPENAIR_NAS_DIR}/src/ies/ShortMac.h
- ${OPENAIR_NAS_DIR}/src/ies/SsCode.h
- ${OPENAIR_NAS_DIR}/src/ies/SupportedCodecList.h
- ${OPENAIR_NAS_DIR}/src/ies/TimeZoneAndTime.h
- ${OPENAIR_NAS_DIR}/src/ies/TimeZone.h
- ${OPENAIR_NAS_DIR}/src/ies/TmsiStatus.h
- ${OPENAIR_NAS_DIR}/src/ies/TrackingAreaIdentity.h
- ${OPENAIR_NAS_DIR}/src/ies/TrackingAreaIdentityList.h
- ${OPENAIR_NAS_DIR}/src/ies/TrafficFlowAggregateDescription.h
- ${OPENAIR_NAS_DIR}/src/ies/TrafficFlowTemplate.h
- ${OPENAIR_NAS_DIR}/src/ies/TransactionIdentifier.h
- ${OPENAIR_NAS_DIR}/src/ies/UeNetworkCapability.h
- ${OPENAIR_NAS_DIR}/src/ies/UeRadioCapabilityInformationUpdateNeeded.h
- ${OPENAIR_NAS_DIR}/src/ies/UeSecurityCapability.h
- ${OPENAIR_NAS_DIR}/src/ies/VoiceDomainPreferenceAndUeUsageSetting.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/AccessPointName.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/AdditionalUpdateResult.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/AdditionalUpdateType.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/ApnAggregateMaximumBitRate.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/AuthenticationFailureParameter.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/AuthenticationParameterAutn.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/AuthenticationParameterRand.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/AuthenticationResponseParameter.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/CipheringKeySequenceNumber.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/Cli.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/CsfbResponse.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/DaylightSavingTime.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/DetachType.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/DrxParameter.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/EmergencyNumberList.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/EmmCause.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/EpsAttachResult.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/EpsAttachType.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/EpsBearerContextStatus.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/EpsBearerIdentity.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/EpsMobileIdentity.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/EpsNetworkFeatureSupport.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/EpsQualityOfService.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/EpsUpdateResult.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/EpsUpdateType.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/EsmCause.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/EsmInformationTransferFlag.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/EsmMessageContainer.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/GprsTimer.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/GutiType.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/IdentityType2.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/ImeisvRequest.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/KsiAndSequenceNumber.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/LcsClientIdentity.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/LcsIndicator.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/LinkedEpsBearerIdentity.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/LlcServiceAccessPointIdentifier.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/LocationAreaIdentification.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/MessageType.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/MobileIdentity.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/MobileStationClassmark2.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/MobileStationClassmark3.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/MsNetworkCapability.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/MsNetworkFeatureSupport.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/NasKeySetIdentifier.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/NasMessageContainer.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/NasRequestType.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/NasSecurityAlgorithms.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/NetworkName.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/Nonce.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/PacketFlowIdentifier.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/PagingIdentity.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/PdnAddress.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/PdnType.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/PlmnList.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/ProcedureTransactionIdentity.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/ProtocolConfigurationOptions.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/ProtocolDiscriminator.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/PTmsiSignature.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/QualityOfService.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/RadioPriority.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/SecurityHeaderType.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/ServiceType.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/ShortMac.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/SsCode.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/SupportedCodecList.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/TimeZoneAndTime.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/TimeZone.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/TmsiStatus.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/TrackingAreaIdentity.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/TrackingAreaIdentityList.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/TrafficFlowAggregateDescription.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/TrafficFlowTemplate.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/TransactionIdentifier.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/UeNetworkCapability.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/UeRadioCapabilityInformationUpdateNeeded.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/UeSecurityCapability.h
+ ${OPENAIR_NAS_DIR}/COMMON/IES/VoiceDomainPreferenceAndUeUsageSetting.h
)
add_library(ies ${ies_SRC} ${ies_HDR})
target_include_directories(ies PRIVATE
- ${OPENAIR_NAS_DIR}/src/ies
+ ${OPENAIR_NAS_DIR}/COMMON/IES
)
@@ -658,23 +660,23 @@ include_directories(
${OPENAIRCN_DIR}/COMMON
${OPENAIRCN_DIR}/SECU
${OPENAIR_NAS_DIR}/src
- ${OPENAIR_NAS_DIR}/src/api/network
- ${OPENAIR_NAS_DIR}/src/api/user
- ${OPENAIR_NAS_DIR}/src/emm
- ${OPENAIR_NAS_DIR}/src/emm/msg
- ${OPENAIR_NAS_DIR}/src/emm/sap
- ${OPENAIR_NAS_DIR}/src/esm
- ${OPENAIR_NAS_DIR}/src/esm/sap
- ${OPENAIR_NAS_DIR}/src/esm/msg
- ${OPENAIR_NAS_DIR}/src/ies
- ${OPENAIR_NAS_DIR}/src/include
- ${OPENAIR_NAS_DIR}/src/util )
+ ${OPENAIR_NAS_DIR}/COMMON
+ ${OPENAIR_NAS_DIR}/COMMON/API/NETWORK
+ ${OPENAIR_NAS_DIR}/UE/API/USER
+ ${OPENAIR_NAS_DIR}/UE/EMM
+ ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG
+ ${OPENAIR_NAS_DIR}/UE/EMM/SAP
+ ${OPENAIR_NAS_DIR}/UE/ESM
+ ${OPENAIR_NAS_DIR}/UE/ESM/SAP
+ ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG
+ ${OPENAIR_NAS_DIR}/COMMON/IES
+ ${OPENAIR_NAS_DIR}/COMMON/UTIL )
-ADD_EXECUTABLE(at_nas_ue ${OPENAIR_NAS_DIR}/src/UEprocess.c
- ${OPENAIR_NAS_DIR}/src/nas_network.c
- ${OPENAIR_NAS_DIR}/src/nas_parser.c
- ${OPENAIR_NAS_DIR}/src/nas_proc.c
- ${OPENAIR_NAS_DIR}/src/nas_user.c
+ADD_EXECUTABLE(at_nas_ue ${OPENAIR_NAS_DIR}/UE/UEprocess.c
+ ${OPENAIR_NAS_DIR}/UE/nas_network.c
+ ${OPENAIR_NAS_DIR}/UE/nas_parser.c
+ ${OPENAIR_NAS_DIR}/UE/nas_proc.c
+ ${OPENAIR_NAS_DIR}/UE/nas_user.c
)
target_link_libraries (at_nas_ue
diff --git a/cmake_targets/autotests/0200/CMakeLists.template b/cmake_targets/autotests/0200/CMakeLists.template
new file mode 100644
index 0000000000..1ccd57fffd
--- /dev/null
+++ b/cmake_targets/autotests/0200/CMakeLists.template
@@ -0,0 +1,82 @@
+cmake_minimum_required(VERSION 2.8)
+
+set ( CMAKE_BUILD_TYPE "RelWithDebInfo" )
+set ( ADDR_CONF False )
+set ( DEBUG_OMG False )
+set ( DISABLE_XER_PRINT False )
+set ( DRIVER2013 True )
+set ( EMOS False )
+set ( ENABLE_FXP True )
+set ( ENABLE_ITTI True )
+set ( ENABLE_NAS_UE_LOGGING False )
+set ( ENABLE_NEW_MULTICAST True )
+set ( ENABLE_PGM_TRANSPORT True )
+set ( ENABLE_RAL False )
+set ( ENABLE_SECURITY False )
+set ( ENABLE_STANDALONE_EPC False)
+set ( ENABLE_USE_CPU_EXECUTION_TIME True )
+set ( ENABLE_USE_MME False )
+set ( ENABLE_USE_RAW_SOCKET_FOR_SGI False)
+set ( ENABLE_VCD_FIFO False )
+set ( ENB_MODE True )
+set ( EXMIMO_IOT True )
+set ( HARD_RT False )
+set ( JUMBO_FRAME True )
+set ( LARGE_SCALE False )
+set ( LINK_ENB_PDCP_TO_GTPV1U False)
+set ( LINUX_LIST False )
+set ( LINUX True )
+set ( LOCALIZATION False )
+set ( LOG_NO_THREAD 1 )
+set ( LOWLATENCY False )
+set ( MAC_CONTEXT 1 )
+set ( MAX_NUM_CCs 1 )
+set ( MESSAGE_CHART_GENERATOR False )
+set ( MESSAGE_CHART_GENERATOR_RLC_MAC False )
+set ( MESSAGE_CHART_GENERATOR_PHY False )
+set ( MIH_C_MEDIEVAL_EXTENSIONS False )
+set ( MSG_PRINT False )
+set ( MU_RECEIVER False )
+set ( NAS_ADDRESS_FIX True )
+set ( NAS_BUILT_IN_UE False)
+set ( NAS_MME False )
+set ( NAS_UE False )
+set ( NB_ANTENNAS_RX "2" )
+set ( NB_ANTENNAS_TX "2" )
+set ( NB_ANTENNAS_TXRX "2" )
+set ( NEW_FFT True )
+set ( NO_RRM True )
+set ( OAI_EMU True )
+set ( OAISIM True )
+set ( OAI_NW_DRIVER_TYPE_ETHERNET True )
+set ( OAI_NW_DRIVER_USE_NETLINK True )
+set ( OPENAIR1 True )
+set ( OPENAIR2 True )
+set ( OPENAIR_EMU False )
+set ( OPENAIR_LTE True )
+set ( PACKAGE_NAME "oaisim" )
+set ( PBS_SIM False )
+set ( PDCP_USE_NETLINK True )
+set ( PC_DSP True )
+set ( PC_TARGET True )
+set ( PDCP_MSG_PRINT False )
+set ( PERFECT_CE False )
+set ( PHY_ABSTRACTION True )
+set ( PHY_CONTEXT False )
+set ( PHY_EMUL False )
+set ( PHYSIM True )
+set ( PUCCH True )
+set ( RANDOM_BF False )
+set ( RF_BOARD "False" )
+set ( RRC_ASN1_VERSION "Rel10" )
+set ( RLC_STOP_ON_LOST_PDU False )
+set ( RRC_MSG_PRINT False )
+set ( RTAI False )
+set ( SECU False )
+set ( SMBV False )
+set ( SPECTRA False )
+set ( TEST_OMG False )
+set ( USE_3GPP_ADDR_AS_LINK_ADDR False )
+set ( USE_MME "R10" )
+set ( USER_MODE True )
+set ( XER_PRINT False )
diff --git a/cmake_targets/autotests/0200/CMakeLists.txt b/cmake_targets/autotests/0200/CMakeLists.txt
new file mode 100644
index 0000000000..e6c4bdfe47
--- /dev/null
+++ b/cmake_targets/autotests/0200/CMakeLists.txt
@@ -0,0 +1,87 @@
+cmake_minimum_required(VERSION 2.8)
+
+set ( CMAKE_BUILD_TYPE "RelWithDebInfo" )
+set ( ADDR_CONF False )
+set ( DEBUG_OMG False )
+set ( DISABLE_XER_PRINT False )
+set ( DRIVER2013 True )
+set ( EMOS False )
+set ( ENABLE_FXP True )
+set ( ENABLE_ITTI True )
+set ( ENABLE_NAS_UE_LOGGING False )
+set ( ENABLE_NEW_MULTICAST True )
+set ( ENABLE_PGM_TRANSPORT True )
+set ( ENABLE_RAL False )
+set ( ENABLE_SECURITY False )
+set ( ENABLE_STANDALONE_EPC False)
+set ( ENABLE_USE_CPU_EXECUTION_TIME True )
+set ( ENABLE_USE_MME False )
+set ( ENABLE_USE_RAW_SOCKET_FOR_SGI False)
+set ( ENABLE_VCD_FIFO False )
+set ( ENB_MODE True )
+set ( EXMIMO_IOT True )
+set ( HARD_RT False )
+set ( JUMBO_FRAME True )
+set ( LARGE_SCALE False )
+set ( LINK_ENB_PDCP_TO_GTPV1U False)
+set ( LINUX_LIST False )
+set ( LINUX True )
+set ( LOCALIZATION False )
+set ( LOG_NO_THREAD 1 )
+set ( LOWLATENCY False )
+set ( MAC_CONTEXT 1 )
+set ( MAX_NUM_CCs 1 )
+set ( MESSAGE_CHART_GENERATOR False )
+set ( MESSAGE_CHART_GENERATOR_RLC_MAC False )
+set ( MESSAGE_CHART_GENERATOR_PHY False )
+set ( MIH_C_MEDIEVAL_EXTENSIONS False )
+set ( MSG_PRINT False )
+set ( MU_RECEIVER False )
+set ( NAS_ADDRESS_FIX True )
+set ( NAS_BUILT_IN_UE False)
+set ( NAS_MME False )
+set ( NAS_UE False )
+set ( NB_ANTENNAS_RX "2" )
+set ( NB_ANTENNAS_TX "2" )
+set ( NB_ANTENNAS_TXRX "2" )
+set ( NEW_FFT True )
+set ( NO_RRM True )
+set ( OAI_EMU True )
+set ( OAISIM True )
+set ( OAI_NW_DRIVER_TYPE_ETHERNET True )
+set ( OAI_NW_DRIVER_USE_NETLINK True )
+set ( OPENAIR1 True )
+set ( OPENAIR2 True )
+set ( OPENAIR_EMU False )
+set ( OPENAIR_LTE True )
+set ( PACKAGE_NAME "oaisim" )
+set ( PBS_SIM False )
+set ( PDCP_USE_NETLINK True )
+set ( PC_DSP True )
+set ( PC_TARGET True )
+set ( PDCP_MSG_PRINT False )
+set ( PERFECT_CE False )
+set ( PHY_ABSTRACTION True )
+set ( PHY_CONTEXT False )
+set ( PHY_EMUL False )
+set ( PHYSIM True )
+set ( PUCCH True )
+set ( RANDOM_BF False )
+set ( RF_BOARD "False" )
+set ( RRC_ASN1_VERSION "Rel10" )
+set ( RLC_STOP_ON_LOST_PDU False )
+set ( RRC_MSG_PRINT False )
+set ( RTAI False )
+set ( SECU False )
+set ( SMBV False )
+set ( SPECTRA False )
+set ( TEST_OMG False )
+set ( USE_3GPP_ADDR_AS_LINK_ADDR False )
+set ( USE_MME "R10" )
+set ( USER_MODE True )
+set ( XER_PRINT False )
+set ( XFORMS False )
+set ( PRINT_STATS False )
+set ( RRC_ASN1_VERSION "Rel10")
+set ( ENABLE_VCD_FIFO False )
+include(${CMAKE_CURRENT_SOURCE_DIR}/../../CMakeLists.txt)
diff --git a/cmake_targets/autotests/0201/CMakeLists.template b/cmake_targets/autotests/0201/CMakeLists.template
new file mode 100644
index 0000000000..1ccd57fffd
--- /dev/null
+++ b/cmake_targets/autotests/0201/CMakeLists.template
@@ -0,0 +1,82 @@
+cmake_minimum_required(VERSION 2.8)
+
+set ( CMAKE_BUILD_TYPE "RelWithDebInfo" )
+set ( ADDR_CONF False )
+set ( DEBUG_OMG False )
+set ( DISABLE_XER_PRINT False )
+set ( DRIVER2013 True )
+set ( EMOS False )
+set ( ENABLE_FXP True )
+set ( ENABLE_ITTI True )
+set ( ENABLE_NAS_UE_LOGGING False )
+set ( ENABLE_NEW_MULTICAST True )
+set ( ENABLE_PGM_TRANSPORT True )
+set ( ENABLE_RAL False )
+set ( ENABLE_SECURITY False )
+set ( ENABLE_STANDALONE_EPC False)
+set ( ENABLE_USE_CPU_EXECUTION_TIME True )
+set ( ENABLE_USE_MME False )
+set ( ENABLE_USE_RAW_SOCKET_FOR_SGI False)
+set ( ENABLE_VCD_FIFO False )
+set ( ENB_MODE True )
+set ( EXMIMO_IOT True )
+set ( HARD_RT False )
+set ( JUMBO_FRAME True )
+set ( LARGE_SCALE False )
+set ( LINK_ENB_PDCP_TO_GTPV1U False)
+set ( LINUX_LIST False )
+set ( LINUX True )
+set ( LOCALIZATION False )
+set ( LOG_NO_THREAD 1 )
+set ( LOWLATENCY False )
+set ( MAC_CONTEXT 1 )
+set ( MAX_NUM_CCs 1 )
+set ( MESSAGE_CHART_GENERATOR False )
+set ( MESSAGE_CHART_GENERATOR_RLC_MAC False )
+set ( MESSAGE_CHART_GENERATOR_PHY False )
+set ( MIH_C_MEDIEVAL_EXTENSIONS False )
+set ( MSG_PRINT False )
+set ( MU_RECEIVER False )
+set ( NAS_ADDRESS_FIX True )
+set ( NAS_BUILT_IN_UE False)
+set ( NAS_MME False )
+set ( NAS_UE False )
+set ( NB_ANTENNAS_RX "2" )
+set ( NB_ANTENNAS_TX "2" )
+set ( NB_ANTENNAS_TXRX "2" )
+set ( NEW_FFT True )
+set ( NO_RRM True )
+set ( OAI_EMU True )
+set ( OAISIM True )
+set ( OAI_NW_DRIVER_TYPE_ETHERNET True )
+set ( OAI_NW_DRIVER_USE_NETLINK True )
+set ( OPENAIR1 True )
+set ( OPENAIR2 True )
+set ( OPENAIR_EMU False )
+set ( OPENAIR_LTE True )
+set ( PACKAGE_NAME "oaisim" )
+set ( PBS_SIM False )
+set ( PDCP_USE_NETLINK True )
+set ( PC_DSP True )
+set ( PC_TARGET True )
+set ( PDCP_MSG_PRINT False )
+set ( PERFECT_CE False )
+set ( PHY_ABSTRACTION True )
+set ( PHY_CONTEXT False )
+set ( PHY_EMUL False )
+set ( PHYSIM True )
+set ( PUCCH True )
+set ( RANDOM_BF False )
+set ( RF_BOARD "False" )
+set ( RRC_ASN1_VERSION "Rel10" )
+set ( RLC_STOP_ON_LOST_PDU False )
+set ( RRC_MSG_PRINT False )
+set ( RTAI False )
+set ( SECU False )
+set ( SMBV False )
+set ( SPECTRA False )
+set ( TEST_OMG False )
+set ( USE_3GPP_ADDR_AS_LINK_ADDR False )
+set ( USE_MME "R10" )
+set ( USER_MODE True )
+set ( XER_PRINT False )
diff --git a/cmake_targets/autotests/0201/CMakeLists.txt b/cmake_targets/autotests/0201/CMakeLists.txt
new file mode 100644
index 0000000000..e6c4bdfe47
--- /dev/null
+++ b/cmake_targets/autotests/0201/CMakeLists.txt
@@ -0,0 +1,87 @@
+cmake_minimum_required(VERSION 2.8)
+
+set ( CMAKE_BUILD_TYPE "RelWithDebInfo" )
+set ( ADDR_CONF False )
+set ( DEBUG_OMG False )
+set ( DISABLE_XER_PRINT False )
+set ( DRIVER2013 True )
+set ( EMOS False )
+set ( ENABLE_FXP True )
+set ( ENABLE_ITTI True )
+set ( ENABLE_NAS_UE_LOGGING False )
+set ( ENABLE_NEW_MULTICAST True )
+set ( ENABLE_PGM_TRANSPORT True )
+set ( ENABLE_RAL False )
+set ( ENABLE_SECURITY False )
+set ( ENABLE_STANDALONE_EPC False)
+set ( ENABLE_USE_CPU_EXECUTION_TIME True )
+set ( ENABLE_USE_MME False )
+set ( ENABLE_USE_RAW_SOCKET_FOR_SGI False)
+set ( ENABLE_VCD_FIFO False )
+set ( ENB_MODE True )
+set ( EXMIMO_IOT True )
+set ( HARD_RT False )
+set ( JUMBO_FRAME True )
+set ( LARGE_SCALE False )
+set ( LINK_ENB_PDCP_TO_GTPV1U False)
+set ( LINUX_LIST False )
+set ( LINUX True )
+set ( LOCALIZATION False )
+set ( LOG_NO_THREAD 1 )
+set ( LOWLATENCY False )
+set ( MAC_CONTEXT 1 )
+set ( MAX_NUM_CCs 1 )
+set ( MESSAGE_CHART_GENERATOR False )
+set ( MESSAGE_CHART_GENERATOR_RLC_MAC False )
+set ( MESSAGE_CHART_GENERATOR_PHY False )
+set ( MIH_C_MEDIEVAL_EXTENSIONS False )
+set ( MSG_PRINT False )
+set ( MU_RECEIVER False )
+set ( NAS_ADDRESS_FIX True )
+set ( NAS_BUILT_IN_UE False)
+set ( NAS_MME False )
+set ( NAS_UE False )
+set ( NB_ANTENNAS_RX "2" )
+set ( NB_ANTENNAS_TX "2" )
+set ( NB_ANTENNAS_TXRX "2" )
+set ( NEW_FFT True )
+set ( NO_RRM True )
+set ( OAI_EMU True )
+set ( OAISIM True )
+set ( OAI_NW_DRIVER_TYPE_ETHERNET True )
+set ( OAI_NW_DRIVER_USE_NETLINK True )
+set ( OPENAIR1 True )
+set ( OPENAIR2 True )
+set ( OPENAIR_EMU False )
+set ( OPENAIR_LTE True )
+set ( PACKAGE_NAME "oaisim" )
+set ( PBS_SIM False )
+set ( PDCP_USE_NETLINK True )
+set ( PC_DSP True )
+set ( PC_TARGET True )
+set ( PDCP_MSG_PRINT False )
+set ( PERFECT_CE False )
+set ( PHY_ABSTRACTION True )
+set ( PHY_CONTEXT False )
+set ( PHY_EMUL False )
+set ( PHYSIM True )
+set ( PUCCH True )
+set ( RANDOM_BF False )
+set ( RF_BOARD "False" )
+set ( RRC_ASN1_VERSION "Rel10" )
+set ( RLC_STOP_ON_LOST_PDU False )
+set ( RRC_MSG_PRINT False )
+set ( RTAI False )
+set ( SECU False )
+set ( SMBV False )
+set ( SPECTRA False )
+set ( TEST_OMG False )
+set ( USE_3GPP_ADDR_AS_LINK_ADDR False )
+set ( USE_MME "R10" )
+set ( USER_MODE True )
+set ( XER_PRINT False )
+set ( XFORMS False )
+set ( PRINT_STATS False )
+set ( RRC_ASN1_VERSION "Rel10")
+set ( ENABLE_VCD_FIFO False )
+include(${CMAKE_CURRENT_SOURCE_DIR}/../../CMakeLists.txt)
diff --git a/cmake_targets/autotests/run_compilation_autotests.bash b/cmake_targets/autotests/run_compilation_autotests.bash
index 9963edead6..f27d1dcca8 100755
--- a/cmake_targets/autotests/run_compilation_autotests.bash
+++ b/cmake_targets/autotests/run_compilation_autotests.bash
@@ -7,81 +7,109 @@ else
exit 1
fi
+tdir=$OPENAIR_DIR/cmake_targets/autotests
+
+results_file=$tdir/log/compilation_autotests.xml
+
# include the jUnit-like logging functions
source $OPENAIR_DIR/cmake_targets/tools/test_helper
test_compile() {
xUnit_start
+ test_name=$1
+ compile_prog=$2
+ exec_prog=$3
+ build_dir=$tdir/$1/build
+ log_file=$tdir/log/$1.txt
+ target=$5
+ echo "Compiling test case $test_name. Log file = $log_file"
+ rm -fr $build_dir
mkdir -p $tdir/$1/build
- cd $tdir/$1/build
+ cd $build_dir
{
cmake ..
- rm -f $3
- make -j4 $2
- } > $tdir/log/$1.txt 2>&1
- if [ -s $3 ] ; then
- cp $3 $tdir/bin/`basename $3`.$1
- echo_success "$1 test compiled"
- xUnit_success "compilation" $1
+ rm -f $exec_prog
+ make -j`nproc` $compile_prog
+ } > $log_file 2>&1
+ if [ -s $exec_prog ] ; then
+ cp $exec_prog $tdir/bin/`basename $exec_prog`.$target.$test_name
+ echo_success "$test_name $exec_prog $target compiled"
+ xUnit_success "compilation" $test_name "PASS" 1
else
- echo_error "$1 test compilation failed"
- xUnit_fail "compilation" $1
+ echo_error "$test_name $exec_prog $target compilation failed"
+ xUnit_fail "compilation" $test_name "FAIL" 1
fi
}
-tdir=$OPENAIR_DIR/cmake_targets/autotests
mkdir -p $tdir/bin $tdir/log
updated=$(svn st -q $OPENAIR_DIR)
if [ "$updated" != "" ] ; then
- echo_warning "some files are not in svn: $updated"
+ echo_warning "some files are not in svn:\n $updated"
fi
cd $tdir
test_compile \
- test.0101 oaisim \
- oaisim $tdir/bin/oaisim.r8
+ test.0101 oaisim_nos1 \
+ oaisim_nos1 $tdir/bin/oaisim.r8 rel8.nos1
test_compile \
- test.0102 oaisim \
- oaisim $tdir/bin/oaisim.r8.nas
+ test.0102 oaisim_nos1 \
+ oaisim_nos1 $tdir/bin/oaisim.r8.nas rel8.nos1.nas
+cp $tdir/test.0103/CMakeLists.txt.Rel8 $tdir/test.0103/CMakeLists.txt
test_compile \
test.0103 lte-softmodem \
- lte-softmodem $tdir/bin/lte-softmodem.r8.rf
+ lte-softmodem $tdir/bin/lte-softmodem.r8.rf Rel8.EXMIMO
+
+cp $tdir/test.0103/CMakeLists.txt.Rel10 $tdir/test.0103/CMakeLists.txt
+test_compile \
+ test.0103 lte-softmodem \
+ lte-softmodem $tdir/bin/lte-softmodem.r10.rf Rel10.EXMIMO
+
+cp $tdir/test.0103/CMakeLists.txt.USRP $tdir/test.0103/CMakeLists.txt
+test_compile \
+ test.0103 lte-softmodem \
+ lte-softmodem $tdir/bin/lte-softmodem.r10.rf Rel10.USRP
test_compile \
test.0104 dlsim \
- dlsim $tdir/bin/dlsim
+ dlsim $tdir/bin/dlsim dlsim.Rel8
test_compile \
test.0104 ulsim \
- ulsim $tdir/bin/ulsim
+ ulsim $tdir/bin/ulsim ulsim.Rel8
test_compile \
test.0106 oaisim \
- oaisim $tdir/bin/oaisim.r8.itti
+ oaisim $tdir/bin/oaisim.r8.itti Rel8.itti
test_compile \
- test.0107 oaisim \
- oaisim $tdir/bin/oaisim.r10
+ test.0107 oaisim_nos1 \
+ oaisim_nos1 $tdir/bin/oaisim.r10 Rel10.nos1
test_compile \
test.0108 oaisim \
- oaisim $tdir/bin/oaisim.r10.itti
+ oaisim $tdir/bin/oaisim.r10.itti rel10.itti
-test_compile \
- test.0114 oaisim \
- oaisim $tdir/bin/oaisim.r8.itti.ral
+#test_compile \ LG: RAL REMOVED
+# test.0114 oaisim \
+# oaisim $tdir/bin/oaisim.r8.itti.ral rel8.itti.ral
-test_compile \
- test.0115 oaisim \
- oaisim $tdir/bin/oaisim.r10.itti.ral
+#test_compile \ LG: RAL REMOVED
+# test.0115 oaisim \
+# oaisim $tdir/bin/oaisim.r10.itti.ral rel10.itti.ral
test_compile \
test.0120 nasmesh \
- CMakeFiles/nasmesh/nasmesh.ko $tdir/bin/nasmesh.ko
+ CMakeFiles/nasmesh/nasmesh.ko $tdir/bin/nasmesh.ko
+
+test_compile \
+ test.0130 rrh_gw \
+ rrh_gw $tdir/bin/rrh_gw
# write the test results into a file
-xUnit_write "$tdir/log/compilation_autotests.xml"
+xUnit_write "$results_file"
+
+echo "Test Results are written to $results_file"
diff --git a/cmake_targets/autotests/run_exec_autotests.bash b/cmake_targets/autotests/run_exec_autotests.bash
index d5939140d8..6731bcc12d 100755
--- a/cmake_targets/autotests/run_exec_autotests.bash
+++ b/cmake_targets/autotests/run_exec_autotests.bash
@@ -1,12 +1,102 @@
#!/bin/bash
-if [ -s $OPENAIR_DIR/cmake_targets/tools/build_helper ] ; then
- source $OPENAIR_DIR/cmake_targets/tools/build_helper
+if [ -s $OPENAIR_DIR/cmake_targets/tools/test_helper ] ; then
+ source $OPENAIR_DIR/cmake_targets/tools/test_helper
else
echo "Error: no file in the file tree: is OPENAIR_DIR variable set?"
exit 1
fi
+
+SUDO="sudo -E "
+tdir=$OPENAIR_DIR/cmake_targets/autotests
+mkdir -p $tdir/bin $tdir/log
+results_file="$tdir/log/execution_autotests.xml"
+
+updated=$(svn st -q $OPENAIR_DIR)
+if [ "$updated" != "" ] ; then
+ echo "some files are not in svn:\n $updated"
+fi
+
+cd $tdir
+
+
+#\param $1 -> name of test case
+#\param $2 -> name of compilation program
+#\param $3 -> arguments for compilation program
+#\param $4 -> name of pre-executable to install kernel modules, etc
+#\param $5 -> arguments of pre-executable
+#\param $6 -> name of executable
+#\param $7 -> arguments for running the program
+#\param $8 -> search expression
+#\param $9 -> number of runs
+
+test_compile_and_run() {
+ xUnit_start
+ test_case_name=$1
+ log_dir=$tdir/log
+ log_file=$tdir/log/test.$1.txt
+ compile_prog=$2
+ compile_args=$3
+ pre_exec_file=$4
+ pre_exec_args=$5
+ exec_args=$7
+ search_expr=$8
+ nruns=$9
+ build_dir=$tdir/$1/build
+ exec_file=$build_dir/$6
+
+ #Temporary log file where execution log is stored.
+ temp_exec_log=$log_dir/temp_log.txt
+
+ echo "Compiling test case $test_case_name. Log file = $log_file"
+
+ rm -fr $build_dir
+ mkdir -p $build_dir
+
+# echo "log_dir = $log_dir"
+# echo "log_file = $log_file"
+# echo "exec_file = $exec_file"
+# echo "args = $args"
+# echo "search_expr = $search_expr"
+# echo "pre_exec_file = $pre_exec_file"
+
+ echo "" > $log_file
+ cd $build_dir
+ {
+ cmake ..
+ #rm -fv $exec_file
+ make -j`nproc` $compile_prog
+ }>> $log_file 2>&1
+ echo "" >> $log_file 2>&1
+
+ for (( run_index=1; run_index <= $nruns; run_index++ ))
+ do
+
+ echo "Executing test case $test_case_name, Run Index = $run_index, Log file = $log_file"
+
+ echo "-----------------------------------------------------------------------------" >> $log_file 2>&1
+ echo "" >> $log_file 2>&1
+
+
+ source $pre_exec_file $pre_exec_args >> $log_file 2>&1
+ $exec_file $exec_args > $temp_exec_log 2>&1
+ cat $temp_exec_log >> $log_file 2>&1
+ echo "" >> $log_file 2>&1
+
+ search_result=`grep "$search_expr" $temp_exec_log`
+
+ if [ -z "$search_result" ]; then
+ xUnit_fail "execution" "$test_case_name" "FAIL" "$run_index"
+ else
+ xUnit_success "execution" "$test_case_name" "PASS" "$run_index"
+ fi
+
+# End of for loop
+ done
+
+}
+
dbin=$OPENAIR_DIR/cmake_targets/autotests/bin
dlog=$OPENAIR_DIR/cmake_targets/autotests/log
@@ -14,6 +104,9 @@ run_test() {
case=case$1; shift
cmd=$1; shift
expected=$3; shift
+echo "expected = $expected"
+exit
+
$cmd > $dlog/$case.txt 2>&1
if [ $expected = "true" ] ; then
if $* $dlog/$case.txt; then
@@ -30,7 +123,29 @@ else
fi
}
-run_test 0200 "$dbin/oaisim.r8 -a -A AWGN -n 100" false grep -q '(Segmentation.fault)|(Exiting)|(FATAL)'
+#$1 -> name of test case
+#$2 -> name of compilation program
+#$3 -> arguments for compilation program
+#$4 -> name of pre-executable to install kernel modules, etc
+#$5 -> arguments of pre-executable
+#$6 -> name of executable
+#$7 -> arguments for running the program
+#$8 -> search expression
+#$9 -> number of runs
-run_test 0201 "$dbin/oaisim.r8 -a -A AWGN -n 100" false fgrep -q '[E]'
+test_compile_and_run 0200 "oaisim_nos1" "" "$OPENAIR_DIR/cmake_targets/tools/init_nas_nos1" "" "oaisim_nos1" " -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -b1 -u1 -n1000" "RRC_CONN" 3
+
+test_compile_and_run 0201 "oaisim_nos1" "" "$OPENAIR_DIR/cmake_targets/tools/init_nas_nos1" "" "oaisim_nos1" " -O $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -b1 -u1 -a -n1000" "RRC_CONN" 3
+
+#test_compile_and_run 0200 "oaisim_nos1" "" "$OPENAIR_DIR/cmake_targets/tools/init_nas_nos1" "" "oaisim_nos1" " -O /home/calisson/rohit/oai_snav/taets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf -b1 -u1 -a " "RRC_CONN" 3
+
+#run_test 0200 "$dbin/oaisim.r8 -a -A AWGN -n 100" false grep -q '(Segmentation.fault)|(Exiting)|(FATAL)'
+
+#run_test 0201 "$dbin/oaisim.r8 -a -A AWGN -n 100" false fgrep -q '[E]'
+
+# write the test results into a file
+
+xUnit_write "$results_file"
+
+echo "Test Results are written to $results_file"
diff --git a/cmake_targets/autotests/test.0101/CMakeLists.txt b/cmake_targets/autotests/test.0101/CMakeLists.txt
index d4c2d85cdc..ed913b0fb9 100644
--- a/cmake_targets/autotests/test.0101/CMakeLists.txt
+++ b/cmake_targets/autotests/test.0101/CMakeLists.txt
@@ -10,26 +10,20 @@ set ( ENABLE_FXP True )
set ( ENABLE_ITTI False )
set ( ENABLE_NAS_UE_LOGGING False )
set ( ENABLE_NEW_MULTICAST True )
-set ( ENABLE_PDCP_NETLINK_FIFO False )
set ( ENABLE_PGM_TRANSPORT True )
set ( ENABLE_RAL False )
set ( ENABLE_SECURITY False )
set ( ENABLE_STANDALONE_EPC False )
set ( ENABLE_USE_CPU_EXECUTION_TIME True )
-set ( ENABLE_USE_GTPU_IN_KERNEL False )
set ( ENABLE_USE_MME False )
-set ( ENABLE_USE_NETFILTER_FOR_SGI False )
-set ( ENABLE_USE_PCAP_FOR_SGI False )
-set ( ENABLE_USE_RAW_SOCKET_FOR_SGI False )
-set ( ENABLE_VCD_FIFO True )
+set ( ENABLE_USE_RAW_SOCKET_FOR_SGI False)
+set ( ENABLE_VCD_FIFO False )
set ( ENB_MODE True )
-set ( EPC_BUILD False )
set ( HARD_RT False )
set ( JUMBO_FRAME True )
set ( LARGE_SCALE False )
set ( LINK_ENB_PDCP_TO_GTPV1U False )
set ( LINK_ENB_PDCP_TO_IP_DRIVER False )
-set ( LINK_PDCP_TO_GTPV1U False )
set ( LINUX_LIST False )
set ( LINUX True )
set ( LOCALIZATION False )
@@ -37,7 +31,10 @@ set ( LOG_NO_THREAD True )
set ( LOWLATENCY False )
set ( MAC_CONTEXT 1 )
set ( MAX_NUM_CCs 1 )
-set ( MIH_C_MEDIEVAL_EXTENSIONS True )
+set ( MESSAGE_CHART_GENERATOR False )
+set ( MESSAGE_CHART_GENERATOR_RLC_MAC False )
+set ( MESSAGE_CHART_GENERATOR_PHY False )
+set ( MIH_C_MEDIEVAL_EXTENSIONS False )
set ( MSG_PRINT False )
set ( MU_RECEIVER False )
set ( NAS_ADDRESS_FIX False )
@@ -55,7 +52,7 @@ set ( OAI_EMU True )
set ( OAI_NW_DRIVER_TYPE_ETHERNET False )
set ( OAI_NW_DRIVER_USE_NETLINK False )
set ( OAISIM True )
-set ( OPENAIR1 False )
+set ( OPENAIR1 True )
set ( OPENAIR2 True )
set ( OPENAIR_EMU False )
set ( OPENAIR_LTE True )
@@ -72,7 +69,7 @@ set ( PHY_EMUL False )
set ( PHYSIM False )
set ( PUCCH True )
set ( RANDOM_BF False )
-set ( RF_BOARD False )
+set ( RF_BOARD "False" )
set ( RLC_STOP_ON_LOST_PDU False )
set ( RRC_ASN1_VERSION Rel8 )
set ( RRC_DEFAULT_RAB_IS_AM False )
@@ -102,8 +99,8 @@ set ( TRACE_RLC_UM_RX False )
set ( TRACE_RLC_UM_SEGMENT False )
set ( TRACE_RLC_UM_TX_STATUS False )
set ( USE_3GPP_ADDR_AS_LINK_ADDR False )
-set ( USE_MME False )
+set ( USE_MME "R8" )
set ( USER_MODE True )
set ( XER_PRINT True )
set ( XFORMS False )
-include(${CMAKE_CURRENT_SOURCE_DIR}/../../CMakeLists.txt)
+include(${CMAKE_CURRENT_SOURCE_DIR}/../../CMakeLists.txt)
\ No newline at end of file
diff --git a/cmake_targets/autotests/test.0102/CMakeLists.txt b/cmake_targets/autotests/test.0102/CMakeLists.txt
index 37e9dc3791..d05856ebb0 100644
--- a/cmake_targets/autotests/test.0102/CMakeLists.txt
+++ b/cmake_targets/autotests/test.0102/CMakeLists.txt
@@ -10,17 +10,12 @@ set ( ENABLE_FXP True )
set ( ENABLE_ITTI False )
set ( ENABLE_NAS_UE_LOGGING False )
set ( ENABLE_NEW_MULTICAST True )
-set ( ENABLE_PDCP_NETLINK_FIFO False )
set ( ENABLE_PGM_TRANSPORT True )
set ( ENABLE_RAL False )
set ( ENABLE_SECURITY False )
set ( ENABLE_STANDALONE_EPC False )
set ( ENABLE_USE_CPU_EXECUTION_TIME True )
-set ( ENABLE_USE_GTPU_IN_KERNEL False )
set ( ENABLE_USE_MME False )
-set ( ENABLE_USE_NETFILTER_FOR_SGI False )
-set ( ENABLE_USE_PCAP_FOR_SGI False )
-set ( ENABLE_USE_RAW_SOCKET_FOR_SGI False )
set ( ENABLE_VCD_FIFO True )
set ( ENB_MODE True )
set ( EPC_BUILD False )
@@ -29,7 +24,6 @@ set ( JUMBO_FRAME True )
set ( LARGE_SCALE False )
set ( LINK_ENB_PDCP_TO_GTPV1U False )
set ( LINK_ENB_PDCP_TO_IP_DRIVER False )
-set ( LINK_PDCP_TO_GTPV1U False )
set ( LINUX_LIST False )
set ( LINUX True )
set ( LOCALIZATION False )
@@ -37,7 +31,10 @@ set ( LOG_NO_THREAD True )
set ( LOWLATENCY False )
set ( MAC_CONTEXT 1 )
set ( MAX_NUM_CCs 1 )
-set ( MIH_C_MEDIEVAL_EXTENSIONS True )
+set ( MESSAGE_CHART_GENERATOR False )
+set ( MESSAGE_CHART_GENERATOR_RLC_MAC False )
+set ( MESSAGE_CHART_GENERATOR_PHY False )
+set ( MIH_C_MEDIEVAL_EXTENSIONS False )
set ( MSG_PRINT False )
set ( MU_RECEIVER False )
set ( NAS_ADDRESS_FIX False )
diff --git a/cmake_targets/autotests/test.0103/CMakeLists.txt b/cmake_targets/autotests/test.0103/CMakeLists.txt
index 2d4e85aec3..9603067fe1 100644
--- a/cmake_targets/autotests/test.0103/CMakeLists.txt
+++ b/cmake_targets/autotests/test.0103/CMakeLists.txt
@@ -10,17 +10,12 @@ set ( ENABLE_FXP True )
set ( ENABLE_ITTI False )
set ( ENABLE_NAS_UE_LOGGING False )
set ( ENABLE_NEW_MULTICAST False )
-set ( ENABLE_PDCP_NETLINK_FIFO False )
set ( ENABLE_PGM_TRANSPORT False )
set ( ENABLE_RAL False )
set ( ENABLE_SECURITY False )
set ( ENABLE_STANDALONE_EPC False )
set ( ENABLE_USE_CPU_EXECUTION_TIME True )
-set ( ENABLE_USE_GTPU_IN_KERNEL False )
set ( ENABLE_USE_MME False )
-set ( ENABLE_USE_NETFILTER_FOR_SGI False )
-set ( ENABLE_USE_PCAP_FOR_SGI False )
-set ( ENABLE_USE_RAW_SOCKET_FOR_SGI False )
set ( ENABLE_VCD_FIFO True )
set ( ENB_MODE True )
set ( EPC_BUILD False )
@@ -29,7 +24,6 @@ set ( JUMBO_FRAME True )
set ( LARGE_SCALE False )
set ( LINK_ENB_PDCP_TO_GTPV1U False )
set ( LINK_ENB_PDCP_TO_IP_DRIVER False )
-set ( LINK_PDCP_TO_GTPV1U False )
set ( LINUX False )
set ( LINUX_LIST False )
set ( LOCALIZATION False )
@@ -37,7 +31,10 @@ set ( LOG_NO_THREAD True )
set ( LOWLATENCY False )
set ( MAC_CONTEXT 1 )
set ( MAX_NUM_CCs 1 )
-set ( MIH_C_MEDIEVAL_EXTENSIONS True )
+set ( MESSAGE_CHART_GENERATOR False )
+set ( MESSAGE_CHART_GENERATOR_RLC_MAC False )
+set ( MESSAGE_CHART_GENERATOR_PHY False )
+set ( MIH_C_MEDIEVAL_EXTENSIONS False )
set ( MSG_PRINT False )
set ( MU_RECEIVER False )
set ( NAS_ADDRESS_FIX False )
@@ -72,9 +69,9 @@ set ( PHY_EMUL False )
set ( PHYSIM True )
set ( PUCCH True )
set ( RANDOM_BF False )
-set ( RF_BOARD EXMIMO )
+set ( RF_BOARD OAI_USRP )
set ( RLC_STOP_ON_LOST_PDU False )
-set ( RRC_ASN1_VERSION Rel8 )
+set ( RRC_ASN1_VERSION Rel10 )
set ( RRC_DEFAULT_RAB_IS_AM False )
set ( RRC_MSG_PRINT False )
set ( RTAI False )
@@ -106,5 +103,5 @@ set ( USE_MME False )
set ( USER_MODE True )
set ( XER_PRINT False )
set ( XFORMS False )
-
+set(PACKAGE_NAME "lte-softmodem")
include(${CMAKE_CURRENT_SOURCE_DIR}/../../CMakeLists.txt)
diff --git a/cmake_targets/autotests/test.0103/CMakeLists.txt.Rel10 b/cmake_targets/autotests/test.0103/CMakeLists.txt.Rel10
new file mode 100644
index 0000000000..6af3c58762
--- /dev/null
+++ b/cmake_targets/autotests/test.0103/CMakeLists.txt.Rel10
@@ -0,0 +1,107 @@
+cmake_minimum_required(VERSION 2.8)
+
+set ( ADDR_CONF False )
+set ( DEBUG_OMG False )
+set ( DISABLE_USE_NAS False )
+set ( DISABLE_XER_PRINT False )
+set ( DRIVER2013 True )
+set ( EMOS False )
+set ( ENABLE_FXP True )
+set ( ENABLE_ITTI False )
+set ( ENABLE_NAS_UE_LOGGING False )
+set ( ENABLE_NEW_MULTICAST False )
+set ( ENABLE_PGM_TRANSPORT False )
+set ( ENABLE_RAL False )
+set ( ENABLE_SECURITY False )
+set ( ENABLE_STANDALONE_EPC False )
+set ( ENABLE_USE_CPU_EXECUTION_TIME True )
+set ( ENABLE_USE_MME False )
+set ( ENABLE_VCD_FIFO True )
+set ( ENB_MODE True )
+set ( EPC_BUILD False )
+set ( HARD_RT False )
+set ( JUMBO_FRAME True )
+set ( LARGE_SCALE False )
+set ( LINK_ENB_PDCP_TO_GTPV1U False )
+set ( LINK_ENB_PDCP_TO_IP_DRIVER False )
+set ( LINUX False )
+set ( LINUX_LIST False )
+set ( LOCALIZATION False )
+set ( LOG_NO_THREAD True )
+set ( LOWLATENCY False )
+set ( MAC_CONTEXT 1 )
+set ( MAX_NUM_CCs 1 )
+set ( MESSAGE_CHART_GENERATOR False )
+set ( MESSAGE_CHART_GENERATOR_RLC_MAC False )
+set ( MESSAGE_CHART_GENERATOR_PHY False )
+set ( MIH_C_MEDIEVAL_EXTENSIONS False )
+set ( MSG_PRINT False )
+set ( MU_RECEIVER False )
+set ( NAS_ADDRESS_FIX False )
+set ( NAS_BUILT_IN_EPC False )
+set ( NAS_BUILT_IN_UE False )
+set ( NAS_MME False )
+set ( NAS_NETLINK False )
+set ( NAS_UE False )
+set ( NB_ANTENNAS_RX 2 )
+set ( NB_ANTENNAS_TX 2 )
+set ( NB_ANTENNAS_TXRX 2 )
+set ( NEW_FFT True )
+set ( NO_RRM True )
+set ( OAI_EMU False )
+set ( OAI_NW_DRIVER_TYPE_ETHERNET False )
+set ( OAI_NW_DRIVER_USE_NETLINK False )
+set ( OAISIM False )
+set ( OPENAIR1 True )
+set ( OPENAIR2 True )
+set ( OPENAIR_EMU False )
+set ( OPENAIR_LTE True )
+set ( PBS_SIM False )
+set ( PC_DSP True )
+set ( PC_TARGET True )
+set ( PDCP_MSG_PRINT False )
+set ( PDCP_USE_NETLINK False )
+set ( PDCP_USE_NETLINK_QUEUES False )
+set ( PERFECT_CE False )
+set ( PHY_ABSTRACTION False )
+set ( PHY_CONTEXT 1 )
+set ( PHY_EMUL False )
+set ( PHYSIM True )
+set ( PUCCH True )
+set ( RANDOM_BF False )
+set ( RF_BOARD EXMIMO )
+set ( RLC_STOP_ON_LOST_PDU False )
+set ( RRC_ASN1_VERSION Rel10 )
+set ( RRC_DEFAULT_RAB_IS_AM False )
+set ( RRC_MSG_PRINT False )
+set ( RTAI False )
+set ( S1AP_LIMIT_STREAM_ID_TO_1 False )
+set ( S1AP_VERSION R10 )
+set ( SMBV False )
+set ( SPECTRA False )
+set ( STOP_ON_IP_TRAFFIC_OVERLOAD False )
+set ( TEST_OMG False )
+set ( TRACE_RLC_AM_BO False )
+set ( TRACE_RLC_AM_FREE_SDU False )
+set ( TRACE_RLC_AM_HOLE False )
+set ( TRACE_RLC_AM_PDU False )
+set ( TRACE_RLC_AM_RESEGMENT False )
+set ( TRACE_RLC_AM_RX_DECODE False )
+set ( TRACE_RLC_AM_RX False )
+set ( TRACE_RLC_AM_STATUS_CREATION False )
+set ( TRACE_RLC_AM_TX False )
+set ( TRACE_RLC_AM_TX_STATUS False )
+set ( TRACE_RLC_PAYLOAD False )
+set ( TRACE_RLC_UM_DAR False )
+set ( TRACE_RLC_UM_DISPLAY_ASCII_DATA False )
+set ( TRACE_RLC_UM_PDU False )
+set ( TRACE_RLC_UM_RX False )
+set ( TRACE_RLC_UM_SEGMENT False )
+set ( TRACE_RLC_UM_TX_STATUS False )
+set ( USE_3GPP_ADDR_AS_LINK_ADDR False )
+set ( USE_MME False )
+set ( USER_MODE True )
+set ( XER_PRINT False )
+set ( XFORMS False )
+set(PACKAGE_NAME "lte-softmodem")
+include(${CMAKE_CURRENT_SOURCE_DIR}/../../CMakeLists.txt)
diff --git a/cmake_targets/autotests/test.0103/CMakeLists.txt.Rel8 b/cmake_targets/autotests/test.0103/CMakeLists.txt.Rel8
new file mode 100644
index 0000000000..dafbed61d9
--- /dev/null
+++ b/cmake_targets/autotests/test.0103/CMakeLists.txt.Rel8
@@ -0,0 +1,107 @@
+cmake_minimum_required(VERSION 2.8)
+
+set ( ADDR_CONF False )
+set ( DEBUG_OMG False )
+set ( DISABLE_USE_NAS False )
+set ( DISABLE_XER_PRINT False )
+set ( DRIVER2013 True )
+set ( EMOS False )
+set ( ENABLE_FXP True )
+set ( ENABLE_ITTI False )
+set ( ENABLE_NAS_UE_LOGGING False )
+set ( ENABLE_NEW_MULTICAST False )
+set ( ENABLE_PGM_TRANSPORT False )
+set ( ENABLE_RAL False )
+set ( ENABLE_SECURITY False )
+set ( ENABLE_STANDALONE_EPC False )
+set ( ENABLE_USE_CPU_EXECUTION_TIME True )
+set ( ENABLE_USE_MME False )
+set ( ENABLE_VCD_FIFO True )
+set ( ENB_MODE True )
+set ( EPC_BUILD False )
+set ( HARD_RT False )
+set ( JUMBO_FRAME True )
+set ( LARGE_SCALE False )
+set ( LINK_ENB_PDCP_TO_GTPV1U False )
+set ( LINK_ENB_PDCP_TO_IP_DRIVER False )
+set ( LINUX False )
+set ( LINUX_LIST False )
+set ( LOCALIZATION False )
+set ( LOG_NO_THREAD True )
+set ( LOWLATENCY False )
+set ( MAC_CONTEXT 1 )
+set ( MAX_NUM_CCs 1 )
+set ( MESSAGE_CHART_GENERATOR False )
+set ( MESSAGE_CHART_GENERATOR_RLC_MAC False )
+set ( MESSAGE_CHART_GENERATOR_PHY False )
+set ( MIH_C_MEDIEVAL_EXTENSIONS False )
+set ( MSG_PRINT False )
+set ( MU_RECEIVER False )
+set ( NAS_ADDRESS_FIX False )
+set ( NAS_BUILT_IN_EPC False )
+set ( NAS_BUILT_IN_UE False )
+set ( NAS_MME False )
+set ( NAS_NETLINK False )
+set ( NAS_UE False )
+set ( NB_ANTENNAS_RX 2 )
+set ( NB_ANTENNAS_TX 2 )
+set ( NB_ANTENNAS_TXRX 2 )
+set ( NEW_FFT True )
+set ( NO_RRM True )
+set ( OAI_EMU False )
+set ( OAI_NW_DRIVER_TYPE_ETHERNET False )
+set ( OAI_NW_DRIVER_USE_NETLINK False )
+set ( OAISIM False )
+set ( OPENAIR1 True )
+set ( OPENAIR2 True )
+set ( OPENAIR_EMU False )
+set ( OPENAIR_LTE True )
+set ( PBS_SIM False )
+set ( PC_DSP True )
+set ( PC_TARGET True )
+set ( PDCP_MSG_PRINT False )
+set ( PDCP_USE_NETLINK False )
+set ( PDCP_USE_NETLINK_QUEUES False )
+set ( PERFECT_CE False )
+set ( PHY_ABSTRACTION False )
+set ( PHY_CONTEXT 1 )
+set ( PHY_EMUL False )
+set ( PHYSIM True )
+set ( PUCCH True )
+set ( RANDOM_BF False )
+set ( RF_BOARD EXMIMO )
+set ( RLC_STOP_ON_LOST_PDU False )
+set ( RRC_ASN1_VERSION Rel8 )
+set ( RRC_DEFAULT_RAB_IS_AM False )
+set ( RRC_MSG_PRINT False )
+set ( RTAI False )
+set ( S1AP_LIMIT_STREAM_ID_TO_1 False )
+set ( S1AP_VERSION R10 )
+set ( SMBV False )
+set ( SPECTRA False )
+set ( STOP_ON_IP_TRAFFIC_OVERLOAD False )
+set ( TEST_OMG False )
+set ( TRACE_RLC_AM_BO False )
+set ( TRACE_RLC_AM_FREE_SDU False )
+set ( TRACE_RLC_AM_HOLE False )
+set ( TRACE_RLC_AM_PDU False )
+set ( TRACE_RLC_AM_RESEGMENT False )
+set ( TRACE_RLC_AM_RX_DECODE False )
+set ( TRACE_RLC_AM_RX False )
+set ( TRACE_RLC_AM_STATUS_CREATION False )
+set ( TRACE_RLC_AM_TX False )
+set ( TRACE_RLC_AM_TX_STATUS False )
+set ( TRACE_RLC_PAYLOAD False )
+set ( TRACE_RLC_UM_DAR False )
+set ( TRACE_RLC_UM_DISPLAY_ASCII_DATA False )
+set ( TRACE_RLC_UM_PDU False )
+set ( TRACE_RLC_UM_RX False )
+set ( TRACE_RLC_UM_SEGMENT False )
+set ( TRACE_RLC_UM_TX_STATUS False )
+set ( USE_3GPP_ADDR_AS_LINK_ADDR False )
+set ( USE_MME False )
+set ( USER_MODE True )
+set ( XER_PRINT False )
+set ( XFORMS False )
+set(PACKAGE_NAME "lte-softmodem")
+include(${CMAKE_CURRENT_SOURCE_DIR}/../../CMakeLists.txt)
diff --git a/cmake_targets/autotests/test.0103/CMakeLists.txt.USRP b/cmake_targets/autotests/test.0103/CMakeLists.txt.USRP
new file mode 100644
index 0000000000..9603067fe1
--- /dev/null
+++ b/cmake_targets/autotests/test.0103/CMakeLists.txt.USRP
@@ -0,0 +1,107 @@
+cmake_minimum_required(VERSION 2.8)
+
+set ( ADDR_CONF False )
+set ( DEBUG_OMG False )
+set ( DISABLE_USE_NAS False )
+set ( DISABLE_XER_PRINT False )
+set ( DRIVER2013 True )
+set ( EMOS False )
+set ( ENABLE_FXP True )
+set ( ENABLE_ITTI False )
+set ( ENABLE_NAS_UE_LOGGING False )
+set ( ENABLE_NEW_MULTICAST False )
+set ( ENABLE_PGM_TRANSPORT False )
+set ( ENABLE_RAL False )
+set ( ENABLE_SECURITY False )
+set ( ENABLE_STANDALONE_EPC False )
+set ( ENABLE_USE_CPU_EXECUTION_TIME True )
+set ( ENABLE_USE_MME False )
+set ( ENABLE_VCD_FIFO True )
+set ( ENB_MODE True )
+set ( EPC_BUILD False )
+set ( HARD_RT False )
+set ( JUMBO_FRAME True )
+set ( LARGE_SCALE False )
+set ( LINK_ENB_PDCP_TO_GTPV1U False )
+set ( LINK_ENB_PDCP_TO_IP_DRIVER False )
+set ( LINUX False )
+set ( LINUX_LIST False )
+set ( LOCALIZATION False )
+set ( LOG_NO_THREAD True )
+set ( LOWLATENCY False )
+set ( MAC_CONTEXT 1 )
+set ( MAX_NUM_CCs 1 )
+set ( MESSAGE_CHART_GENERATOR False )
+set ( MESSAGE_CHART_GENERATOR_RLC_MAC False )
+set ( MESSAGE_CHART_GENERATOR_PHY False )
+set ( MIH_C_MEDIEVAL_EXTENSIONS False )
+set ( MSG_PRINT False )
+set ( MU_RECEIVER False )
+set ( NAS_ADDRESS_FIX False )
+set ( NAS_BUILT_IN_EPC False )
+set ( NAS_BUILT_IN_UE False )
+set ( NAS_MME False )
+set ( NAS_NETLINK False )
+set ( NAS_UE False )
+set ( NB_ANTENNAS_RX 2 )
+set ( NB_ANTENNAS_TX 2 )
+set ( NB_ANTENNAS_TXRX 2 )
+set ( NEW_FFT True )
+set ( NO_RRM True )
+set ( OAI_EMU False )
+set ( OAI_NW_DRIVER_TYPE_ETHERNET False )
+set ( OAI_NW_DRIVER_USE_NETLINK False )
+set ( OAISIM False )
+set ( OPENAIR1 True )
+set ( OPENAIR2 True )
+set ( OPENAIR_EMU False )
+set ( OPENAIR_LTE True )
+set ( PBS_SIM False )
+set ( PC_DSP True )
+set ( PC_TARGET True )
+set ( PDCP_MSG_PRINT False )
+set ( PDCP_USE_NETLINK False )
+set ( PDCP_USE_NETLINK_QUEUES False )
+set ( PERFECT_CE False )
+set ( PHY_ABSTRACTION False )
+set ( PHY_CONTEXT 1 )
+set ( PHY_EMUL False )
+set ( PHYSIM True )
+set ( PUCCH True )
+set ( RANDOM_BF False )
+set ( RF_BOARD OAI_USRP )
+set ( RLC_STOP_ON_LOST_PDU False )
+set ( RRC_ASN1_VERSION Rel10 )
+set ( RRC_DEFAULT_RAB_IS_AM False )
+set ( RRC_MSG_PRINT False )
+set ( RTAI False )
+set ( S1AP_LIMIT_STREAM_ID_TO_1 False )
+set ( S1AP_VERSION R10 )
+set ( SMBV False )
+set ( SPECTRA False )
+set ( STOP_ON_IP_TRAFFIC_OVERLOAD False )
+set ( TEST_OMG False )
+set ( TRACE_RLC_AM_BO False )
+set ( TRACE_RLC_AM_FREE_SDU False )
+set ( TRACE_RLC_AM_HOLE False )
+set ( TRACE_RLC_AM_PDU False )
+set ( TRACE_RLC_AM_RESEGMENT False )
+set ( TRACE_RLC_AM_RX_DECODE False )
+set ( TRACE_RLC_AM_RX False )
+set ( TRACE_RLC_AM_STATUS_CREATION False )
+set ( TRACE_RLC_AM_TX False )
+set ( TRACE_RLC_AM_TX_STATUS False )
+set ( TRACE_RLC_PAYLOAD False )
+set ( TRACE_RLC_UM_DAR False )
+set ( TRACE_RLC_UM_DISPLAY_ASCII_DATA False )
+set ( TRACE_RLC_UM_PDU False )
+set ( TRACE_RLC_UM_RX False )
+set ( TRACE_RLC_UM_SEGMENT False )
+set ( TRACE_RLC_UM_TX_STATUS False )
+set ( USE_3GPP_ADDR_AS_LINK_ADDR False )
+set ( USE_MME False )
+set ( USER_MODE True )
+set ( XER_PRINT False )
+set ( XFORMS False )
+set(PACKAGE_NAME "lte-softmodem")
+include(${CMAKE_CURRENT_SOURCE_DIR}/../../CMakeLists.txt)
diff --git a/cmake_targets/autotests/test.0104/CMakeLists.txt b/cmake_targets/autotests/test.0104/CMakeLists.txt
index 6f93e687e5..eab37127a7 100644
--- a/cmake_targets/autotests/test.0104/CMakeLists.txt
+++ b/cmake_targets/autotests/test.0104/CMakeLists.txt
@@ -10,4 +10,8 @@ set(RANDOM_BF False)
set(PBS_SIM False)
set(PERFECT_CE True)
+set(MESSAGE_CHART_GENERATOR False)
+set(MESSAGE_CHART_GENERATOR_RLC_MAC False)
+set(MESSAGE_CHART_GENERATOR_PHY False)
+
include(${CMAKE_CURRENT_SOURCE_DIR}/../../CMakeLists.txt)
diff --git a/cmake_targets/autotests/test.0106/CMakeLists.txt b/cmake_targets/autotests/test.0106/CMakeLists.txt
index 5e12f11149..2b315ad411 100644
--- a/cmake_targets/autotests/test.0106/CMakeLists.txt
+++ b/cmake_targets/autotests/test.0106/CMakeLists.txt
@@ -8,7 +8,6 @@ set(ENABLE_FXP True)
set(ENABLE_ITTI True)
set(ENABLE_NAS_UE_LOGGING False)
set(ENABLE_NEW_MULTICAST True)
-set(ENABLE_PDCP_NETLINK_FIFO False)
set(ENABLE_PGM_TRANSPORT True)
set(ENABLE_RAL False)
set(ENABLE_SECURITY False)
@@ -18,7 +17,7 @@ set(ENABLE_VCD_FIFO True)
set(HARD_RT False)
set(JUMBO_FRAME True)
set(LARGE_SCALE False)
-set(LINK_PDCP_TO_GTPV1U False)
+set(LINK_ENB_PDCP_TO_GTPV1U False)
set(LINUX_LIST False)
set(LINUX True)
set(LOCALIZATION False)
@@ -26,7 +25,10 @@ set(LOG_NO_THREAD True)
set(LOWLATENCY False)
set(MAC_CONTEXT 1)
set(MAX_NUM_CCs 1)
-set(MIH_C_MEDIEVAL_EXTENSIONS True)
+set(MESSAGE_CHART_GENERATOR False )
+set(MESSAGE_CHART_GENERATOR_RLC_MAC False )
+set(MESSAGE_CHART_GENERATOR_PHY False )
+set(MIH_C_MEDIEVAL_EXTENSIONS False)
set(MSG_PRINT False)
set(MU_RECEIVER False)
set(NAS_ADDRESS_FIX true)
diff --git a/cmake_targets/autotests/test.0107/CMakeLists.txt b/cmake_targets/autotests/test.0107/CMakeLists.txt
index aa4f098d78..a2aa19942e 100644
--- a/cmake_targets/autotests/test.0107/CMakeLists.txt
+++ b/cmake_targets/autotests/test.0107/CMakeLists.txt
@@ -10,17 +10,12 @@ set ( ENABLE_FXP True )
set ( ENABLE_ITTI False )
set ( ENABLE_NAS_UE_LOGGING False )
set ( ENABLE_NEW_MULTICAST True )
-set ( ENABLE_PDCP_NETLINK_FIFO False )
set ( ENABLE_PGM_TRANSPORT True )
set ( ENABLE_RAL False )
set ( ENABLE_SECURITY False )
set ( ENABLE_STANDALONE_EPC False )
set ( ENABLE_USE_CPU_EXECUTION_TIME True )
-set ( ENABLE_USE_GTPU_IN_KERNEL False )
set ( ENABLE_USE_MME False )
-set ( ENABLE_USE_NETFILTER_FOR_SGI False )
-set ( ENABLE_USE_PCAP_FOR_SGI False )
-set ( ENABLE_USE_RAW_SOCKET_FOR_SGI False )
set ( ENABLE_VCD_FIFO True )
set ( ENB_MODE True )
set ( EPC_BUILD False )
@@ -29,7 +24,6 @@ set ( JUMBO_FRAME True )
set ( LARGE_SCALE False )
set ( LINK_ENB_PDCP_TO_GTPV1U False )
set ( LINK_ENB_PDCP_TO_IP_DRIVER False )
-set ( LINK_PDCP_TO_GTPV1U False )
set ( LINUX_LIST False )
set ( LINUX True )
set ( LOCALIZATION False )
@@ -37,7 +31,10 @@ set ( LOG_NO_THREAD True )
set ( LOWLATENCY False )
set ( MAC_CONTEXT 1 )
set ( MAX_NUM_CCs 1 )
-set ( MIH_C_MEDIEVAL_EXTENSIONS True )
+set ( MESSAGE_CHART_GENERATOR False )
+set ( MESSAGE_CHART_GENERATOR_RLC_MAC False )
+set ( MESSAGE_CHART_GENERATOR_PHY False )
+set ( MIH_C_MEDIEVAL_EXTENSIONS False )
set ( MSG_PRINT False )
set ( MU_RECEIVER False )
set ( NAS_ADDRESS_FIX False )
diff --git a/cmake_targets/autotests/test.0108/CMakeLists.txt b/cmake_targets/autotests/test.0108/CMakeLists.txt
index a0648e1767..63bfb1066f 100644
--- a/cmake_targets/autotests/test.0108/CMakeLists.txt
+++ b/cmake_targets/autotests/test.0108/CMakeLists.txt
@@ -8,7 +8,6 @@ set(ENABLE_FXP True)
set(ENABLE_ITTI True)
set(ENABLE_NAS_UE_LOGGING False)
set(ENABLE_NEW_MULTICAST True)
-set(ENABLE_PDCP_NETLINK_FIFO False)
set(ENABLE_PGM_TRANSPORT True)
set(ENABLE_RAL False)
set(ENABLE_SECURITY False)
@@ -18,7 +17,7 @@ set(ENABLE_VCD_FIFO True)
set(HARD_RT False)
set(JUMBO_FRAME True)
set(LARGE_SCALE False)
-set(LINK_PDCP_TO_GTPV1U False)
+set(LINK_ENB_PDCP_TO_GTPV1U False)
set(LINUX_LIST False)
set(LINUX True)
set(LOCALIZATION False)
@@ -26,7 +25,10 @@ set(LOG_NO_THREAD True)
set(LOWLATENCY False)
set(MAC_CONTEXT 1)
set(MAX_NUM_CCs 1)
-set(MIH_C_MEDIEVAL_EXTENSIONS True)
+set(MESSAGE_CHART_GENERATOR False)
+set(MESSAGE_CHART_GENERATOR_RLC_MAC False)
+set(MESSAGE_CHART_GENERATOR_PHY False)
+set(MIH_C_MEDIEVAL_EXTENSIONS False)
set(MSG_PRINT False)
set(MU_RECEIVER False)
set(NAS_ADDRESS_FIX true)
@@ -35,7 +37,6 @@ set(NAS_UE True)
set(NEW_FFT True)
set(NO_RRM True)
set(OAI_EMU True)
-set(OAI_EMU True)
set(OAI_NW_DRIVER_TYPE_ETHERNET False)
set(OPENAIR1 False)
set(OPENAIR2 True)
diff --git a/cmake_targets/autotests/test.0114/CMakeLists.txt b/cmake_targets/autotests/test.0114/CMakeLists.txt
index 1f85bc1042..23497976f1 100644
--- a/cmake_targets/autotests/test.0114/CMakeLists.txt
+++ b/cmake_targets/autotests/test.0114/CMakeLists.txt
@@ -8,9 +8,8 @@ set(ENABLE_FXP True)
set(ENABLE_ITTI True)
set(ENABLE_NAS_UE_LOGGING False)
set(ENABLE_NEW_MULTICAST True)
-set(ENABLE_PDCP_NETLINK_FIFO True)
set(ENABLE_PGM_TRANSPORT True)
-set(ENABLE_RAL True)
+set(ENABLE_RAL False)
set(ENABLE_SECURITY False)
set(ENABLE_USE_CPU_EXECUTION_TIME True)
set(ENABLE_USE_MME False)
@@ -18,7 +17,7 @@ set(ENABLE_VCD_FIFO True)
set(HARD_RT False)
set(JUMBO_FRAME True)
set(LARGE_SCALE False)
-set(LINK_PDCP_TO_GTPV1U False)
+set(LINK_ENB_PDCP_TO_GTPV1U False)
set(LINUX_LIST False)
set(LINUX True)
set(LOCALIZATION False)
@@ -26,7 +25,7 @@ set(LOG_NO_THREAD True)
set(LOWLATENCY False)
set(MAC_CONTEXT 1)
set(MAX_NUM_CCs 1)
-set(MIH_C_MEDIEVAL_EXTENSIONS True)
+set(MIH_C_MEDIEVAL_EXTENSIONS False)
set(MSG_PRINT False)
set(MU_RECEIVER False)
set(NAS_ADDRESS_FIX true)
diff --git a/cmake_targets/autotests/test.0115/CMakeLists.txt b/cmake_targets/autotests/test.0115/CMakeLists.txt
index 147c01f852..01c00574a4 100644
--- a/cmake_targets/autotests/test.0115/CMakeLists.txt
+++ b/cmake_targets/autotests/test.0115/CMakeLists.txt
@@ -10,17 +10,12 @@ set ( ENABLE_FXP True )
set ( ENABLE_ITTI True )
set ( ENABLE_NAS_UE_LOGGING False )
set ( ENABLE_NEW_MULTICAST True )
-set ( ENABLE_PDCP_NETLINK_FIFO False )
set ( ENABLE_PGM_TRANSPORT True )
-set ( ENABLE_RAL True )
+set ( ENABLE_RAL False )
set ( ENABLE_SECURITY False )
set ( ENABLE_STANDALONE_EPC False )
set ( ENABLE_USE_CPU_EXECUTION_TIME True )
-set ( ENABLE_USE_GTPU_IN_KERNEL False )
set ( ENABLE_USE_MME False )
-set ( ENABLE_USE_NETFILTER_FOR_SGI False )
-set ( ENABLE_USE_PCAP_FOR_SGI False )
-set ( ENABLE_USE_RAW_SOCKET_FOR_SGI False )
set ( ENABLE_VCD_FIFO True )
set ( ENB_MODE True )
set ( EPC_BUILD False )
@@ -29,7 +24,6 @@ set ( JUMBO_FRAME True )
set ( LARGE_SCALE False )
set ( LINK_ENB_PDCP_TO_GTPV1U False )
set ( LINK_ENB_PDCP_TO_IP_DRIVER False )
-set ( LINK_PDCP_TO_GTPV1U False )
set ( LINUX_LIST False )
set ( LINUX True )
set ( LOCALIZATION False )
@@ -37,7 +31,10 @@ set ( LOG_NO_THREAD True )
set ( LOWLATENCY False )
set ( MAC_CONTEXT 1 )
set ( MAX_NUM_CCs 1 )
-set ( MIH_C_MEDIEVAL_EXTENSIONS True )
+set ( MESSAGE_CHART_GENERATOR False )
+set ( MESSAGE_CHART_GENERATOR_RLC_MAC False )
+set ( MESSAGE_CHART_GENERATOR_PHY False )
+set ( MIH_C_MEDIEVAL_EXTENSIONS False )
set ( MSG_PRINT False )
set ( MU_RECEIVER False )
set ( NAS_ADDRESS_FIX False )
diff --git a/cmake_targets/autotests/test.0120/CMakeLists.txt b/cmake_targets/autotests/test.0120/CMakeLists.txt
index 37e9dc3791..d05856ebb0 100644
--- a/cmake_targets/autotests/test.0120/CMakeLists.txt
+++ b/cmake_targets/autotests/test.0120/CMakeLists.txt
@@ -10,17 +10,12 @@ set ( ENABLE_FXP True )
set ( ENABLE_ITTI False )
set ( ENABLE_NAS_UE_LOGGING False )
set ( ENABLE_NEW_MULTICAST True )
-set ( ENABLE_PDCP_NETLINK_FIFO False )
set ( ENABLE_PGM_TRANSPORT True )
set ( ENABLE_RAL False )
set ( ENABLE_SECURITY False )
set ( ENABLE_STANDALONE_EPC False )
set ( ENABLE_USE_CPU_EXECUTION_TIME True )
-set ( ENABLE_USE_GTPU_IN_KERNEL False )
set ( ENABLE_USE_MME False )
-set ( ENABLE_USE_NETFILTER_FOR_SGI False )
-set ( ENABLE_USE_PCAP_FOR_SGI False )
-set ( ENABLE_USE_RAW_SOCKET_FOR_SGI False )
set ( ENABLE_VCD_FIFO True )
set ( ENB_MODE True )
set ( EPC_BUILD False )
@@ -29,7 +24,6 @@ set ( JUMBO_FRAME True )
set ( LARGE_SCALE False )
set ( LINK_ENB_PDCP_TO_GTPV1U False )
set ( LINK_ENB_PDCP_TO_IP_DRIVER False )
-set ( LINK_PDCP_TO_GTPV1U False )
set ( LINUX_LIST False )
set ( LINUX True )
set ( LOCALIZATION False )
@@ -37,7 +31,10 @@ set ( LOG_NO_THREAD True )
set ( LOWLATENCY False )
set ( MAC_CONTEXT 1 )
set ( MAX_NUM_CCs 1 )
-set ( MIH_C_MEDIEVAL_EXTENSIONS True )
+set ( MESSAGE_CHART_GENERATOR False )
+set ( MESSAGE_CHART_GENERATOR_RLC_MAC False )
+set ( MESSAGE_CHART_GENERATOR_PHY False )
+set ( MIH_C_MEDIEVAL_EXTENSIONS False )
set ( MSG_PRINT False )
set ( MU_RECEIVER False )
set ( NAS_ADDRESS_FIX False )
diff --git a/cmake_targets/autotests/test.0130/CMakeLists.txt b/cmake_targets/autotests/test.0130/CMakeLists.txt
new file mode 100644
index 0000000000..45c99b01ab
--- /dev/null
+++ b/cmake_targets/autotests/test.0130/CMakeLists.txt
@@ -0,0 +1,6 @@
+cmake_minimum_required(VERSION 2.8)
+set(ENABLE_VCD_FIFO False )
+set(ENABLE_ITTI False )
+set(RF_BOARD "ETHERNET")
+set(PACKAGE_NAME "\"rrh_gw\"")
+include(${CMAKE_CURRENT_SOURCE_DIR}/../../CMakeLists.txt)
diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai
index 3119361c22..c1974f90e8 100755
--- a/cmake_targets/build_oai
+++ b/cmake_targets/build_oai
@@ -41,10 +41,12 @@ source $THIS_SCRIPT_PATH/tools/build_helper
MSC_GEN="False"
XFORMS="False"
+PRINT_STATS="False"
VCD_TIMING="False"
REL="Rel10"
HW="EXMIMO"
EPC=0
+VERBOSE_COMPILE=0
function print_help() {
echo_info '
@@ -74,14 +76,16 @@ Options
Makes the UE specific parts (ue_ip, usim, nvram)
--EPC
Makes the EPC (MME-SPGW, HSS)
+--RRH
+ Makes the RRH
-r | --3gpp-release
default is Rel10,
Rel8 limits the implementation to 3GPP Release 8 version
-w | --hardware
- EXMIMO (Default), USRP, BLADERF, None
+ EXMIMO (Default), USRP, BLADERF, ETHERNET, None
Adds this RF board support (in external packages installation and in compilation)
--oaisim
- Makes the oaisim simulator
+ Makes the oaisim simulator. Hardware will be defaulted to "NONE".
--phy_simulators
Makes the unitary tests Layer 1 simulators
--core_simulators
@@ -91,11 +95,22 @@ Options
-V | --vcd
Adds a debgging facility to the binary files: GUI with major internal synchronization events
-x | --xforms
- Adds a software oscilloscope feature to the produced binaries
+ Adds a software oscilloscope feature to the produced binaries. If oaisim, then enable PRINT_STATS.
--install-system-files
Install OpenArInterface required files in Linux system
(will ask root password)
-Typical Options for a quick startup with a COTS UE and Eurecom RF board: build_oai -I -g -eNB -EPC -x --install-system-files'
+--noS1
+ Compiles oaisim or lte-softmodem without S1 interface, using direct link to IP instead
+--verbose-compile
+ Shows detailed compilation instructions in makefile
+Usage (first build):
+ oaisim (eNB + UE): ./build_oai -I -g --oaisim -x --install-system-files
+ Eurecom EXMIMO + COTS UE : ./build_oai -I -g --eNB --EPC -x --install-system-files
+ NI/ETTUS B201 + COTS UE : ./build_oai -I -g --eNB --EPC -x --install-system-files -w USRP
+Usage (Regular):
+ oaisim : ./build_oai --oaisim -x
+ Eurecom EXMIMO + OAI ENB : ./build_oai --eNB -x
+ NI/ETTUS B201 + OAI ENB : ./build_oai --eNB -x -w USRP'
}
@@ -137,6 +152,10 @@ function main() {
EPC=1
echo_info "Will compile EPC"
shift;;
+ --RRH)
+ RRH=1
+ echo_info "Will compile RRH"
+ shift;;
-r | --3gpp-release)
REL=$2
echo_info "setting release to: $REL"
@@ -174,7 +193,7 @@ function main() {
EXE_ARGUMENTS="$EXE_ARGUMENTS -V"
shift;;
-x | --xforms)
- XFORMS=1
+ XFORMS="True"
EXE_ARGUMENTS="$EXE_ARGUMENTS -d"
echo_info "Will generate the software oscilloscope features"
shift;;
@@ -182,6 +201,14 @@ function main() {
INSTALL_SYSTEM_FILES=1
echo_info "Will copy OpenAirInterface files in Linux directories"
shift;;
+ --noS1)
+ NOS1=1
+ echo_info "Will compile without S1 interface"
+ shift;;
+ --verbose-compile)
+ VERBOSE_COMPILE=1
+ echo_info "Will compile with verbose instructions"
+ shift;;
-h | --help)
print_help
exit 1;;
@@ -243,37 +270,70 @@ function main() {
check_install_additional_tools
fi
+ if [ "$oaisim" = "1" ] ; then
+ if [ "$HW" != "ETHERNET" ] ; then
+ HW="NONE"
+ fi
+ if [ "$XFORMS" == "True" ] ; then
+ PRINT_STATS="True"
+ fi
+ fi
+
+
echo_info "3. building the compilation directives ..."
DIR=$OPENAIR_DIR/cmake_targets
+ if [ "$NOS1" = "1" ] ; then
+ lte_build_dir=lte_noS1_build_oai
+ lte_exec=lte-softmodem-nos1
+ else
+ lte_build_dir=lte_build_oai
+ lte_exec=lte-softmodem
+ fi
+ # first generate the CMakefile in the right directory
+ if [ "$eNB" = "1" -o "$UE" = "1" -o "$HW" = "EXMIMO" ] ; then
- if [ "$eNB" = "1" -o "$UE" = "1" ] ; then
# LTE softmodem compilation
- [ "$CLEAN" = "1" ] && rm -rf $DIR/lte_build_oai/build
- mkdir -p $DIR/lte_build_oai/build
- cmake_file=$DIR/lte_build_oai/CMakeLists.txt
- echo "cmake_minimum_required(VERSION 2.8)" > $cmake_file
- echo "set(XFORMS $XFORMS )" >> $cmake_file
- echo "set(RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file
- echo "set(ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file
- echo "set(RF_BOARD \"${HW}\")" >> $cmake_file
- echo 'set(PACKAGE_NAME "\"lte-softmodem\"")' >> $cmake_file
+ [ "$CLEAN" = "1" ] && rm -rf $DIR/$lte_build_dir/build
+ mkdir -p $DIR/$lte_build_dir/build
+ cmake_file=$DIR/$lte_build_dir/CMakeLists.txt
+ echo "cmake_minimum_required(VERSION 2.8)" > $cmake_file
+ if [ "$NOS1" = "1" ] ; then
+ cat $DIR/$lte_build_dir/CMakeLists.template >> $cmake_file
+ fi
+ echo "set ( XFORMS $XFORMS )" >> $cmake_file
+ echo "set ( RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file
+ echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file
+ echo "set ( RF_BOARD \"${HW}\")" >> $cmake_file
+ echo "set(PACKAGE_NAME \"${lte_exec}\")" >> $cmake_file
echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file
- cd $DIR/lte_build_oai/build
+ cd $DIR/$lte_build_dir/build
cmake ..
- echo_info "Compiling LTE softmodem"
- compilations \
- lte_build_oai lte-softmodem \
- lte-softmodem lte-softmodem.$REL
+ fi
+ if [ "$eNB" = "1" ] ; then
+ echo_info "Compiling $lte_exec"
+ compilations \
+ $lte_build_dir $lte_exec \
+ $lte_exec $dbin/$lte_exec.$REL
+
+ if [ "$NOS1" = "1" ] ; then
+ compilations \
+ $lte_build_dir nasmesh \
+ CMakeFiles/nasmesh/nasmesh.ko $dbin/nasmesh.ko
+ compilations \
+ $lte_build_dir rb_tool \
+ rb_tool $dbin/rb_tool
+ cp $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 $dbin
+ fi
fi
if [ "$UE" = 1 ] ; then
# ue_ip driver compilation
echo_info "Compiling UE specific part"
compilations \
- lte_build_oai ue_ip \
+ $lte_build_dir ue_ip \
CMakeFiles/ue_ip/ue_ip.ko $dbin/ue_ip.ko
# mkdir -p $DIR/at_commands/build
@@ -282,7 +342,7 @@ function main() {
# compilations \
# at_commands at_nas_ue \
# at_nas_ue $dbin/at_nas_ue
-
+
[ "$CLEAN" = "1" ] && rm -rf $DIR/nas_sim_tools/build
mkdir -p $DIR/nas_sim_tools/build
cd $DIR/nas_sim_tools/build
@@ -341,140 +401,165 @@ function main() {
if [ "$HW" = "EXMIMO" -a "$EPC" = "0" ] ; then
echo_info "Compiling Express MIMO 2 board drivers"
- mkdir -p $DIR/lte_noS1_build_oai/build
- cd $DIR/lte_noS1_build_oai/build
- cmake ..
compilations \
- lte_noS1_build_oai openair_rf \
+ $lte_build_dir openair_rf \
CMakeFiles/openair_rf/openair_rf.ko $dbin/openair_rf.ko
compilations \
- lte_noS1_build_oai updatefw \
+ $lte_build_dir updatefw \
updatefw $dbin/updatefw
- make -C $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build oarf > $dlog/oarf.txt 2>&1
- cp $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/*.oct $dbin
- echo_success "oarf tools compiled"
+ make -C $OPENAIR_DIR/cmake_targets/$lte_build_dir/build oarf > $dlog/oarf.txt 2>&1
+ cp $OPENAIR_DIR/cmake_targets/$lte_build_dir/build/*.oct $dbin
+ if [ -s $dbin/oarf_config_exmimo.oct ] ; then
+ echo_success "oarf tools compiled"
+ else
+ echo_error "oarf tools compilation failed"
+ fi
cp $OPENAIR_DIR/cmake_targets/tools/init_exmimo2 $dbin
fi
if [ "$oaisim" = "1" ] ; then
dconf=$OPENAIR_DIR/targets/bin
-
- echo_info "Compiling at_nas_ue"
- [ "$CLEAN" = "1" ] && rm -rf $DIR/at_commands/build
- mkdir -p $DIR/at_commands/build
- cd $DIR/at_commands/build
- cmake ..
- compilations \
- at_commands at_nas_ue \
- at_nas_ue $dbin/at_nas_ue
-
- echo_info "Compiling oaisim"
- cmake_file=$DIR/oaisim_build_oai/CMakeLists.txt
- cp $DIR/oaisim_build_oai/CMakeLists.template $cmake_file
- echo "set(XFORMS $XFORMS )" >> $cmake_file
- echo "set(RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file
- echo "set(ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file
+ if [ "$NOS1" = "1" ] ; then
+ oaisim_build_dir=oaisim_noS1_build_oai
+ oaisim_exec=oaisim_nos1
+ else
+ oaisim_build_dir=oaisim_build_oai
+ oaisim_exec=oaisim
+ fi
+
+ echo_info "Compiling $oaisim_exec ($oaisim_build_dir)"
+ cmake_file=$DIR/$oaisim_build_dir/CMakeLists.txt
+ cp $DIR/$oaisim_build_dir/CMakeLists.template $cmake_file
+ echo "set ( XFORMS $XFORMS )" >> $cmake_file
+ echo "set ( PRINT_STATS $PRINT_STATS )" >> $cmake_file
+ echo "set ( RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file
+ echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file
echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file
- [ "$CLEAN" = "1" ] && rm -rf $DIR/oaisim_build_oai/build
- mkdir -p $DIR/oaisim_build_oai/build
- cd $DIR/oaisim_build_oai/build
+ [ "$CLEAN" = "1" ] && rm -rf $DIR/$oaisim_build_dir/build
+ mkdir -p $DIR/$oaisim_build_dir/build
+ cd $DIR/$oaisim_build_dir/build
cmake ..
compilations \
- oaisim_build_oai oaisim \
- oaisim $dbin/oaisim.$REL
+ $oaisim_build_dir $oaisim_exec \
+ $oaisim_exec $dbin/$oaisim_exec.$REL
- # ue_ip driver compilation
- echo_info "Compiling UE specific part (ue_ip driver and usim tools)"
- compilations \
- oaisim_build_oai ue_ip \
- CMakeFiles/ue_ip/ue_ip.ko $dbin/ue_ip.ko
+ if [ "$NOS1" != "1" ] ; then
- [ "$CLEAN" = "1" ] && rm -rf $DIR/nas_sim_tools/build
- mkdir -p $DIR/nas_sim_tools/build
- cd $DIR/nas_sim_tools/build
- cmake ..
- compilations \
- nas_sim_tools usim \
- usim $dbin/usim
- compilations \
- nas_sim_tools nvram \
- nvram $dbin/nvram
+ [ "$CLEAN" = "1" ] && rm -rf $DIR/at_commands/build
+ echo_info "Compiling at_nas_ue"
+ mkdir -p $DIR/at_commands/build
+ cd $DIR/at_commands/build
+ cmake ..
+ compilations \
+ at_commands at_nas_ue \
+ at_nas_ue $dbin/at_nas_ue
- # generate USIM data
- if [ -f $dbin/nvram ]; then
- install_nas_tools $dbin $dconf
+ # ue_ip driver compilation
+ echo_info "Compiling UE specific part (ue_ip driver and usim tools)"
+ compilations \
+ oaisim_build_oai ue_ip \
+ CMakeFiles/ue_ip/ue_ip.ko $dbin/ue_ip.ko
+
+ [ "$CLEAN" = "1" ] && rm -rf $DIR/nas_sim_tools/build
+ mkdir -p $DIR/nas_sim_tools/build
+ cd $DIR/nas_sim_tools/build
+ cmake ..
+ compilations \
+ nas_sim_tools usim \
+ usim $dbin/usim
+ compilations \
+ nas_sim_tools nvram \
+ nvram $dbin/nvram
+
+ # generate USIM data
+ if [ -f $dbin/nvram ]; then
+ install_nas_tools $dbin $dconf
+ else
+ echo_warning "not generated UE NAS files: binaries not found"
+ fi
else
- echo_warning "not generated UE NAS files: binaries not found"
+
+ compilations \
+ $oaisim_build_dir rb_tool \
+ rb_tool $dbin/rb_tool
+
+ # nasmesh driver compilation
+ compilations \
+ $oaisim_build_dir nasmesh \
+ CMakeFiles/nasmesh/nasmesh.ko $dbin/nasmesh.ko
+
+ #oai_nw_drv
+ compilations \
+ $oaisim_build_dir oai_nw_drv \
+ CMakeFiles/oai_nw_drv/oai_nw_drv.ko $dbin/oai_nw_drv.ko
fi
- echo_info "Compiling oaisim_nos1"
- cmake_file=$DIR/oaisim_noS1_build_oai/CMakeLists.txt
- cp $DIR/oaisim_noS1_build_oai/CMakeLists.template $cmake_file
- echo "set(XFORMS $XFORMS )" >> $cmake_file
- echo "set(RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file
- echo "set(ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file
- echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file
- [ "$CLEAN" = "1" ] && rm -rf $DIR/oaisim_noS1_build_oai/build
- mkdir -p $DIR/oaisim_noS1_build_oai/build
- cd $DIR/oaisim_noS1_build_oai/build
- cmake ..
- compilations \
- oaisim_noS1_build_oai oaisim_nos1 \
- oaisim_nos1 $dbin/oaisim_nos1.$REL
-
- compilations \
- oaisim_noS1_build_oai rb_tool \
- rb_tool $dbin/rb_tool
-
- # nasmesh driver compilation
- compilations \
- oaisim_noS1_build_oai nasmesh \
- CMakeFiles/nasmesh/nasmesh.ko $dbin/nasmesh.ko
- #oai_nw_drv
- compilations \
- oaisim_noS1_build_oai oai_nw_drv \
- CMakeFiles/oai_nw_drv/oai_nw_drv.ko $dbin/oai_nw_drv.ko
-
cmake_file=$DIR/oaisim_mme_build_oai/CMakeLists.txt
cp $DIR/oaisim_mme_build_oai/CMakeLists.template $cmake_file
echo "set(XFORMS $XFORMS )" >> $cmake_file
echo "set(RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file
echo "set(ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file
echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file
- [ "$CLEAN" = "1" ] && rm -rf $DIR/oaisim_mme_build_oai/build
- mkdir -p $DIR/oaisim_mme_build_oai/build
- cd $DIR/oaisim_mme_build_oai/build
+ #[ "$CLEAN" = "1" ] && rm -rf $DIR/oaisim_mme_build_oai/build
+ #mkdir -p $DIR/oaisim_mme_build_oai/build
+ #cd $DIR/oaisim_mme_build_oai/build
+ #cmake ..
+ #compilations \
+ # oaisim_mme_build_oai oaisim_mme \
+ # oaisim_mme $dbin/oaisim_mme.$REL
+ fi
+
+ # RRH compilation
+ ##################
+ if [ "$RRH" = "1" ] ; then
+ echo_info "Compiling RRH"
+ if [ $HW == "ETHERNET" ] ; then
+ echo_info "RF frontend for RRH is not defined. This mode is used for testing (loopback)."
+ elif [ $HW != "EXMIMO" -a $HW != "OAI_USRP" -a $HW != "OAI_BLADERF" ] ; then
+ echo_fatal "Hardware not defined ($HW)"
+ fi
+ cmake_file=$DIR/rrh_gw/CMakeLists.txt
+ echo "cmake_minimum_required(VERSION 2.8)" > $cmake_file
+ echo "set(ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file
+ echo "set(ENABLE_ITTI False )" >> $cmake_file
+ echo "set(RF_BOARD \"${HW}\")" >> $cmake_file
+ echo 'set(PACKAGE_NAME "\"rrh_gw\"")' >> $cmake_file
+ echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file
+
+ [ "$CLEAN" = "1" ] && rm -rf $DIR/rrh_gw/build
+ mkdir -p $DIR/rrh_gw/build
+ cd $DIR/rrh_gw/build
cmake ..
compilations \
- oaisim_mme_build_oai oaisim_mme \
- oaisim_mme $dbin/oaisim_mme.$REL
+ rrh_gw rrh_gw \
+ rrh_gw $dbin/rrh_gw
fi
# EPC compilation
##################
if [ "$EPC" = "1" ] ; then
- echo_info "Compiling EPC"
- # Example HSS and EPC run on the same host
- if [ "$CLEAN" = "1" ]; then
- $OPENAIR_DIR/cmake_targets/tools/build_epc --clean --debug --transport-tcp-only --transport-prefer-tcp --s6a-server
- $OPENAIR_DIR/cmake_targets/tools/build_hss --clean --debug --transport-tcp-only --transport-prefer-tcp --fqdn `hostname --fqdn` --connect-to-mme `hostname --fqdn`
- else
- $OPENAIR_DIR/cmake_targets/tools/build_epc --debug --transport-tcp-only --transport-prefer-tcp --s6a-server
- $OPENAIR_DIR/cmake_targets/tools/build_hss --debug --transport-tcp-only --transport-prefer-tcp --fqdn `hostname --fqdn` --connect-to-mme `hostname --fqdn`
- fi
-
-# if [ "$INSTALL_SYSTEM_FILES" = "1" ] ;then
-# if [ -f $dbin/hss.conf ] ; then
-# sed -e 's/ *= */=/' $dbin/hss.conf > $dconf/hss.conf.nospace
-# source $dconf/hss.conf.nospace
-# rm -f $dconf/hss.conf.nospace
-# create_hss_database root linux "$MYSQL_user" "$MYSQL_pass" "$MYSQL_db"
-# else
-# echo_warning "not created HSS database: config not found"
-# fi
-# fi
-fi
-
+ echo_info "Compiling EPC"
+ # Example HSS and EPC run on the same host
+ if [ "$CLEAN" = "1" ]; then
+ $OPENAIR_DIR/cmake_targets/tools/build_epc --clean --debug --transport-tcp-only --transport-prefer-tcp --s6a-server
+ $OPENAIR_DIR/cmake_targets/tools/build_hss --clean --debug --transport-tcp-only --transport-prefer-tcp --fqdn `hostname --fqdn` --connect-to-mme `hostname --fqdn`
+ else
+ $OPENAIR_DIR/cmake_targets/tools/build_epc --debug --transport-tcp-only --transport-prefer-tcp --s6a-server
+ $OPENAIR_DIR/cmake_targets/tools/build_hss --debug --transport-tcp-only --transport-prefer-tcp --fqdn `hostname --fqdn` --connect-to-mme `hostname --fqdn`
+ fi
+
+ # if [ "$INSTALL_SYSTEM_FILES" = "1" ] ;then
+ # if [ -f $dbin/hss.conf ] ; then
+ # sed -e 's/ *= */=/' $dbin/hss.conf > $dconf/hss.conf.nospace
+ # source $dconf/hss.conf.nospace
+ # rm -f $dconf/hss.conf.nospace
+ # create_hss_database root linux "$MYSQL_user" "$MYSQL_pass" "$MYSQL_db"
+ # else
+ # echo_warning "not created HSS database: config not found"
+ # fi
+ # fi
+ fi
+
# Auto-tests
#####################
if [ "$OAI_TEST" = "1" ]; then
diff --git a/cmake_targets/doxygen/CMakeLists.txt b/cmake_targets/doxygen/CMakeLists.txt
new file mode 100644
index 0000000000..8823f48cb6
--- /dev/null
+++ b/cmake_targets/doxygen/CMakeLists.txt
@@ -0,0 +1,11 @@
+cmake_minimum_required(VERSION 2.8)
+include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)
+find_package(Doxygen)
+if(DOXYGEN_FOUND)
+configure_file(${OPENAIR_TARGETS}/DOCS/Doxyfile ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
+add_custom_target(doc
+${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
+WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+COMMENT "Generating API documentation with Doxygen" VERBATIM
+)
+endif(DOXYGEN_FOUND)
diff --git a/cmake_targets/epc_build_oai/CMakeLists.template b/cmake_targets/epc_build_oai/CMakeLists.template
index b93370b503..da80f6d4d2 100644
--- a/cmake_targets/epc_build_oai/CMakeLists.template
+++ b/cmake_targets/epc_build_oai/CMakeLists.template
@@ -12,13 +12,11 @@ set ( ENABLE_FXP False )
set ( ENABLE_ITTI True )
set ( ENABLE_NAS_UE_LOGGING False )
set ( ENABLE_NEW_MULTICAST False )
-set ( ENABLE_PDCP_NETLINK_FIFO False )
set ( ENABLE_PGM_TRANSPORT False )
set ( ENABLE_RAL False )
set ( ENABLE_SECURITY False )
set ( ENABLE_STANDALONE_EPC True )
set ( ENABLE_USE_CPU_EXECUTION_TIME False )
-set ( ENABLE_USE_GTPU_IN_KERNEL True )
set ( ENABLE_USE_MME False )
set ( ENABLE_VCD_FIFO False )
set ( ENB_MODE False )
@@ -28,7 +26,7 @@ set ( FLAG_GTPV1U_KERNEL_THREAD_SOCK_NO_WAIT False)
set ( HARD_RT False )
set ( JUMBO_FRAME False )
set ( LARGE_SCALE False )
-set ( LINK_PDCP_TO_GTPV1U False )
+set ( LINK_ENB_PDCP_TO_GTPV1U False )
set ( LINUX_LIST False )
set ( LINUX False )
set ( LOCALIZATION False )
diff --git a/cmake_targets/lte-simulators/CMakeLists.txt b/cmake_targets/lte-simulators/CMakeLists.txt
index 7e38c9d594..50a473dd4b 100644
--- a/cmake_targets/lte-simulators/CMakeLists.txt
+++ b/cmake_targets/lte-simulators/CMakeLists.txt
@@ -10,5 +10,6 @@ set(RANDOM_BF False)
set(PBS_SIM False)
set(PERFECT_CE False)
set(NAS_UE False)
+set(MESSAGE_CHART_GENERATOR False)
include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)
diff --git a/cmake_targets/lte_noS1_build_oai/CMakeLists.template b/cmake_targets/lte_noS1_build_oai/CMakeLists.template
new file mode 100644
index 0000000000..c8fc68da52
--- /dev/null
+++ b/cmake_targets/lte_noS1_build_oai/CMakeLists.template
@@ -0,0 +1,9 @@
+set(ENABLE_ITTI True)
+set(ENABLE_USE_MME False)
+set(PDCP_USE_NETLINK True)
+set(LINK_ENB_PDCP_TO_IP_DRIVER True)
+set(LINK_ENB_PDCP_TO_GTPV1U False)
+set(PDCP_USE_NETLINK_QUEUES False)
+set(LINUX True)
+set(SECU False)
+set(NAS_UE False)
diff --git a/cmake_targets/lte_noS1_build_oai/CMakeLists.txt b/cmake_targets/lte_noS1_build_oai/CMakeLists.txt
deleted file mode 100644
index 19c684d31b..0000000000
--- a/cmake_targets/lte_noS1_build_oai/CMakeLists.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-cmake_minimum_required(VERSION 2.8)
-set(XFORMS 1 )
-set(RRC_ASN1_VERSION "Rel10")
-set(ENABLE_VCD_FIFO False )
-set(RF_BOARD "EXMIMO")
-set(NAS 1)
-set(ENABLE_ITTI False)
-set(ENABLE_USE_MME False)
-set(LINK_ENB_PDCP_TO_GTPV1U False)
-set(SECU False)
-set(NAS_UE False)
-set(PACKAGE_NAME "\"lte-softmodem\"")
-include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)
diff --git a/cmake_targets/nas_sim_tools/CMakeLists.txt b/cmake_targets/nas_sim_tools/CMakeLists.txt
index 99a6990ae7..1894ba6697 100644
--- a/cmake_targets/nas_sim_tools/CMakeLists.txt
+++ b/cmake_targets/nas_sim_tools/CMakeLists.txt
@@ -20,30 +20,30 @@ set(OPENAIR_TARGETS $ENV{OPENAIR_DIR}/targets)
# Add .h files for dependancies
set(usim_SRC
- ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/tools/usim_data.c
- ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/src/api/usim/usim_api.c
- ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/src/api/usim/aka_functions.c
- ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/src/util/memory.c
- ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/src/util/nas_log.c
- ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/src/util/OctetString.c
- ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/src/util/TLVEncoder.c
+ ${OPENAIR_DIR}/openair-cn/NAS/TOOLS/usim_data.c
+ ${OPENAIR_DIR}/openair-cn/NAS/UE/API/USIM/usim_api.c
+ ${OPENAIR_DIR}/openair-cn/NAS/UE/API/USIM/aka_functions.c
+ ${OPENAIR_DIR}/openair-cn/NAS/COMMON/UTIL/memory.c
+ ${OPENAIR_DIR}/openair-cn/NAS/COMMON/UTIL/nas_log.c
+ ${OPENAIR_DIR}/openair-cn/NAS/COMMON/UTIL/OctetString.c
+ ${OPENAIR_DIR}/openair-cn/NAS/COMMON/UTIL/TLVEncoder.c
)
set(usim_HDR
- ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/tools/network.h
- ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/src/api/usim/usim_api.h
- ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/src/api/usim/aka_functions.h
- ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/src/util/memory.h
- ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/src/util/nas_log.h
- ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/src/util/OctetString.h
- ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/src/util/TLVEncoder.h
+ ${OPENAIR_DIR}/openair-cn/NAS/TOOLS/network.h
+ ${OPENAIR_DIR}/openair-cn/NAS/UE/API/USIM/usim_api.h
+ ${OPENAIR_DIR}/openair-cn/NAS/UE/API/USIM/aka_functions.h
+ ${OPENAIR_DIR}/openair-cn/NAS/COMMON/UTIL/memory.h
+ ${OPENAIR_DIR}/openair-cn/NAS/COMMON/UTIL/nas_log.h
+ ${OPENAIR_DIR}/openair-cn/NAS/COMMON/UTIL/OctetString.h
+ ${OPENAIR_DIR}/openair-cn/NAS/COMMON/UTIL/TLVEncoder.h
)
include_directories(
- ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/src/include
- ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/src/api/usim
- ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/src/emm/
- ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/src/esm/
- ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/src/ies/
- ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/src/util
+ ${OPENAIR_DIR}/openair-cn/NAS/COMMON
+ ${OPENAIR_DIR}/openair-cn/NAS/UE/API/USIM
+ ${OPENAIR_DIR}/openair-cn/NAS/UE/EMM/
+ ${OPENAIR_DIR}/openair-cn/NAS/UE/ESM/
+ ${OPENAIR_DIR}/openair-cn/NAS/COMMON/IES/
+ ${OPENAIR_DIR}/openair-cn/NAS/COMMON/UTIL
)
ADD_EXECUTABLE(usim ${usim_SRC} ${usim_HDR})
@@ -51,15 +51,15 @@ ADD_EXECUTABLE(usim ${usim_SRC} ${usim_HDR})
set(nvram_SRC
- ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/tools/ue_data.c
- ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/src/util/memory.c
- ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/src/util/nas_log.c
+ ${OPENAIR_DIR}/openair-cn/NAS/TOOLS/ue_data.c
+ ${OPENAIR_DIR}/openair-cn/NAS/COMMON/UTIL/memory.c
+ ${OPENAIR_DIR}/openair-cn/NAS/COMMON/UTIL/nas_log.c
)
set(nvram_HDR
- ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/src/emm/emmData.h
- ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/src/util/memory.h
- ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/src/include/userDef.h
+ ${OPENAIR_DIR}/openair-cn/NAS/UE/EMM/emmData.h
+ ${OPENAIR_DIR}/openair-cn/NAS/COMMON/UTIL/memory.h
+ ${OPENAIR_DIR}/openair-cn/NAS/COMMON/userDef.h
)
ADD_EXECUTABLE(nvram ${nvram_SRC} ${nvram_HDR})
diff --git a/cmake_targets/oaisim_build_oai/CMakeLists.template b/cmake_targets/oaisim_build_oai/CMakeLists.template
index 7b5de3093f..76564d8fdd 100644
--- a/cmake_targets/oaisim_build_oai/CMakeLists.template
+++ b/cmake_targets/oaisim_build_oai/CMakeLists.template
@@ -10,7 +10,6 @@ set ( ENABLE_FXP True )
set ( ENABLE_ITTI True )
set ( ENABLE_NAS_UE_LOGGING True )
set ( ENABLE_NEW_MULTICAST True )
-set ( ENABLE_PDCP_NETLINK_FIFO False )
set ( ENABLE_PGM_TRANSPORT True )
set ( ENABLE_RAL False )
set ( ENABLE_SECURITY True )
@@ -79,4 +78,3 @@ set ( USE_3GPP_ADDR_AS_LINK_ADDR False )
set ( USE_MME "R10" )
set ( USER_MODE True )
set ( XER_PRINT False )
-set ( XFORMS False )
diff --git a/cmake_targets/oaisim_mme_build_oai/CMakeLists.template b/cmake_targets/oaisim_mme_build_oai/CMakeLists.template
index dcac0c4f97..1035a28599 100644
--- a/cmake_targets/oaisim_mme_build_oai/CMakeLists.template
+++ b/cmake_targets/oaisim_mme_build_oai/CMakeLists.template
@@ -10,13 +10,11 @@ set ( ENABLE_FXP False )
set ( ENABLE_ITTI True )
set ( ENABLE_NAS_UE_LOGGING False )
set ( ENABLE_NEW_MULTICAST False )
-set ( ENABLE_PDCP_NETLINK_FIFO False )
set ( ENABLE_PGM_TRANSPORT False )
set ( ENABLE_RAL False )
set ( ENABLE_SECURITY False )
set ( ENABLE_STANDALONE_EPC False )
set ( ENABLE_USE_CPU_EXECUTION_TIME False )
-set ( ENABLE_USE_GTPU_IN_KERNEL True )
set ( ENABLE_USE_MME False )
set ( ENABLE_USE_RAW_SOCKET_FOR_SGI True)
set ( ENABLE_VCD_FIFO False )
diff --git a/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template b/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template
index 67bb68d54b..a905510150 100644
--- a/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template
+++ b/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template
@@ -10,7 +10,6 @@ set ( ENABLE_FXP True )
set ( ENABLE_ITTI True )
set ( ENABLE_NAS_UE_LOGGING False )
set ( ENABLE_NEW_MULTICAST True )
-set ( ENABLE_PDCP_NETLINK_FIFO False )
set ( ENABLE_PGM_TRANSPORT True )
set ( ENABLE_RAL False )
set ( ENABLE_SECURITY False )
@@ -32,9 +31,9 @@ set ( LOG_NO_THREAD 1 )
set ( LOWLATENCY False )
set ( MAC_CONTEXT 1 )
set ( MAX_NUM_CCs 1 )
-set ( MESSAGE_CHART_GENERATOR True )
-set ( MESSAGE_CHART_GENERATOR_RLC_MAC True )
-set ( MESSAGE_CHART_GENERATOR_PHY True )
+set ( MESSAGE_CHART_GENERATOR False )
+set ( MESSAGE_CHART_GENERATOR_RLC_MAC False )
+set ( MESSAGE_CHART_GENERATOR_PHY False )
set ( MIH_C_MEDIEVAL_EXTENSIONS False )
set ( MSG_PRINT False )
set ( MU_RECEIVER False )
@@ -81,4 +80,6 @@ set ( USE_3GPP_ADDR_AS_LINK_ADDR False )
set ( USE_MME "R10" )
set ( USER_MODE True )
set ( XER_PRINT False )
-set ( XFORMS False )
+set ( DEBUG_PHY False )
+set ( DEBUG_PHY_PROC False)
+set ( DEBUG_DLSCH False)
diff --git a/cmake_targets/rrh_gw/CMakeLists.txt b/cmake_targets/rrh_gw/CMakeLists.txt
new file mode 100644
index 0000000000..9ff1437f0c
--- /dev/null
+++ b/cmake_targets/rrh_gw/CMakeLists.txt
@@ -0,0 +1,6 @@
+cmake_minimum_required(VERSION 2.8)
+set(ENABLE_VCD_FIFO False )
+set(ENABLE_ITTI False )
+set(RF_BOARD "ETHERNET")
+set(PACKAGE_NAME "\"rrh_gw\"")
+include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)
diff --git a/cmake_targets/tools/asn1tostruct.py b/cmake_targets/tools/asn1tostruct.py
new file mode 100644
index 0000000000..c298e8ae87
--- /dev/null
+++ b/cmake_targets/tools/asn1tostruct.py
@@ -0,0 +1,706 @@
+import re, os, sys, string
+import datetime
+import getopt
+import getpass
+
+version = "1.0.2"
+
+lines = ""
+iesDefs = {}
+ieofielist = {}
+outdir = './'
+
+filenames = []
+verbosity = 0
+prefix = ""
+
+FAIL = '\033[91m'
+WARN = '\033[93m'
+ENDC = '\033[0m'
+
+fileprefix = ""
+fileprefix_first_upper = ""
+
+def printFail(string):
+ sys.stderr.write(FAIL + string + ENDC + "\n")
+
+def printWarning(string):
+ print WARN + string + ENDC
+
+def printDebug(string):
+ if verbosity > 0:
+ print string
+
+def outputHeaderToFile(f, filename):
+ now = datetime.datetime.now()
+ f.write("""/*******************************************************************************
+
+ Eurecom OpenAirInterface
+ Copyright(c) 1999 - 2013 Eurecom
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms and conditions of the GNU General Public License,
+ version 2, as published by the Free Software Foundation.
+
+ This program is distributed in the hope 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
+ this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
+
+ The full GNU General Public License is included in this distribution in
+ the file called "COPYING".
+
+ Contact Information
+ Openair Admin: openair_admin@eurecom.fr
+ Openair Tech : openair_tech@eurecom.fr
+ Forums : http://forums.eurecom.fr/openairinterface
+ Address : EURECOM, Campus SophiaTech, 450 Route des Chappes
+ 06410 Biot FRANCE
+
+*******************************************************************************/
+
+""")
+ f.write("/*******************************************************************************\n")
+ f.write(" * This file had been created by asn1tostruct.py script v%s\n" % (version))
+ f.write(" * Please do not modify this file but regenerate it via script.\n")
+ f.write(" * Created on: %s by %s\n * from %s\n" % (str(now), getpass.getuser(), filenames))
+ f.write(" ******************************************************************************/\n")
+
+def lowerFirstCamelWord(word):
+ """ puts the first word in a CamelCase Word in lowercase.
+
+ I.e. CustomerID becomes customerID, XMLInfoTest becomes xmlInfoTest
+ """
+ newstr = ''
+ swapped = word.swapcase()
+ idx = 0
+
+ # if it's all-caps, return an all-lowered version
+ lowered = word.lower()
+
+ if swapped == lowered:
+ return lowered
+
+ for c in swapped:
+ if c in string.lowercase:
+ newstr += c
+ idx += 1
+ else:
+ break
+ if idx < 2:
+ newstr += word[idx:]
+ else:
+ newstr = newstr[:-1]+ word[idx-1:]
+
+ return newstr
+
+def usage():
+ print "Python parser for asn1 v%s" % (version)
+ print "Usage: python asn1tostruct.py [options]"
+ print "Available options:"
+ print "-d Enable script debug"
+ print "-f [file] Input file to parse"
+ print "-o [dir] Output files to given directory"
+ print "-h Print this help and return"
+
+try:
+ opts, args = getopt.getopt(sys.argv[1:], "df:ho:", ["debug", "file", "help", "outdir"])
+except getopt.GetoptError as err:
+ # print help information and exit:
+ usage()
+ sys.exit(2)
+
+for o, a in opts:
+ if o in ("-f", "--file"):
+ filenames.append(a)
+ if o in ("-d", "--debug"):
+ verbosity = 1
+ if o in ("-o", "--outdir"):
+ outdir = a
+ if outdir.rfind('/') != len(outdir):
+ outdir += '/'
+ if o in ("-h", "--help"):
+ usage()
+ sys.exit(2)
+
+for filename in filenames:
+ file = open(filename, 'r')
+ for line in file:
+ # Removing any comment
+ if line.find('--') >= 0:
+ line = line[:line.find('--')]
+ # Removing any carriage return
+ lines += re.sub('\r', '', line)
+
+ for m in re.findall(r'([a-zA-Z0-9-]+)\s*::=\s+SEQUENCE\s+\(\s*SIZE\s*\(\s*\d+\s*\.\.\s*[0-9a-zA-Z-]+\s*\)\s*\)\s*OF\s+[a-zA-Z-]+\s*\{\s*\{\s*([0-9a-zA-Z-]+)\s*\}\s*\}', lines, re.MULTILINE):
+ ieofielist[m[0]] = m[1]
+ for m in re.findall(r'([a-zA-Z0-9-]+)\s*::=\s+E-RAB-IE-ContainerList\s*\{\s*\{\s*([a-zA-Z0-9-]+)\s*\}\s*\}', lines, re.MULTILINE):
+ ieofielist[m[0]] = m[1]
+
+ for i in re.findall(r'([a-zA-Z0-9-]+)\s+([A-Z0-9-]+)\s*::=\s*\{\s+([\,\|\{\}\t\n\.{3}\ \-a-zA-Z0-9]+)\s+}\n', lines, re.MULTILINE):
+ ies = []
+ maxLength = 0
+ # TODO: handle extensions
+ if i[1].find('EXTENSION') >= 0:
+ continue
+ if fileprefix == "":
+ fileprefix = i[1][:i[1].find('-')].lower()
+ for j in re.findall(r'\s*\{\s*([a-zA-Z0-9-\ \t]+)\s*\}\s*[\|,]*', i[2], re.MULTILINE):
+ for k in re.findall(r'ID\s*([a-zA-Z0-9\-]+)\s*CRITICALITY\s*([a-zA-Z0-9\-]+)\s+[A-Z]+\s+([a-zA-Z0-9\-]+)\s*PRESENCE\s*([a-zA-Z0-9\-]+)', j, re.MULTILINE):
+ printDebug("Got new ie for message " + i[0] + ": " + str(k))
+ if len(k[2]) > maxLength:
+ maxLength = len(k[2])
+ ies.append(k)
+
+ if len(ies) > 0:
+ iesDefs[i[0]] = { "length": maxLength, "ies": ies }
+ else:
+ printWarning("Didn't find any information element for message: " + i[0])
+
+if len(iesDefs) == 0:
+ printFail("No Information Element parsed, exiting")
+ sys.exit(0)
+
+fileprefix_first_upper = fileprefix[0].upper() + fileprefix[1:]
+
+f = open(outdir + fileprefix + '_ies_defs.h', 'w')
+outputHeaderToFile(f, filename)
+f.write("#include \"%s_common.h\"\n\n" % (fileprefix))
+f.write("#ifndef %s_IES_DEFS_H_\n#define %s_IES_DEFS_H_\n\n" % (fileprefix.upper(), fileprefix.upper()))
+f.write("/* Define the version of script used to generate this file */\n")
+f.write("#define %s_SCRIPT_VERSION (%s)\n\n" % (fileprefix.upper(), re.sub('\.', '', version)))
+
+for key in iesDefs:
+
+ if key not in ieofielist.values():
+ continue
+
+ for (i, j) in ieofielist.items():
+ if j == key:
+ break
+
+ f.write("typedef struct %sIEs_s {\n" % (re.sub('-', '_', i)))
+ f.write(" A_SEQUENCE_OF(struct %s_s) %s;\n" % (re.sub('IEs', '', re.sub('-', '_', ieofielist[i])), lowerFirstCamelWord(re.sub('IEs', '', re.sub('-', '_', ieofielist[i])))))
+ f.write("} %sIEs_t;\n\n" % (re.sub('-', '_', i)))
+
+for key in iesDefs:
+ keyupperunderscore = re.sub('-', '_', key.upper())
+ keylowerunderscore = re.sub('-', '_', key.lower())
+ shift = 0
+
+ if len(iesDefs[key]["ies"]) == 0:
+ continue
+
+ # Presence mask
+ for ie in iesDefs[key]["ies"]:
+ ieupperunderscore = re.sub('-', '_', re.sub('id-', '', ie[0])).upper()
+
+ if ie[3] == "optional" or ie[3] == "conditional":
+ f.write("#define {0:<{pad}} {1}\n".format("%s_%s_PRESENT" % (keyupperunderscore, ieupperunderscore), "(1 << %d)" % shift,
+ pad=iesDefs[key]["length"] + len(keyupperunderscore) + 9))
+ shift += 1
+ if (shift > 0):
+ f.write("\n")
+
+ f.write("typedef struct %s_s {\n" % (re.sub('-', '_', key)))
+ if (shift > 0):
+ f.write(" {0:<{pad}} {1};\n".format("uint16_t", "presenceMask", pad=iesDefs[key]["length"] + 2))
+ for ie in iesDefs[key]["ies"]:
+ ieunderscore = re.sub('-', '_', ie[2])
+ iename = re.sub('id-', '', ie[0])
+ ienameunderscore = lowerFirstCamelWord(re.sub('-', '_', iename))
+ if ie[2] in ieofielist:
+ f.write(" %sIEs_t %s;" % (re.sub('-', '_', ie[2]), ienameunderscore))
+ else:
+ f.write(" {0:<{pad}} {1};".format("%s_t" % ieunderscore, ienameunderscore, pad=iesDefs[key]["length"] + 2))
+ if ie[3] == "optional":
+ f.write(" ///< Optional field")
+ elif ie[3] == "conditional":
+ f.write(" ///< Conditional field")
+ f.write("\n")
+
+ f.write("} %s_t;\n\n" % (re.sub('-', '_', key)))
+
+f.write("typedef struct %s_message_s {\n" % (fileprefix))
+f.write(" %s_ProcedureCode_t procedureCode;\n" % (fileprefix_first_upper))
+f.write(" %s_Criticality_t criticality;\n" % (fileprefix_first_upper))
+f.write(" uint8_t direction;\n")
+f.write(" union {\n")
+
+messageList = iesDefs.keys()
+messageList.sort()
+for message in messageList:
+ if message in ieofielist.values():
+ continue
+ if len(iesDefs[message]["ies"]) == 0:
+ continue
+ f.write(" %s_t %s;\n" % (re.sub('-', '_', message), lowerFirstCamelWord(re.sub('-', '_', message))))
+f.write(" } msg;\n")
+f.write("} %s_message;\n\n" % (fileprefix))
+
+for key in iesDefs:
+ if key in ieofielist.values():
+ continue
+ structName = re.sub('ies', '', key)
+ asn1cStruct = re.sub('-', '_', re.sub('IEs', '', re.sub('-IEs', '', key)))
+ asn1cStruct = re.sub('Item', 'List', asn1cStruct)
+ keylowerunderscore = re.sub('-', '_', key.lower())
+ firstlower = re.sub('Item', 'List', re.sub('enb', 'eNB', lowerFirstCamelWord(asn1cStruct)))
+ f.write("/** \\brief Decode function for %s ies.\n" % (key))
+ if len(iesDefs[key]["ies"]) != 0:
+ f.write(" * \\param %s Pointer to ASN1 structure in which data will be stored\n" % (lowerFirstCamelWord(re.sub('-', '_', key))))
+ f.write(" * \\param any_p Pointer to the ANY value to decode.\n")
+ f.write(" **/\n")
+ f.write("int %s_decode_%s(\n" % (fileprefix, keylowerunderscore))
+
+ if len(iesDefs[key]["ies"]) != 0:
+ f.write(" %s_t *%s,\n" % (re.sub('-', '_', key), lowerFirstCamelWord(re.sub('-', '_', key))))
+ f.write(" ANY_t *any_p);\n\n")
+
+ if len(iesDefs[key]["ies"]) == 0:
+ continue
+
+ f.write("/** \\brief Encode function for %s ies.\n" % (key))
+ f.write(" * \\param %s Pointer to the ASN1 structure.\n" % (firstlower))
+ f.write(" * \\param %s Pointer to the IES structure.\n" % (lowerFirstCamelWord(re.sub('-', '_', key))))
+ f.write(" **/\n")
+ f.write("int %s_encode_%s(\n" % (fileprefix, re.sub('-', '_', structName.lower())))
+ f.write(" %s_t *%s,\n" % (asn1cStruct, firstlower))
+ f.write(" %s_t *%s);\n\n" % (re.sub('-', '_', key), lowerFirstCamelWord(re.sub('-', '_', key))))
+
+for key in iesDefs:
+ if key not in ieofielist.values():
+ continue
+ asn1cStruct = re.sub('-', '_', re.sub('IEs', '', key))
+ asn1cStruct = re.sub('Item', 'List', asn1cStruct)
+ firstlower = re.sub('Item', 'List', re.sub('enb', 'eNB', lowerFirstCamelWord(asn1cStruct)))
+ f.write("/** \\brief Encode function for %s ies.\n" % (key))
+ f.write(" * \\param %s Pointer to the ASN1 structure.\n" % (firstlower))
+ f.write(" * \\param %s Pointer to the IES structure.\n" % (lowerFirstCamelWord(re.sub('-', '_', key))))
+ f.write(" **/\n")
+ f.write("int %s_encode_%s(\n" % (fileprefix, firstlower.lower()))
+ f.write(" %s_t *%s,\n" % (asn1cStruct, firstlower))
+ f.write(" %sIEs_t *%sIEs);\n\n" % (asn1cStruct, firstlower))
+ f.write("/** \\brief Decode function for %s ies.\n" % (key))
+ f.write(" * \\param any_p Pointer to the ANY value to decode.\n")
+ f.write(" * \\param callback Callback function called when any_p is successfully decoded.\n")
+ f.write(" **/\n")
+ f.write("int %s_decode_%s(\n" % (fileprefix, firstlower.lower()))
+ f.write(" %sIEs_t *%sIEs,\n" % (asn1cStruct, firstlower))
+ f.write(" %s_t *%s);\n\n" % (asn1cStruct, lowerFirstCamelWord(asn1cStruct)))
+
+for key in iesDefs:
+ asn1cStruct = re.sub('-', '_', re.sub('IEs', '', key))
+ asn1cStruct = re.sub('Item', 'List', asn1cStruct)
+ firstlower = re.sub('Item', 'List', re.sub('enb', 'eNB', lowerFirstCamelWord(asn1cStruct)))
+
+ if key in ieofielist.values():
+ f.write("/** \\brief Display %s encapsulated IE using XER encoding.\n" % (asn1cStruct))
+ f.write(" * \\param %s Pointer to the IES structure.\n" % (lowerFirstCamelWord(re.sub('-', '_', key))))
+ f.write(" * \\param file File descriptor to write output.\n")
+ f.write(" **/\n")
+ f.write("asn_enc_rval_t %s_xer_print_%s(\n" % (fileprefix, re.sub('item', 'list', firstlower.lower())))
+ f.write(" asn_app_consume_bytes_f *cb,\n")
+ f.write(" void *app_key,\n")
+ f.write(" %sIEs_t *%sIEs);\n\n" % (re.sub('item', 'list', asn1cStruct), firstlower))
+ else:
+ f.write("/** \\brief Display %s message using XER encoding.\n" % (asn1cStruct))
+ f.write(" * \\param message_p Pointer to root message.\n")
+ f.write(" * \\param file File descriptor to write output.\n")
+ f.write(" **/\n")
+ f.write("asn_enc_rval_t %s_xer_print_%s(\n" % (fileprefix, firstlower.lower()))
+ f.write(" asn_app_consume_bytes_f *cb,\n")
+ f.write(" void *app_key,\n")
+ f.write(" %s_message *message_p);\n\n" % (fileprefix))
+
+f.write("int %s_xer__print2sp(const void *buffer, size_t size, void *app_key);\n\n" % (fileprefix.lower()))
+f.write("int %s_xer__print2fp(const void *buffer, size_t size, void *app_key);\n\n" % (fileprefix.lower()))
+f.write("extern size_t %s_string_total_size;\n\n" % (fileprefix.lower()))
+f.write("#endif /* %s_IES_DEFS_H_ */\n\n" % (fileprefix.upper()))
+
+#Generate Decode functions
+f = open(outdir + fileprefix + '_decoder.c', 'w')
+outputHeaderToFile(f, filename)
+f.write("#include \"%s_common.h\"\n#include \"%s_ies_defs.h\"\n\n" % (fileprefix, fileprefix))
+for key in iesDefs:
+ if key in ieofielist.values():
+ continue
+ structName = re.sub('ies', '', key)
+ asn1cStruct = re.sub('-', '_', re.sub('IEs', '', key))
+ if asn1cStruct.rfind('_') == len(asn1cStruct) - 1:
+ asn1cStruct = asn1cStruct[:-1]
+ asn1cStruct = re.sub('Item', 'List', asn1cStruct)
+ ielistname = re.sub('UE', 'ue', asn1cStruct)
+ ielistnamefirstlower = ielistname[:1].lower() + ielistname[1:]
+ asn1cStructfirstlower = asn1cStruct[:1].lower() + asn1cStruct[1:]
+ keyName = re.sub('-', '_', key)
+ keyupperunderscore = keyName.upper()
+ firstlower = re.sub('Item', 'List', re.sub('enb', 'eNB', lowerFirstCamelWord(asn1cStruct)))
+
+ iesaccess = ""
+ if key not in ieofielist.values():
+ iesaccess = "%s_ies." % (firstlower)
+
+ f.write("int %s_decode_%s(\n" % (fileprefix, re.sub('-', '_', structName.lower())))
+ if len(iesDefs[key]["ies"]) != 0:
+ f.write(" %s_t *%s,\n" % (re.sub('-', '_', key), lowerFirstCamelWord(re.sub('-', '_', key))))
+ f.write(" ANY_t *any_p) {\n\n")
+
+ f.write(" %s_t %s;\n %s_t *%s_p = &%s;\n" % (asn1cStruct, asn1cStructfirstlower, asn1cStruct, asn1cStructfirstlower, asn1cStructfirstlower))
+ f.write(" int i, decoded = 0;\n")
+ if len(iesDefs[key]["ies"]) != 0:
+ f.write(" int tempDecoded = 0;\n")
+
+ f.write(" assert(any_p != NULL);\n")
+ if len(iesDefs[key]["ies"]) != 0:
+ f.write(" assert(%s != NULL);\n\n" % (lowerFirstCamelWord(re.sub('-', '_', key))))
+
+ f.write(" %s_DEBUG(\"Decoding message %s (%%s:%%d)\\n\", __FILE__, __LINE__);\n\n" % (fileprefix.upper(), re.sub('-', '_', keyName)))
+ f.write(" ANY_to_type_aper(any_p, &asn_DEF_%s, (void**)&%s_p);\n\n" % (asn1cStruct, asn1cStructfirstlower))
+ f.write(" for (i = 0; i < %s_p->%slist.count; i++) {\n" % (asn1cStructfirstlower, iesaccess))
+ f.write(" %s_IE_t *ie_p;\n" % (fileprefix[0].upper() + fileprefix[1:]))
+ f.write(" ie_p = %s_p->%slist.array[i];\n" % (asn1cStructfirstlower, iesaccess))
+ f.write(" switch(ie_p->id) {\n")
+ for ie in iesDefs[key]["ies"]:
+ iename = re.sub('id-', '', ie[0])
+ ienameunderscore = lowerFirstCamelWord(re.sub('-', '_', iename))
+ ienameunderscorefirstlower = lowerFirstCamelWord(ienameunderscore)
+ ietypesubst = re.sub('-', '', ie[2])
+ ietypeunderscore = re.sub('-', '_', ie[2])
+ ieupperunderscore = re.sub('-', '_', re.sub('id-', '', ie[0])).upper()
+
+ if ie[3] == "optional":
+ f.write(" /* Optional field */\n")
+ elif ie[3] == "conditional":
+ f.write(" /* Conditional field */\n")
+ f.write(" case %s_ProtocolIE_ID_%s:\n" % (fileprefix_first_upper, re.sub('-', '_', ie[0])))
+ f.write(" {\n")
+ f.write(" %s_t *%s_p = NULL;\n" % (ietypeunderscore, lowerFirstCamelWord(ietypesubst)))
+ if ie[3] != "mandatory":
+ f.write(" %s->presenceMask |= %s_%s_PRESENT;\n" % (lowerFirstCamelWord(re.sub('-', '_', key)), keyupperunderscore, ieupperunderscore))
+ f.write(" tempDecoded = ANY_to_type_aper(&ie_p->value, &asn_DEF_%s, (void**)&%s_p);\n" % (ietypeunderscore, lowerFirstCamelWord(ietypesubst)))
+ f.write(" if (tempDecoded < 0 || %s_p == NULL) {\n" % (lowerFirstCamelWord(ietypesubst)))
+ f.write(" %s_ERROR(\"Decoding of IE %s failed\\n\");\n" % (fileprefix.upper(), ienameunderscore))
+ f.write(" if (%s_p)\n" % (lowerFirstCamelWord(ietypesubst)))
+ f.write(" ASN_STRUCT_FREE(asn_DEF_%s, %s_p);\n" % (ietypeunderscore, lowerFirstCamelWord(ietypesubst)))
+ f.write(" return -1;\n")
+ f.write(" }\n")
+ f.write(" decoded += tempDecoded;\n")
+ f.write(" if (asn1_xer_print)\n")
+ f.write(" xer_fprint(stdout, &asn_DEF_%s, %s_p);\n" % (ietypeunderscore, lowerFirstCamelWord(ietypesubst)))
+ if ie[2] in ieofielist.keys():
+ f.write(" if (%s_decode_%s(&%s->%s, %s_p) < 0) {\n" % (fileprefix, ietypeunderscore.lower(), lowerFirstCamelWord(re.sub('-', '_', key)), ienameunderscore, lowerFirstCamelWord(ietypesubst)))
+ f.write(" %s_ERROR(\"Decoding of encapsulated IE %s failed\\n\");\n" % (fileprefix.upper(), lowerFirstCamelWord(ietypesubst)))
+ f.write(" ASN_STRUCT_FREE(asn_DEF_%s, %s_p);\n" % (ietypeunderscore, lowerFirstCamelWord(ietypesubst)))
+ f.write(" }\n")
+ else:
+ f.write(" memcpy(&%s->%s, %s_p, sizeof(%s_t));\n" % (lowerFirstCamelWord(re.sub('-', '_', key)), ienameunderscore, lowerFirstCamelWord(ietypesubst), ietypeunderscore))
+ #f.write(" ASN_STRUCT_FREE(asn_DEF_%s, %s_p);\n" % (ietypeunderscore, lowerFirstCamelWord(ietypesubst)))
+ f.write(" } break;\n")
+ f.write(" default:\n")
+ f.write(" %s_ERROR(\"Unknown protocol IE id (%%d) for message %s\\n\", (int)ie_p->id);\n" % (fileprefix.upper(), re.sub('-', '_', structName.lower())))
+ f.write(" return -1;\n")
+ f.write(" }\n")
+ f.write(" }\n")
+ f.write(" return decoded;\n")
+ f.write("}\n\n")
+
+for key in iesDefs:
+ if key not in ieofielist.values():
+ continue
+
+ keyname = re.sub('IEs', '', re.sub('Item', 'List', key))
+
+ f.write("int %s_decode_%s(\n" % (fileprefix, re.sub('-', '_', keyname).lower()))
+ f.write(" %sIEs_t *%sIEs,\n" % (re.sub('-', '_', keyname), lowerFirstCamelWord(re.sub('-', '_', keyname))))
+ f.write(" %s_t *%s) {\n\n" % (re.sub('-', '_', keyname), lowerFirstCamelWord(re.sub('-', '_', keyname))))
+ f.write(" int i, decoded = 0;\n")
+ f.write(" int tempDecoded = 0;\n\n")
+
+ f.write(" assert(%s != NULL);\n" % (lowerFirstCamelWord(re.sub('-', '_', keyname))));
+ f.write(" assert(%sIEs != NULL);\n\n" % (lowerFirstCamelWord(re.sub('-', '_', keyname))));
+
+ f.write(" for (i = 0; i < %s->list.count; i++) {\n" % (lowerFirstCamelWord(re.sub('-', '_', keyname))))
+ f.write(" %s_IE_t *ie_p = %s->list.array[i];\n" % (fileprefix[0].upper() + fileprefix[1:], lowerFirstCamelWord(re.sub('-', '_', keyname))))
+ f.write(" switch (ie_p->id) {\n")
+ for ie in iesDefs[key]["ies"]:
+ iename = re.sub('id-', '', ie[0])
+ ienameunderscore = lowerFirstCamelWord(re.sub('-', '_', iename))
+ f.write(" case %s_ProtocolIE_ID_%s:\n" % (fileprefix_first_upper, re.sub('-', '_', ie[0])))
+ f.write(" {\n")
+ f.write(" %s_t *%s_p = NULL;\n" % (re.sub('-', '_', ie[2]), lowerFirstCamelWord(re.sub('-', '', ie[2]))))
+ f.write(" tempDecoded = ANY_to_type_aper(&ie_p->value, &asn_DEF_%s, (void**)&%s_p);\n" % (re.sub('-', '_', ie[2]), lowerFirstCamelWord(re.sub('-', '', ie[2]))))
+ f.write(" if (tempDecoded < 0 || %s_p == NULL) {\n" % (lowerFirstCamelWord(re.sub('-', '', ie[2]))))
+ f.write(" %s_ERROR(\"Decoding of IE %s for message %s failed\\n\");\n" % (fileprefix.upper(), ienameunderscore, re.sub('-', '_', keyname)))
+ f.write(" if (%s_p)\n" % (lowerFirstCamelWord(re.sub('-', '', ie[2]))))
+ #f.write(" free(%s_p);\n" % (lowerFirstCamelWord(re.sub('-', '', ie[2]))))
+ f.write(" ASN_STRUCT_FREE(asn_DEF_%s, %s_p);\n" % (re.sub('-', '_', ie[2]), lowerFirstCamelWord(re.sub('-', '', ie[2]))))
+ f.write(" return -1;\n")
+ f.write(" }\n")
+ f.write(" decoded += tempDecoded;\n")
+ f.write(" if (asn1_xer_print)\n")
+ f.write(" xer_fprint(stdout, &asn_DEF_%s, %s_p);\n" % (re.sub('-', '_', ie[2]), lowerFirstCamelWord(re.sub('-', '', ie[2]))))
+ f.write(" ASN_SEQUENCE_ADD(&%sIEs->%s, %s_p);\n" % (lowerFirstCamelWord(re.sub('-', '_', keyname)),
+ re.sub('IEs', '', lowerFirstCamelWord(re.sub('-', '_', key))), lowerFirstCamelWord(re.sub('-', '', ie[2]))))
+ f.write(" } break;\n")
+ f.write(" default:\n")
+ f.write(" %s_ERROR(\"Unknown protocol IE id (%%d) for message %s\\n\", (int)ie_p->id);\n" % (fileprefix.upper(), re.sub('-', '_', structName.lower())))
+ f.write(" return -1;\n")
+ f.write(" }\n")
+ f.write(" }\n")
+ f.write(" return decoded;\n")
+ f.write("}\n\n")
+
+
+#Generate IES Encode functions
+f = open(outdir + fileprefix + '_encoder.c', 'w')
+outputHeaderToFile(f,filename)
+f.write("#include \"%s_common.h\"\n" % (fileprefix))
+f.write("#include \"%s_ies_defs.h\"\n\n" % (fileprefix))
+for key in iesDefs:
+ if key in ieofielist.values():
+ continue
+
+ structName = re.sub('ies', '', key)
+ asn1cStruct = re.sub('-', '_', re.sub('IEs', '', key))
+ asn1cStruct = re.sub('Item', 'List', asn1cStruct)
+ if asn1cStruct.rfind('_') == len(asn1cStruct) - 1:
+ asn1cStruct = asn1cStruct[:-1]
+ asn1cStructfirstlower = asn1cStruct[:1].lower() + asn1cStruct[1:]
+ firstwordlower = re.sub('Item', 'List', re.sub('enb', 'eNB', lowerFirstCamelWord(asn1cStruct)))
+
+ iesaccess = ""
+ if key not in ieofielist.values():
+ iesaccess = "%s_ies." % (firstwordlower)
+
+ keyName = re.sub('-', '_', key)
+ keyupperunderscore = keyName.upper()
+ # No IE to encode...
+ if len(iesDefs[key]["ies"]) == 0:
+ continue
+
+ f.write("int %s_encode_%s(\n" % (fileprefix, re.sub('-', '_', structName.lower())))
+ f.write(" %s_t *%s,\n" % (asn1cStruct, firstwordlower))
+ f.write(" %s_t *%s) {\n\n" % (re.sub('-', '_', key), lowerFirstCamelWord(re.sub('-', '_', key))))
+
+ f.write(" %s_IE_t *ie;\n\n" % (fileprefix_first_upper))
+
+ f.write(" assert(%s != NULL);\n" % (firstwordlower));
+ f.write(" assert(%s != NULL);\n\n" % (lowerFirstCamelWord(re.sub('-', '_', key))));
+
+ for ie in iesDefs[key]["ies"]:
+ iename = re.sub('-', '_', re.sub('id-', '', ie[0]))
+ ienameunderscore = re.sub('-', '_', iename)
+ ienamefirstwordlower = lowerFirstCamelWord(iename)
+ ieupperunderscore = re.sub('-', '_', re.sub('id-', '', ie[0])).upper()
+ ietypeunderscore = re.sub('-', '_', ie[2])
+
+ if ie[3] != "mandatory":
+ if ie[3] == "optional":
+ f.write(" /* Optional field */\n")
+ elif ie[3] == "conditional":
+ f.write(" /* Conditional field */\n")
+ f.write(" if (%s->presenceMask & %s_%s_PRESENT) {\n" % (lowerFirstCamelWord(re.sub('-', '_', key)), keyupperunderscore, ieupperunderscore))
+ #f.write(" == %s_%s_PRESENT) {\n" % (keyupperunderscore, ieupperunderscore))
+ f.write(" if ((ie = %s_new_ie(%s_ProtocolIE_ID_%s,\n" % (fileprefix, fileprefix_first_upper, re.sub('-', '_', ie[0])))
+ f.write(" %s_Criticality_%s,\n" % (fileprefix_first_upper, ie[1]))
+ f.write(" &asn_DEF_%s,\n" % (ietypeunderscore))
+ f.write(" &%s->%s)) == NULL) {\n" % (lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower))
+ f.write(" return -1;\n")
+ f.write(" }\n")
+ f.write(" ASN_SEQUENCE_ADD(&%s->%slist, ie);\n" % (firstwordlower, iesaccess))
+ f.write(" }\n\n")
+ else:
+ if ie[2] in ieofielist.keys():
+ f.write(" %s_t %s;\n\n" % (ietypeunderscore, ienamefirstwordlower))
+ f.write(" memset(&%s, 0, sizeof(%s_t));\n" % (ienamefirstwordlower, ietypeunderscore))
+ f.write("\n")
+ f.write(" if (%s_encode_%s(&%s, &%s->%s) < 0) return -1;\n" % (fileprefix, ietypeunderscore.lower(), ienamefirstwordlower, lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower))
+ f.write(" if ((ie = %s_new_ie(%s_ProtocolIE_ID_%s,\n" % (fileprefix, fileprefix_first_upper, re.sub('-', '_', ie[0])))
+ f.write(" %s_Criticality_%s,\n" % (fileprefix_first_upper, ie[1]))
+ f.write(" &asn_DEF_%s,\n" % (ietypeunderscore))
+ if ie[2] in ieofielist.keys():
+ f.write(" &%s)) == NULL) {\n" % (ienamefirstwordlower))
+ else:
+ f.write(" &%s->%s)) == NULL) {\n" % (lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower))
+ f.write(" return -1;\n")
+ f.write(" }\n")
+ f.write(" ASN_SEQUENCE_ADD(&%s->%slist, ie);\n\n" % (firstwordlower, iesaccess))
+ if ie[2] in ieofielist.keys():
+ f.write(" /* Free any dynamic allocation that is no more used */\n")
+ f.write(" ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_%s, &%s);\n\n" % (ietypeunderscore, ienamefirstwordlower))
+
+ f.write(" return 0;\n")
+ f.write("}\n\n")
+
+for (key, value) in iesDefs.items():
+ if key not in ieofielist.values():
+ continue
+
+ ie = value["ies"][0]
+ ietypeunderscore = re.sub('-', '_', ie[2])
+ asn1cStruct = re.sub('-', '_', re.sub('IEs', '', re.sub('-IEs', '', key)))
+ asn1cStruct = re.sub('Item', 'List', asn1cStruct)
+ firstwordlower = re.sub('Item', 'List', re.sub('enb', 'eNB', lowerFirstCamelWord(asn1cStruct)))
+
+ for (i, j) in ieofielist.items():
+ if j == key:
+ break
+ f.write("int %s_encode_%s(\n" % (fileprefix, re.sub('-', '_', i).lower()))
+ f.write(" %s_t *%s,\n" % (asn1cStruct, firstwordlower))
+ f.write(" %sIEs_t *%sIEs) {\n\n" % (re.sub('-', '_', i), lowerFirstCamelWord(re.sub('-', '_', i))))
+ f.write(" int i;\n")
+
+ f.write(" %s_IE_t *ie;\n\n" % (fileprefix_first_upper))
+
+ f.write(" assert(%s != NULL);\n" % (firstwordlower));
+ f.write(" assert(%sIEs != NULL);\n\n" % (lowerFirstCamelWord(re.sub('-', '_', i))));
+
+ f.write(" for (i = 0; i < %sIEs->%s.count; i++) {\n" % (firstwordlower, re.sub('IEs', '', lowerFirstCamelWord(re.sub('-', '_', key)))))
+ f.write(" if ((ie = %s_new_ie(%s_ProtocolIE_ID_%s,\n" % (fileprefix, fileprefix_first_upper, re.sub('-', '_', ie[0])))
+ f.write(" %s_Criticality_%s,\n" % (fileprefix_first_upper, ie[1]))
+ f.write(" &asn_DEF_%s,\n" % (ietypeunderscore))
+ f.write(" %sIEs->%s.array[i])) == NULL) {\n" % (firstwordlower, re.sub('IEs', '', lowerFirstCamelWord(re.sub('-', '_', key)))))
+ f.write(" return -1;\n")
+ f.write(" }\n")
+ f.write(" ASN_SEQUENCE_ADD(&%s->list, ie);\n" % (firstwordlower))
+ f.write(" }\n")
+ f.write(" return 0;\n")
+ f.write("}\n\n")
+
+#Generate xer print functions
+f = open(outdir + fileprefix + '_xer_print.c', 'w')
+outputHeaderToFile(f, filename)
+f.write("#include \n")
+f.write("#include \n\n")
+f.write("#include \n#include \n\n")
+f.write("#include \"%s_common.h\"\n#include \"%s_ies_defs.h\"\n\n" % (fileprefix, fileprefix))
+
+f.write("size_t %s_string_total_size = 0;\n\n" % (fileprefix.lower()))
+f.write("""int
+%s_xer__print2fp(const void *buffer, size_t size, void *app_key) {
+ FILE *stream = (FILE *)app_key;
+
+ if(fwrite(buffer, 1, size, stream) != size)
+ return -1;
+
+ return 0;
+}
+
+""" % (fileprefix.lower()))
+
+f.write("""int %s_xer__print2sp(const void *buffer, size_t size, void *app_key) {
+ char *string = (char *)app_key;
+
+ /* Copy buffer to the formatted string */
+ memcpy(&string[%s_string_total_size], buffer, size);
+
+ %s_string_total_size += size;
+
+ return 0;
+}
+
+""" % (fileprefix.lower(), fileprefix.lower(), fileprefix.lower()))
+
+f.write("""static asn_enc_rval_t
+xer_encode_local(asn_TYPE_descriptor_t *td, void *sptr,
+ asn_app_consume_bytes_f *cb, void *app_key, int indent) {
+ asn_enc_rval_t er, tmper;
+ const char *mname;
+ size_t mlen;
+ int xcan = 2;
+
+ if(!td || !sptr) goto cb_failed;
+
+ mname = td->xml_tag;
+ mlen = strlen(mname);
+
+ _i_ASN_TEXT_INDENT(0, indent);
+ _ASN_CALLBACK3("<", 1, mname, mlen, ">", 1);
+
+ tmper = td->xer_encoder(td, sptr, indent + 1, XER_F_BASIC, cb, app_key);
+ if(tmper.encoded == -1) return tmper;
+
+ _ASN_CALLBACK3("", 2, mname, mlen, ">\\n", xcan);
+
+ er.encoded = 4 + xcan + (2 * mlen) + tmper.encoded;
+
+ _ASN_ENCODED_OK(er);
+cb_failed:
+ _ASN_ENCODE_FAILED;
+}
+""")
+
+for (key, value) in iesDefs.items():
+ keyName = re.sub('-', '_', key)
+ keyupperunderscore = keyName.upper()
+ iesStructName = lowerFirstCamelWord(re.sub('-', '_', key))
+
+ ie = value["ies"][0]
+ ietypeunderscore = re.sub('-', '_', ie[2])
+
+ if key in ieofielist.values():
+ f.write("asn_enc_rval_t %s_xer_print_%s(\n" % (fileprefix, re.sub('ies', '', re.sub('item', 'list', re.sub('-', '_', key).lower()))))
+ else:
+ f.write("asn_enc_rval_t %s_xer_print_%s(\n" % (fileprefix, re.sub('ies', '', re.sub('-', '_', key).lower())))
+ #f.write(" FILE *file,\n")
+ f.write(" asn_app_consume_bytes_f *cb,\n")
+ f.write(" void *app_key,\n")
+ if key in ieofielist.values():
+ iesStructName = lowerFirstCamelWord(re.sub('Item', 'List', re.sub('-', '_', key)))
+ f.write(" %sIEs_t *%s) {\n\n" % (re.sub('IEs', '', re.sub('Item', 'List', re.sub('-', '_', key))), iesStructName))
+ f.write(" int i;\n")
+ f.write(" asn_enc_rval_t er;\n")
+ else:
+ f.write(" %s_message *message_p)\n{\n" % (fileprefix))
+ f.write(" %s_t *%s;\n" % (re.sub('-', '_', key), iesStructName))
+ f.write(" asn_enc_rval_t er;\n")
+ #f.write(" void *app_key = (void *)file;\n")
+ #f.write(" asn_app_consume_bytes_f *cb = %s_xer__print2fp;\n\n" % (fileprefix.lower()))
+
+ f.write(" %s = &message_p->msg.%s;\n\n" % (iesStructName, iesStructName))
+
+ if key in ieofielist.values():
+ # Increase indentation level
+ f.write(" for (i = 0; i < %s->%s.count; i++) {\n" % (iesStructName, re.sub('IEs', '', lowerFirstCamelWord(re.sub('-', '_', key)))))
+ #f.write(" xer_fprint(file, &asn_DEF_%s, %s->%s.array[i]);\n" % (ietypeunderscore, iesStructName, re.sub('IEs', '', lowerFirstCamelWord(re.sub('-', '_', key)))))
+ f.write(" er = xer_encode(&asn_DEF_%s, %s->%s.array[i], XER_F_BASIC, cb, app_key);\n" % (ietypeunderscore, iesStructName, re.sub('IEs', '', lowerFirstCamelWord(re.sub('-', '_', key)))))
+ f.write(" }\n")
+ else:
+ f.write(" cb(\"<%s-PDU>\\n\", %d, app_key);\n" % (key, len("<%s-PDU>\n" % (key))))
+ f.write(" xer_encode_local(&asn_DEF_%s_Criticality, &message_p->criticality, cb, app_key, 1);\n" % fileprefix_first_upper)
+ f.write(" xer_encode_local(&asn_DEF_%s_ProcedureCode, &message_p->procedureCode, cb, app_key, 1);\n" % fileprefix_first_upper)
+
+ f.write(" cb(\" <%s>\\n\", %d, app_key);\n" % (key, len(" <%s>\n" % (key))))
+
+ for ie in iesDefs[key]["ies"]:
+ iename = re.sub('-', '_', re.sub('id-', '', ie[0]))
+ ienameunderscore = re.sub('-', '_', iename)
+ ienamefirstwordlower = lowerFirstCamelWord(iename)
+ ietypeunderscore = re.sub('-', '_', ie[2])
+ ieupperunderscore = re.sub('-', '_', re.sub('id-', '', ie[0])).upper()
+
+ if ie[3] != "mandatory":
+ if ie[3] == "optional":
+ f.write(" /* Optional field */\n")
+ elif ie[3] == "conditional":
+ f.write(" /* Conditional field */\n")
+ f.write(" if (%s->presenceMask & %s_%s_PRESENT)\n " % (iesStructName, keyupperunderscore, ieupperunderscore))
+
+ # Is it an encapsulated IE ?
+ if ie[2] in ieofielist.keys():
+ f.write(" %s_xer_print_%s(cb, app_key, &%s->%s);\n" % (fileprefix, re.sub('ies', '', re.sub('-', '_', ie[2]).lower()), iesStructName, ienamefirstwordlower))
+ else:
+ f.write(" xer_encode_local(&asn_DEF_%s, &%s->%s, cb, app_key, 2);\n" % (ietypeunderscore, iesStructName, ienamefirstwordlower))
+ f.write(" cb(\" %s>\\n\", %d, app_key);\n" % (key, len(" %s>\n" % (key))))
+ f.write(" cb(\"%s-PDU>\\n\", %d, app_key);\n" % (key, len("%s-PDU>\n" % (key))))
+
+ f.write(" _ASN_ENCODED_OK(er);\n")
+ #if key not in ieofielist.values():
+ #f.write("cb_failed:\n")
+ #f.write(" return er;\n")
+ f.write("}\n\n")
diff --git a/cmake_targets/tools/build_epc b/cmake_targets/tools/build_epc
index 0f2cc9715f..0caeaf2617 100755
--- a/cmake_targets/tools/build_epc
+++ b/cmake_targets/tools/build_epc
@@ -233,12 +233,12 @@ function main()
##############################################################################
# Compile userspace executable
##############################################################################
- rm -f $OPENAIR_DIR/targets/bin/mme_gw
cd $OPENAIR_DIR/cmake_targets/epc_build_oai
if [ $clean -ne 0 ]; then
if [[ $verbose -eq 1 ]]; then
- echo "Cleaning EPC"
+ echo "Cleaning EPC: certificates, generated configuration files, obj files, mme_gw executable, GTP kernel module"
fi
+ rm -f $OPENAIR_DIR/targets/bin/mme_gw
rm -Rf build 2>&1
$SUDO rm -Rf $OPENAIR_TARGETS/CMAKE/EPC/MME_GW/build 2>&1
$SUDO rm -f /usr/local/etc/freeDiameter/mme* 2>&1
@@ -246,8 +246,8 @@ function main()
$SUDO rm -f /usr/etc/freeDiameter/mme* 2>&1
$SUDO rm -f /usr/etc/freeDiameter/epc* 2>&1
$SUDO rm -f $OPENAIR_DIR/targets/bin/xt_GTPU*.ko 2>&1
- (cd $OPENAIRCN_DIR/GTPV1-U/GTPUAH && $SUDO make clean)
- $SUDO rm -f $OPENAIRCN_DIR/GTPV1-U/GTPUAH/Bin/* 2>&1
+ (cd $OPENAIRCN_DIR/GTPV1-U/GTPU_SP && $SUDO make clean)
+ $SUDO rm -f $OPENAIRCN_DIR/GTPV1-U/GTPU_SP/Bin/* 2>&1
$SUDO rm -f /lib/xtables/libxt_GTPU*.so 2>&1
mkdir -m 777 -p -v build
fi
@@ -273,20 +273,17 @@ function main()
epc_build_oai mme_gw \
mme_gw $dbin/mme_gw.$REL
# Only integrated mme+sgw+pgw is operational today
- # compilations \
- # epc_build_oai oai_sgw \
- # oai_sgw $dbin/oai_sgw.$REL
compilations \
- epc_build_oai xt_GTPUAH_lib \
- libxt_GTPUAH_lib.so $dbin
+ epc_build_oai xt_GTPUSP_lib \
+ libxt_GTPUSP_lib.so $dbin
compilations \
- epc_build_oai xt_GTPUAH \
- CMakeFiles/xt_GTPUAH/xt_GTPUAH.ko $dbin
+ epc_build_oai xt_GTPUSP \
+ CMakeFiles/xt_GTPUSP/xt_GTPUSP.ko $dbin
echo_info "Copying iptables libraries into system directory: /lib/xtables"
- if [ -f $dbin/libxt_GTPUAH_lib.so ] ; then
- $SUDO rm -f /lib/xtables/libxt_GTPUAH.so
- $SUDO ln -s $dbin/libxt_GTPUAH_lib.so /lib/xtables/libxt_GTPUAH.so
+ if [ -f $dbin/libxt_GTPUSP_lib.so ] ; then
+ $SUDO rm -f /lib/xtables/libxt_GTPUSP.so
+ $SUDO ln -s $dbin/libxt_GTPUSP_lib.so /lib/xtables/libxt_GTPUSP.so
else
echo_fatal "not installed GTP-U iptables: binaries not found"
fi
@@ -298,9 +295,6 @@ function main()
else
echo_fatal "not installed EPC config files: not found"
fi
-
-
-
}
diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper
index 0c9f813236..100effd872 100755
--- a/cmake_targets/tools/build_helper
+++ b/cmake_targets/tools/build_helper
@@ -31,7 +31,7 @@
# author Laurent Thomas
#
#######################################
-SUDO=sudo
+SUDO='sudo -E'
###############################
## echo and family
@@ -40,7 +40,7 @@ black='\E[30m'
red='\E[31m'
green='\E[32m'
yellow='\E[33m'
-blue='\E[34m'
+blue='\E[1;34m'
magenta='\E[35m'
cyan='\E[36m'
white='\E[37m'
@@ -112,10 +112,11 @@ compilations() {
cd $OPENAIR_DIR/cmake_targets/$1/build
{
rm -f $3
- make -j4 $2
+ make -j`nproc` $2 VERBOSE=$VERBOSE_COMPILE
} > $dlog/$2.$REL.txt 2>&1
+ echo_info "Log file for compilation has been written to: $dlog/$2.$REL.txt"
if [ -s $3 ] ; then
- cp $3 $dbin
+ cp $3 $4
echo_success "$2 compiled"
else
echo_error "$2 compilation failed"
@@ -179,7 +180,7 @@ install_nettle_from_source() {
cd nettle-2.5/
./configure --disable-openssl --enable-shared --prefix=/usr
echo "Compiling nettle"
- make -j4
+ make -j`nproc`
make check
$SUDO make install
rm -rf /tmp/nettle-2.5.tar.gz /tmp/nettle-2.5
@@ -194,14 +195,14 @@ install_gnutls_from_source(){
cd gnutls-3.1.23/
./configure --prefix=/usr
echo "Compiling gnutls"
- make -j4
+ make -j`nproc`
$SUDO make install
rm -rf /tmp/gnutls-3.1.23.tar.xz /tmp/gnutls-3.1.23
}
install_1.1.5_freediameter_from_source() {
cd /tmp
- echo "Downloading 1.1.5 freeDiameter archive"
+ echo "Downloading 1.1.5 freeDiameter archive"
rm -rf /tmp/1.1.5.tar.gz* /tmp/freeDiameter-1.1.5
wget http://www.freediameter.net/hg/freeDiameter/archive/1.1.5.tar.gz
tar xzf 1.1.5.tar.gz
@@ -211,7 +212,7 @@ install_1.1.5_freediameter_from_source() {
cd build
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr ../
echo "Compiling freeDiameter"
- make -j4
+ make -j`nproc`
#make test
$SUDO make install
rm -rf /tmp/1.1.5.tar.gz /tmp/freeDiameter-1.1.5
@@ -229,12 +230,30 @@ install_freediameter_from_source() {
cd build
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr ../
echo "Compiling freeDiameter"
- make -j4
+ make -j`nproc`
#make test
$SUDO make install
rm -rf /tmp/1.2.0.tar.gz /tmp/freeDiameter-1.2.0
}
+install_latest_freediameter_from_source() {
+ cd /tmp
+ rm -rf /tmp/freeDiameter
+ echo "Downloading latest freeDiameter trunk (may be unstable)"
+ git clone https://github.com/Metaswitch/freeDiameter.git
+ cd freeDiameter
+ patch -p1 < $OPENAIR_DIR/openair-cn/S6A/freediameter/freediameter-1.2.0.patch
+ mkdir build
+ cd build
+ cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr ../
+ echo "Compiling freeDiameter"
+ make -j`nproc`
+ #make test
+ $SUDO make install
+ rm -rf /tmp/freeDiameter
+}
+
+
check_install_usrp_uhd_driver(){
v=$(lsb_release -cs)
$SUDO apt-add-repository "deb http://files.ettus.com/binaries/uhd/repo/uhd/ubuntu/$v $v main"
@@ -279,17 +298,20 @@ check_install_oai_software() {
$SUDO apt-get update
$SUDO apt-get install -y \
- autoconf \
+ autoconf \
automake \
bison \
build-essential \
cmake \
cmake-curses-gui \
doxygen \
+ doxygen-gui\
+ texlive-latex-base\
ethtool \
flex \
- gccxml \
- gdb \
+ gccxml \
+ gdb \
+ git \
graphviz \
gtkwave \
guile-2.0-dev \
@@ -308,7 +330,7 @@ check_install_oai_software() {
libgmp-dev \
libgtk-3-dev \
libidn2-0-dev \
- libidn11-dev \
+ libidn11-dev \
libmysqlclient-dev \
liboctave-dev \
libpgm-5.1 \
@@ -350,6 +372,7 @@ install_asn1c_from_source(){
svn co https://github.com/vlm/asn1c/trunk /tmp/asn1c-r1516 -r 1516 > /tmp/log_compile_asn1c
patch -p0 < $OPENAIR_DIR/openair-cn/S1AP/MESSAGES/ASN1/asn1cpatch.p0 >> /tmp/log_compile_asn1c
patch -p0 < $OPENAIR_DIR/openair-cn/S1AP/MESSAGES/ASN1/asn1cpatch_2.p0 >> /tmp/log_compile_asn1c
+ patch -p0 < $OPENAIR_DIR/openair2/RRC/LITE/MESSAGES/asn1c/asn1cpatch.p0 >> /tmp/log_compile_asn1c
./configure
make > /tmp/log_compile_asn1c 2>&1
$SUDO make install
diff --git a/cmake_targets/tools/check_mme_s6a_certificate b/cmake_targets/tools/check_mme_s6a_certificate
index 62d0c53468..aac91f3abe 100755
--- a/cmake_targets/tools/check_mme_s6a_certificate
+++ b/cmake_targets/tools/check_mme_s6a_certificate
@@ -86,7 +86,11 @@ function main() {
else
echo_error "Bad mme fqdn found in cert file: $full_hostname fqdn is $fqdn"
fi
+ else
+ echo_error "File $freediameter_path/etc/freeDiameter/mme.cert.pem not found"
fi
+ else
+ echo_error "Directory $freediameter_path/etc/freeDiameter not found"
fi
echo_error "MME S6A: Did not find valid certificate in $freediameter_path/etc/freeDiameter"
echo_warning "MME S6A: generating new certificate in $freediameter_path/etc/freeDiameter..."
diff --git a/cmake_targets/tools/epc.conf.in b/cmake_targets/tools/epc.conf.in
index 1bd7795492..7af3cca4cc 100755
--- a/cmake_targets/tools/epc.conf.in
+++ b/cmake_targets/tools/epc.conf.in
@@ -1,3 +1,36 @@
+# Internet
+# |
+# PGW_IPV4_ADDRESS_FOR_SGI |
+# +-----------+-------+------------+---------------+--------------------------+
+# |host y | | PGW_INTERFACE_NAME_FOR_SGI | |
+# +-----------+ +------------+---------------+ |
+# | | |
+# | +----+----+ (HSS may run on this host |
+# | | mme_gw | or on another one) |
+# | +----+----+ |
+# | | |
+# | +-----------------+--------------------+ |
+# | | SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP | |
+# | | MME_INTERFACE_NAME_FOR_S1_MME | |
+# +----------------------------+---+--+---------------------------------------+
+# MME_IPV4_ADDRESS_FOR_S1_MME | (S1-C and S1-U addresses/interfaces may be the same)
+# SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP
+# |
+# |
+# a.b.c.d |
+# +---------------+------------+---+--+---------------------------------------+
+# |eNBx | | ethx | |
+# +---------------+ +---+--+ |
+# | | |
+# | +------+---------+ |
+# | | lte-softmodem | |
+# | | or | |
+# | | oaisim (1)eNB (x UEs) |
+# | +-------+--------+ |
+# +---------------------------------+-----------------------------------------+
+# |
+# O (RF antenna)
+
MME :
{
@@ -34,8 +67,8 @@ MME :
SCTP :
{
# Number of streams to use in input/output
- SCTP_INSTREAMS = 32;
- SCTP_OUTSTREAMS = 32;
+ SCTP_INSTREAMS = 8;
+ SCTP_OUTSTREAMS = 8;
};
# ------- S1AP definitions
@@ -61,7 +94,7 @@ MME :
# TA (mcc.mnc:tracking area code) DEFAULT = 208.34:0
# max values = 999.999:65535
# maximum of 32 values, comma separated
- PLMN = (
+ TAI_LIST = (
{MCC="208" ; MNC="95"; TAC = "1"; } # YOUR PLMN CONFIG HERE
);
};
@@ -123,9 +156,8 @@ P-GW =
);
};
- #WARNING DNS ARE HARDCODED IN openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDefaultEpsBearerContextRequest.c:305
- DEFAULT_DNS_1_IPV4_ADDRESS = "192.168.12.100"; # YOUR NETWORK CONFIG HERE
- DEFAULT_DNS_2_IPV4_ADDRESS = "192.168.106.12"; # YOUR NETWORK CONFIG HERE
+ DEFAULT_DNS_IPV4_ADDRESS = "192.168.106.12"; # YOUR NETWORK CONFIG HERE
+ DEFAULT_DNS_SEC_IPV4_ADDRESS = "192.168.12.100"; # YOUR NETWORK CONFIG HERE
};
diff --git a/cmake_targets/tools/epc.local.enb.conf.in b/cmake_targets/tools/epc.local.enb.conf.in
index 7d1a5dd476..353a294f64 100755
--- a/cmake_targets/tools/epc.local.enb.conf.in
+++ b/cmake_targets/tools/epc.local.enb.conf.in
@@ -34,8 +34,8 @@ MME :
SCTP :
{
# Number of streams to use in input/output
- SCTP_INSTREAMS = 32;
- SCTP_OUTSTREAMS = 32;
+ SCTP_INSTREAMS = 8;
+ SCTP_OUTSTREAMS = 8;
};
# ------- S1AP definitions
@@ -61,9 +61,8 @@ MME :
# TA (mcc.mnc:tracking area code) DEFAULT = 208.34:0
# max values = 999.999:65535
# maximum of 32 values, comma separated
- PLMN = (
- {MCC="208" ; MNC="95"; TAC = "1"; }, # YOUR PLMN CONFIG HERE
- {MCC="208" ; MNC="10"; TAC = "1"; } # YOUR PLMN CONFIG HERE
+ TAI_LIST = (
+ {MCC="208" ; MNC="95"; TAC = "1"; } # YOUR PLMN CONFIG HERE
);
};
@@ -124,9 +123,8 @@ P-GW =
);
};
- #WARNING DNS ARE HARDCODED IN openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDefaultEpsBearerContextRequest.c:305
- DEFAULT_DNS_1_IPV4_ADDRESS = "192.168.12.100"; # YOUR NETWORK CONFIG HERE
- DEFAULT_DNS_2_IPV4_ADDRESS = "192.168.106.12"; # YOUR NETWORK CONFIG HERE
+ DEFAULT_DNS_IPV4_ADDRESS = "192.168.106.12"; # YOUR NETWORK CONFIG HERE
+ DEFAULT_DNS_SEC_IPV4_ADDRESS = "192.168.12.100"; # YOUR NETWORK CONFIG HERE
};
diff --git a/cmake_targets/tools/generate_asn1 b/cmake_targets/tools/generate_asn1
index 9705838489..79becbf288 100755
--- a/cmake_targets/tools/generate_asn1
+++ b/cmake_targets/tools/generate_asn1
@@ -6,7 +6,110 @@ mkdir -p $1
cd $1
shift
-asn1c -gen-PER -fcompound-names $* 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample
+#if this script is called with only 2 arguments (so 1 here after the shift), it's for RRC
+#(there may be a better way...)
+if [ $# -eq 1 ]; then
+
+#asn1c does not work well with extension groups, we need the following fix:
+# replace [[ by ' SEQUENCE {'
+# and ]] by '} OPTIONAL'
+# is ext with N starting from 1 and incremented at each new [[ ]] just
+#following another [[ ]]
+#
+#this is what the following C program does
+
+echo generate asnfix.c
+
+cat << EOF > asnfix.c
+/* transforms:
+ * '[[' to 'name SEQUENCE {'
+ * ']]' to '} OPTIONAL'
+ * name is ext1, ext2, ..., for each [[ at the same level
+ * levels are delimited by { and }
+ * -- to end of line is a comment and unprocessed
+ * nested [[ ]] not handled
+ * { and } must be balanced
+ * [[ and ]] can be whatever, every combination is valid
+ */
+#include
+#include
+
+void level(int toplevel)
+{
+ int c;
+ int next_name = 1;
+
+ while (1) {
+ c = getchar();
+next:
+ if (c == EOF) { if (toplevel) break; abort(); }
+
+ if (c == '-') {
+ c = getchar();
+ if (c != '-') { putchar('-'); goto next; }
+ putchar(c); putchar(c);
+ while (1) {
+ c = getchar(); if (c == EOF) abort();
+ putchar(c);
+ if (c == '\n') break;
+ }
+ continue;
+ }
+
+ if (c == '[') {
+ c = getchar();
+ if (c != '[') { putchar('['); goto next; }
+ printf("ext%d SEQUENCE {", next_name);
+ next_name++;
+ continue;
+ }
+
+ if (c == ']') {
+ c = getchar();
+ if (c != ']') { putchar(']'); goto next; }
+ printf("} OPTIONAL");
+ continue;
+ }
+
+ putchar(c);
+ if (c == '}') { if (toplevel) abort(); break; }
+ if (c == '{') level(0);
+ }
+}
+
+int main(void)
+{
+ level(1);
+ fflush(stdout);
+ return 0;
+}
+EOF
+
+echo compile asnfix.c
+
+gcc -Wall -o asnfix asnfix.c
+
+echo run asnfix on $1
+
+./asnfix < $1 > fixed_grammar.asn
+
+rm -f asnfix asnfix.c
+
+echo done with asnfix
+
+echo running asn1c
+
+asn1c -gen-PER -fcompound-names fixed_grammar.asn 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample
+
+rm -f fixed_grammar.asn
+
+echo asn1c done
+
+else
+
+asn1c -gen-PER -fcompound-names $* 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample
+
+fi
awk '
BEGIN {
diff --git a/cmake_targets/tools/init_exmimo2 b/cmake_targets/tools/init_exmimo2
index 421d458cbb..5e4d13bec3 100755
--- a/cmake_targets/tools/init_exmimo2
+++ b/cmake_targets/tools/init_exmimo2
@@ -1,5 +1,39 @@
#!/bin/bash
+################################################################################
+# OpenAirInterface
+# Copyright(c) 1999 - 2015 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, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
+#
+################################################################################
+# file init_nas_nos1
+# brief loads the nasmesh module and sets up the radio bearers (used to provide ip interface without S1 interface)
+# author Florian Kaltenberger
+#
+#######################################
+
load_module()
{
mod_name=${1##*/}
diff --git a/cmake_targets/tools/init_nas_nos1 b/cmake_targets/tools/init_nas_nos1
new file mode 100644
index 0000000000..fed8eacc10
--- /dev/null
+++ b/cmake_targets/tools/init_nas_nos1
@@ -0,0 +1,61 @@
+#!/bin/bash
+
+################################################################################
+# OpenAirInterface
+# Copyright(c) 1999 - 2015 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, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
+#
+################################################################################
+# file init_nas_nos1
+# brief loads the nasmesh module and sets up the radio bearers (used to provide ip interface without S1 interface)
+# author Florian Kaltenberger
+#
+#######################################
+
+load_module() {
+ mod_name=${1##*/}
+ mod_name=${mod_name%.*}
+ if awk "/$mod_name/ {found=1 ;exit} END {if (found!=1) exit 1}" /proc/modules
+ then
+ echo "module $mod_name already loaded: I remove it first"
+ sudo rmmod $mod_name
+ fi
+ echo loading $mod_name
+ sudo insmod $1
+}
+
+load_module $OPENAIR_DIR/targets/bin/nasmesh.ko
+
+if [ "$1" = "eNB" ]; then
+ echo "bring up oai0 interface for enb"
+ sudo ifconfig oai0 10.0.1.1 netmask 255.255.255.0 broadcast 10.0.1.255
+ $OPENAIR_DIR/targets/bin/rb_tool -a -c0 -i0 -z0 -s 10.0.1.1 -t 10.0.1.9 -r 1
+else
+ if [ "$1" = "UE" ]; then
+ echo "bring up oai0 interface for UE"
+ sudo ifconfig oai0 10.0.1.9 netmask 255.255.255.0 broadcast 10.0.1.255
+ $OPENAIR_DIR/targets/bin/rb_tool -a -c0 -i0 -z0 -s 10.0.1.9 -t 10.0.1.1 -r 1
+ fi
+fi
diff --git a/cmake_targets/tools/mem_usage b/cmake_targets/tools/mem_usage
new file mode 100755
index 0000000000..4290372f02
--- /dev/null
+++ b/cmake_targets/tools/mem_usage
@@ -0,0 +1,27 @@
+#!/usr/bin/env bash
+
+pid=$1
+sleep_sec=0.5
+
+if [ "$2" != "" ] ; then
+sleep_sec=$2
+fi
+#declare -r cnt=$sleep_sec
+OUTPUT_FILE="/tmp/mem_usage_${pid}_${sleep_sec}.csv"
+echo "RSS(KB);PSS(KB);SHARED_CLEAN(KB);SHARED_DIRTY(KB);PRIVATE)KB)" >> $OUTPUT_FILE
+echo "Mem usage for PID $pid with observation period of ${sleep_sec}"
+
+while ps $pid >/dev/null
+do
+ if [ -f /proc/$pid/smaps ]; then
+ rss=$(awk '/^Rss/ {i = i + $2} END {print i}' /proc/$pid/smaps)
+ pss=$(awk '/^Pss/ {i = i + $2 + 0.5} END {print i}' /proc/$pid/smaps)
+ sc=$(awk '/^Shared_Clean/ {i = i + $2} END {print i}' /proc/$pid/smaps)
+ sd=$(awk '/^Shared_Dirty/ {i = i + $2} END {print i}' /proc/$pid/smaps)
+ pc=$(awk '/^Private_Clean/ {i = i + $2} END {print i}' /proc/$pid/smaps)
+ pd=$(awk '/^Private_Dirty/ {i = i + $2} END {print i}' /proc/$pid/smaps)
+ echo "$cnt;$rss;$pss;$sc;$pc;$pd;" >> $OUTPUT_FILE
+ fi
+
+ sleep $sleep_sec
+done
diff --git a/cmake_targets/tools/run_enb_s1_usrp b/cmake_targets/tools/run_enb_s1_usrp
index 606bd82d79..a4766ed658 100755
--- a/cmake_targets/tools/run_enb_s1_usrp
+++ b/cmake_targets/tools/run_enb_s1_usrp
@@ -39,6 +39,8 @@
################################
THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
source $THIS_SCRIPT_PATH/build_helper
+declare -i g_run_msc_gen=0
+declare g_msc_dir="/tmp"
function help()
@@ -57,6 +59,7 @@ function help()
echo_error " -K, --itti-dump-file filename ITTI dump file containing all ITTI events occuring during EPC runtime.(can omit file name if last argument)"
echo_error " -M, --target-dl-mcs mcs Downlink target MCS."
echo_error " -m, --mscgen directory Generate mscgen output files in a directory"
+ echo_error " -s, --show-stdout Do not redirect stdout and stderr to file /tmp/lte_softmodem.stdout.txt."
echo_error " -S, --enable-missed-slot Continue execution in case of missed slot."
echo_error " -T, --target-ul-mcs mcs Uplink target MCS."
echo_error " -V, --vcd Dump timings of processing in a GTKWave compliant file format."
@@ -68,13 +71,40 @@ function help()
}
+function do_msc_gen()
+{
+ cd $g_msc_dir
+ last_created_file=`ls -t mscgen* | head -1 | tr -d ':'`
+ $OPENAIR_DIR/targets/SCRIPTS/msc_gen.py
+ sync
+ last_created_file2=`ls -t mscgen* | head -1 | tr -d ':'`
+
+ if [ x"$last_created_file" != x"$last_created_file2" ]; then
+ if [ -f ./$last_created_file2/oai_mscgen_page_0.png ]; then
+ command -v eog 2>/dev/null && eog ./$last_created_file2/oai_mscgen_page_0.png
+ fi
+ fi
+
+}
+
+
+function control_c()
+# run if user hits control-c
+{
+ echo_warning "\nExiting by ctrl+c\n"
+ if [ $g_run_msc_gen -eq 1 ]; then
+ do_msc_gen
+ fi
+ exit $?
+}
+
function main()
{
local -i run_gdb=0
- local -i run_mscgen=0
+ local -i show_stdout=0
local exe_arguments=""
- local MSC_DIR="/tmp"
+ local itti_dump_file=""
until [ -z "$1" ]
do
@@ -99,7 +129,7 @@ function main()
;;
-g | --gdb)
run_gdb=1
- echo "setting GDB flag to: $GDB"
+ echo "setting GDB flag to: $run_gdb"
shift;
;;
-h | --help)
@@ -108,23 +138,23 @@ function main()
exit 0
;;
-K | --itti-dump-file)
- ITTI_DUMP_FILE=$2
+ itti_dump_file=$2
# can omit file name if last arg on the line
- if [ "x$ITTI_DUMP_FILE" = "x" ]; then
- ITTI_DUMP_FILE="/tmp/enb_s1_usrp_itti.log"
+ if [ "x$itti_dump_file" = "x" ]; then
+ itti_dump_file="/tmp/enb_s1_usrp_itti.log"
shift 1;
else
shift 2;
fi
- echo "setting ITTI dump file to: $ITTI_DUMP_FILE"
- exe_arguments="$exe_arguments -K $ITTI_DUMP_FILE"
+ echo "setting ITTI dump file to: $itti_dump_file"
+ exe_arguments="$exe_arguments -K $itti_dump_file"
;;
-m | --mscgen)
- MSC_DIR=$2
+ g_msc_dir=$2
# can omit file name if last arg on the line
- if [ -d "$MSC_DIR" ]; then
- echo "setting mscgen log files to dir: $MSC_DIR"
- run_mscgen=1
+ if [ -d "$g_msc_dir" ]; then
+ echo "setting mscgen log files to dir: $g_msc_dir"
+ g_run_msc_gen=1
shift 2;
else
echo_error "Mscgen log dir does not exist"
@@ -141,6 +171,11 @@ function main()
exe_arguments="$exe_arguments -V /tmp/oai_gtk_wave.vcd"
shift ;
;;
+ -s | --show-stdout)
+ echo "setting show stdout"
+ show_stdout=1
+ shift ;
+ ;;
-S | --enable-missed-slot)
echo "setting continue even if missed slot"
exe_arguments="$exe_arguments -S"
@@ -151,14 +186,14 @@ function main()
exe_arguments="$exe_arguments -t $2"
shift 2;
;;
- -W | ----wireshark-l2)
+ -W | --wireshark-l2)
echo "setting l2 pcap dump output"
exe_arguments="$exe_arguments -W"
shift ;
;;
-x | --xforms)
exe_arguments="$exe_arguments -d"
- echo "setting xforms to: $XFORMS"
+ echo "setting xforms"
shift;
;;
*)
@@ -174,37 +209,38 @@ function main()
cecho "OPENAIR_DIR = $OPENAIR_DIR" $green
- if [ ! -e $OPENAIR_DIR/targets/bin/lte-softmodem ]; then
- echo_fatal "Cannot find $OPENAIR_DIR/targets/bin/lte-softmodem executable"
+ if [ ! -e $OPENAIR_DIR/targets/bin/lte-softmodem.Rel10 ]; then
+ echo_fatal "Cannot find $OPENAIR_DIR/targets/bin/lte-softmodem.Rel10 executable"
fi
if [ $run_gdb -eq 0 ]; then
- exec $OPENAIR_DIR/targets/bin/lte-softmodem `echo $exe_arguments` 2>&1 > /tmp/lte_softmodem.stdout.txt
+ # trap keyboard interrupt (control-c)
+ trap control_c SIGINT
+ if [ $show_stdout -eq 0 ]; then
+ echo_warning "stdout/sderr of lte-softmodem executable redirected to /tmp/lte_softmodem.stdout.txt"
+ exec $OPENAIR_DIR/targets/bin/lte-softmodem.Rel10 `echo $exe_arguments` 2>&1 > /tmp/lte_softmodem.stdout.txt
+ else
+ exec $OPENAIR_DIR/targets/bin/lte-softmodem.Rel10 `echo $exe_arguments`
+ fi
else
+ # trap keyboard interrupt (control-c) is done by gdb
touch ~/.gdb_lte_softmodem
chmod 777 ~/.gdb_lte_softmodem
- echo "file $OPENAIR_DIR/targets/bin/lte-softmodem" > ~/.gdb_lte_softmodem
+ echo "file $OPENAIR_DIR/targets/bin/lte-softmodem.Rel10" > ~/.gdb_lte_softmodem
echo "set args $exe_arguments" >> ~/.gdb_lte_softmodem
echo "run" >> ~/.gdb_lte_softmodem
cat ~/.gdb_lte_softmodem
- gdb -n -x ~/.gdb_lte_softmodem 2>&1 > /tmp/gdb_lte_softmodem.stdout.txt
+ if [ $show_stdout -eq 0 ]; then
+ echo_warning "stdout/sderr of lte-softmodem executable redirected to /tmp/gdb_lte_softmodem.stdout.txt"
+ gdb -n -x ~/.gdb_lte_softmodem 2>&1 > /tmp/gdb_lte_softmodem.stdout.txt
+ else
+ gdb -n -x ~/.gdb_lte_softmodem
+ fi
+ if [ $g_run_msc_gen -eq 1 ]; then
+ do_msc_gen
+ fi
fi
-
- if [ $run_mscgen -eq 1 ]; then
- cd $MSC_DIR
- last_created_file=`ls -t mscgen* | head -1 | tr -d ':'`
- $OPENAIR_DIR/targets/SCRIPTS/msc_gen.py --profile E_UTRAN
- sync
- last_created_file2=`ls -t mscgen* | head -1 | tr -d ':'`
-
- if [ x"$last_created_file" != x"$last_created_file2" ]; then
- if [ -f ./$last_created_file2/oai_mscgen_page_0.png ]; then
- command -v eog 2>/dev/null && eog ./$last_created_file2/oai_mscgen_page_0.png
- fi
- fi
- fi
-
}
diff --git a/cmake_targets/tools/run_enb_ue_virt_noS1 b/cmake_targets/tools/run_enb_ue_virt_noS1
index 82f302ff2e..c1ce434fa5 100755
--- a/cmake_targets/tools/run_enb_ue_virt_noS1
+++ b/cmake_targets/tools/run_enb_ue_virt_noS1
@@ -57,9 +57,11 @@ function help()
echo_error " "
echo_error "Options:"
echo_error "Mandatory arguments to long options are mandatory for short options too."
+ echo_error " -a, --abstraction enable phy abstraction mode"
echo_error " -c, -C, --config-file eNB_config_file eNB config file, (see $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF)"
echo_error " Default eNB config file if not set is $1"
echo_error " -g, --gdb Run with GDB."
+ echo_error " -l, --log-level set the global log level (8:trace, 7:debug, 6:info, 4:warn, 3:error). Note that the log configuration is eNB config file is ignored for oaisim."
echo_error " -h, --help Print this help."
echo_error " -K, --itti-dump-file filename ITTI dump file containing all ITTI events occuring during EPC runtime.(can omit file name if last argument)"
echo_error " -m, --mscgen directory Generate mscgen output files in a directory"
@@ -84,17 +86,24 @@ function main()
local DEFAULT_CONFIG_FILE_ENB=$OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf
local CONFIG_FILE_ENB=$DEFAULT_CONFIG_FILE_ENB
local MSC_DIR="/tmp"
-
+ local abstraction_flag=0
+
until [ -z "$1" ]
do
case "$1" in
- -c | -C | --config-file)
+ -a | --abstraction )
+ abstraction_flag=1
+ echo "enabling abstraction mode"
+ exe_arguments="$exe_arguments -a"
+ shift;
+ ;;
+ -c | -C | --config-file)
CONFIG_FILE_ENB=$2
# may be relative path
if [ -f $(dirname $(readlink -f $0))/$CONFIG_FILE ]; then
CONFIG_FILE_ENB=$(dirname $(readlink -f $0))/$CONFIG_FILE
echo "setting config file to: $CONFIG_FILE"
- CONFIG_FILE_ACCESS_OK=1
+ config_FILE_ACCESS_OK=1
else
# may be absolute path
if [ -f $CONFIG_FILE_ENB ]; then
@@ -110,6 +119,11 @@ function main()
echo "setting GDB flag to: $GDB"
shift;
;;
+ -l | --log-level)
+ echo "setting the log level to $2"
+ exe_arguments="$exe_arguments -l $2"
+ shift 2;
+ ;;
-h | --help)
help $DEFAULT_CONFIG_FILE_ENB
shift;
@@ -130,7 +144,6 @@ function main()
-m | --mscgen)
MSC_DIR=$2
- # can omit file name if last arg on the line
if [ -d "$MSC_DIR" ]; then
echo "setting mscgen log files to dir: $MSC_DIR"
run_mscgen=1
@@ -140,16 +153,17 @@ function main()
exit -1
fi
;;
-
+# -u | --num-ue )
+
-V | --vcd)
"setting gtk-wave output"
exe_arguments="$exe_arguments -V /tmp/oai_gtk_wave.vcd"
shift ;
;;
- -W | ----wireshark-l2)
+ -W | --wireshark-l2)
echo "setting l2 pcap dump output"
exe_arguments="$exe_arguments -P wireshark"
- shift 2;
+ shift 1;
;;
*)
echo "Unknown option $1"
@@ -185,8 +199,11 @@ function main()
# ue1 -> enb
$OPENAIR_DIR/targets/bin/rb_tool -a -c0 -i1 -z0 -s 10.0.2.2 -t 10.0.2.1 -r 1
-
- exe_arguments="$exe_arguments -s15 -AAWGN -b1 -u1"
+ if [ "$abstraction_flag" -eq "0" ] ; then
+ exe_arguments="$exe_arguments -s15 -AAWGN -b1 -u1"
+ else
+ exe_arguments="$exe_arguments -b1 -u1"
+ fi
cd $OPENAIR_DIR/targets/bin
@@ -194,13 +211,13 @@ function main()
if [ $run_mscgen -eq 1 ]; then
$SUDO rm -f /tmp/openair.msc.*
fi
-
+
if [ $run_gdb -eq 0 ]; then
- exec $SUDO $OPENAIR_DIR/targets/bin/oaisim_nos1 $exe_arguments | tee /tmp/enb_ue_nos1.log.txt
+ exec $SUDO $OPENAIR_DIR/targets/bin/oaisim_nos1.Rel10 $exe_arguments | tee /tmp/enb_ue_nos1.log.txt
else
touch ~/.gdb_enb_ue_nos1
chmod 777 ~/.gdb_enb_ue_nos1
- echo "file $OPENAIR_DIR/targets/bin/oaisim_nos1" > ~/.gdb_enb_ue_nos1
+ echo "file $OPENAIR_DIR/targets/bin/oaisim_nos1.Rel10" > ~/.gdb_enb_ue_nos1
echo "set args $exe_arguments" >> ~/.gdb_enb_ue_nos1
echo "run" >> ~/.gdb_enb_ue_nos1
cat ~/.gdb_enb_ue_nos1
diff --git a/cmake_targets/tools/run_enb_ue_virt_s1 b/cmake_targets/tools/run_enb_ue_virt_s1
index 6340feee66..2ce29429b1 100755
--- a/cmake_targets/tools/run_enb_ue_virt_s1
+++ b/cmake_targets/tools/run_enb_ue_virt_s1
@@ -214,12 +214,12 @@ function main()
is_tun=`is_tun_interface $ENB_INTERFACE_NAME_FOR_S1_MME $ENB_INTERFACE_NAME_FOR_S1U`
# if [ $is_tun = "1" ]; then
-# $SUDO openvpn --mktun --dev $ENB_INTERFACE_NAME_FOR_S1U;sync
-# $SUDO openvpn --mktun --dev $ENB_INTERFACE_NAME_FOR_S1_MME;sync
-# $SUDO ip -4 addr add $ENB_IPV4_ADDRESS_FOR_S1U/$ENB_IPV4_NETMASK_FOR_S1U dev $ENB_INTERFACE_NAME_FOR_S1U;sync
-# $SUDO ip -4 addr add $ENB_IPV4_ADDRESS_FOR_S1_MME/$ENB_IPV4_NETMASK_FOR_S1_MME dev $ENB_INTERFACE_NAME_FOR_S1_MME;sync
-# $SUDO ifconfig $ENB_INTERFACE_NAME_FOR_S1U up;sync
-# $SUDO ifconfig $ENB_INTERFACE_NAME_FOR_S1_MME up;sync
+# openvpn --mktun --dev $ENB_INTERFACE_NAME_FOR_S1U;sync
+# openvpn --mktun --dev $ENB_INTERFACE_NAME_FOR_S1_MME;sync
+# ip -4 addr add $ENB_IPV4_ADDRESS_FOR_S1U/$ENB_IPV4_NETMASK_FOR_S1U dev $ENB_INTERFACE_NAME_FOR_S1U;sync
+# ip -4 addr add $ENB_IPV4_ADDRESS_FOR_S1_MME/$ENB_IPV4_NETMASK_FOR_S1_MME dev $ENB_INTERFACE_NAME_FOR_S1_MME;sync
+# ifconfig $ENB_INTERFACE_NAME_FOR_S1U up;sync
+# ifconfig $ENB_INTERFACE_NAME_FOR_S1_MME up;sync
# echo_success "Configured local eNB S1 tun interfaces"
# else
# echo_success "eNB S1 tun interfaces should be ethernet interfaces (no tunnels configured)"
@@ -228,21 +228,21 @@ function main()
##################################################
# LAUNCH eNB + UE executable
##################################################
- $SUDO pkill oaisim
- $SUDO rmmod ue_ip > /dev/null 2>&1
+ pkill oaisim
+ rmmod ue_ip > /dev/null 2>&1
echo_success "Bringup UE interface..."
- $SUDO insmod $OPENAIR_DIR/targets/bin/ue_ip.ko
+ insmod $OPENAIR_DIR/targets/bin/ue_ip.ko
- $SUDO ip route flush cache
+ ip route flush cache
# Check table 200 lte in /etc/iproute2/rt_tables
fgrep lte /etc/iproute2/rt_tables > /dev/null
if [ $? -ne 0 ]; then
- $SUDO echo "200 lte " >> /etc/iproute2/rt_tables
+ bash -c echo "200 lte " >> /etc/iproute2/rt_tables
fi
- $SUDO ip rule add fwmark 1 table lte
- $SUDO ip route add default dev oip1 table lte
+ ip rule add fwmark 1 table lte
+ ip route add default dev oip1 table lte
exe_arguments="$exe_arguments -s15 -AAWGN -y1 -b1 -u1 -Q0"
@@ -250,19 +250,19 @@ function main()
if [ $run_mscgen -eq 1 ]; then
- $SUDO rm -f /tmp/openair.msc.*
+ rm -f /tmp/openair.msc.*
fi
if [ $run_gdb -eq 0 ]; then
- exec $SUDO $OPENAIR_DIR/targets/bin/oaisim $exe_arguments | tee /tmp/enb_ue_s1.log.txt
+ exec $OPENAIR_DIR/targets/bin/oaisim.Rel10 $exe_arguments | tee /tmp/enb_ue_s1.log.txt
else
touch ~/.gdb_enb_ue_s1
chmod 777 ~/.gdb_enb_ue_s1
- echo "file $OPENAIR_DIR/targets/bin/oaisim" > ~/.gdb_enb_ue_s1
+ echo "file $OPENAIR_DIR/targets/bin/oaisim.Rel10" > ~/.gdb_enb_ue_s1
echo "set args $exe_arguments" >> ~/.gdb_enb_ue_s1
echo "run" >> ~/.gdb_enb_ue_s1
cat ~/.gdb_enb_ue_s1
- $SUDO gdb -n -x ~/.gdb_enb_ue_s1
+ gdb -n -x ~/.gdb_enb_ue_s1
fi
if [ $run_mscgen -eq 1 ]; then
@@ -281,4 +281,12 @@ function main()
}
+sudo echo
+is_sudo=$?
+if [[ "$is_sudo" -ne 0 ]]; then
+ echo_error "This script must be run by root or a sudo'er"
+ echo
+ exit 1
+fi
+
main "$@"
diff --git a/cmake_targets/tools/run_epc b/cmake_targets/tools/run_epc
index efc791253b..08a014cde0 100755
--- a/cmake_targets/tools/run_epc
+++ b/cmake_targets/tools/run_epc
@@ -39,6 +39,8 @@
################################
THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
source $THIS_SCRIPT_PATH/build_helper
+declare -i g_run_msc_gen=0
+declare g_msc_dir="/tmp"
set_openair_env
@@ -62,17 +64,39 @@ function help()
echo_error " 2 -> ASN1 XER printf on and ASN1 debug on"
}
+function do_msc_gen()
+{
+ cd $g_msc_dir
+ last_created_file=`ls -t mscgen* | head -1 | tr -d ':'`
+ $OPENAIR_DIR/targets/SCRIPTS/msc_gen.py
+ sync
+ last_created_file2=`ls -t mscgen* | head -1 | tr -d ':'`
+
+ if [ x"$last_created_file" != x"$last_created_file2" ]; then
+ if [ -f ./$last_created_file2/oai_mscgen_page_0.png ]; then
+ command -v eog 2>/dev/null && eog ./$last_created_file2/oai_mscgen_page_0.png
+ fi
+ fi
+}
+
+function control_c()
+# run if user hits control-c
+{
+ echo_warning "\nExiting by ctrl+c\n"
+ if [ $g_run_msc_gen -eq 1 ]; then
+ do_msc_gen
+ fi
+ exit $?
+}
function main()
{
local -i run_gdb=0
- local -i run_mscgen=0
local exe_arguments=" "
local -i epc_local=0
local -r epc_default_config_file="$OPENAIR_TARGETS/bin/epc.conf"
local epc_config_file=$epc_default_config_file
- local MSC_DIR="/tmp"
until [ -z "$1" ]
do
@@ -103,12 +127,10 @@ function main()
shift;
;;
-m | --mscgen)
- MSC_DIR=$2
- # can omit file name if last arg on the line
- if [ -d "$MSC_DIR" ]; then
- echo "setting mscgen log files to dir: $MSC_DIR"
- run_mscgen=1
- exe_arguments="-m $exe_arguments"
+ g_msc_dir=$2
+ if [ -d "$g_msc_dir" ]; then
+ echo "setting mscgen log files to dir: $g_msc_dir"
+ g_run_msc_gen=1
shift 2;
else
echo_error "Mscgen log dir does not exist"
@@ -133,47 +155,45 @@ function main()
cecho "OPENAIR_DIR = $OPENAIR_DIR" $green
- if [ ! -e $OPENAIR_DIR/targets/bin/mme_gw ]; then
- echo_fatal "Cannot find $OPENAIR_DIR/targets/bin/mme_gw executable, have a look at the output of build_epc executable"
+ if [ ! -e $OPENAIR_DIR/targets/bin/mme_gw.Rel10 ]; then
+ echo_fatal "Cannot find $OPENAIR_DIR/targets/bin/mme_gw.Rel10 executable, have a look at the output of build_epc executable"
fi
if [ $epc_local -eq 1 ]; then
epc_config_file="$OPENAIR_DIR/targets/bin/epc.local.enb.conf"
fi
- if [ $run_mscgen -eq 1 ]; then
+ if [ $g_run_msc_gen -eq 1 ]; then
rm -f /tmp/openair.msc.*
fi
exe_arguments="-O $epc_config_file $exe_arguments"
if [ $run_gdb -eq 0 ]; then
- $OPENAIR_DIR/targets/bin/mme_gw `echo $exe_arguments` 2>&1
+ # trap keyboard interrupt (control-c)
+ trap control_c SIGINT
+ $OPENAIR_DIR/targets/bin/mme_gw.Rel10 `echo $exe_arguments` 2>&1
else
+ # trap keyboard interrupt (control-c) is done by gdb
touch ~/.gdb_mme_gw
chmod 777 ~/.gdb_mme_gw
- echo "file $OPENAIR_DIR/targets/bin/mme_gw" > ~/.gdb_mme_gw
+ echo "file $OPENAIR_DIR/targets/bin/mme_gw.Rel10" > ~/.gdb_mme_gw
echo "set args $exe_arguments " >> ~/.gdb_mme_gw
echo "run" >> ~/.gdb_mme_gw
cat ~/.gdb_mme_gw
- gdb -n -x ~/.gdb_mme_gw
+ gdb -n -x ~/.gdb_mme_gw
+ if [ $g_run_msc_gen -eq 1 ]; then
+ do_msc_gen
+ fi
fi
-
- if [ $run_mscgen -eq 1 ]; then
- cd $MSC_DIR
- last_created_file=`ls -t mscgen* | head -1 | tr -d ':'`
- $OPENAIR_DIR/targets/SCRIPTS/msc_gen.py
- sync
- last_created_file2=`ls -t mscgen* | head -1 | tr -d ':'`
-
- if [ x"$last_created_file" != x"$last_created_file2" ]; then
- if [ -f ./$last_created_file2/oai_mscgen_page_0.png ]; then
- command -v eog 2>/dev/null && eog ./$last_created_file2/oai_mscgen_page_0.png
- fi
- fi
- fi
-
}
+sudo echo
+is_sudo=$?
+if [[ "$is_sudo" -ne 0 ]]; then
+ echo_error "This script must be run by root or a sudo'er"
+ echo
+ exit 1
+fi
main "$@"
diff --git a/cmake_targets/tools/test_helper b/cmake_targets/tools/test_helper
index e408102364..59ab9bc840 100644
--- a/cmake_targets/tools/test_helper
+++ b/cmake_targets/tools/test_helper
@@ -23,11 +23,17 @@ xUnit_start() {
# \pre xUnit_start() must have been called before
# \param $1 classname
# \param $2 testcase name
+# \param $3 testcase result
+# \param $4 run index
xUnit_fail() {
+ class=$1
+ test_case=$2
+ result=$3
+ run_index=$4
currtime=$(date +%s.%N)
time=$(echo "$currtime - $XUNIT_START" | bc -l)
- xml=""
- XUNIT_TESTCASES_XML="$XUNIT_TESTCASES_XML $xml"
+ xml=""
+ XUNIT_TESTCASES_XML="$XUNIT_TESTCASES_XML \n$xml"
XUNIT_FAILED=$((XUNIT_FAILED+1))
}
@@ -36,11 +42,17 @@ xUnit_fail() {
# \pre xUnit_start() must have been called before
# \param $1 classname
# \param $2 testcase name
+# \param $3 testcase result
+# \param $4 run index
xUnit_success() {
+ class=$1
+ test_case=$2
+ result=$3
+ run_index=$4
currtime=$(date +%s.%N)
time=$(echo "$currtime - $XUNIT_START" | bc -l)
- xml=""
- XUNIT_TESTCASES_XML="$XUNIT_TESTCASES_XML $xml"
+ xml=""
+ XUNIT_TESTCASES_XML="$XUNIT_TESTCASES_XML \n$xml"
XUNIT_SUCCESS=$((XUNIT_SUCCESS+1))
}
@@ -48,17 +60,18 @@ xUnit_success() {
# This functions writes out the test report.
# \param $1 filename
xUnit_write() {
+ filename=$1
tests=$((XUNIT_FAILED+XUNIT_SUCCESS))
timestamp=$(date --iso-8601=seconds)
time=$(echo "$currtime - $XUNIT_TESTSUITE_START" | bc -l)
xml_header=""
- echo $xml_header > $1
- echo $XUNIT_TESTCASES_XML >> $1
- echo "" >> $1
+ echo $xml_header > $filename
+ echo -e $XUNIT_TESTCASES_XML >> $filename
+ echo "" >> $filename
XUNIT_TESTSUITE_START=0
XUNIT_START=0
XUNIT_TOTAL=0
XUNIT_FAILED=0
XUNIT_SUCCESS=0
XUNIT_TESTCASES_XML=""
-}
\ No newline at end of file
+}
diff --git a/common/utils/itti/intertask_interface.c b/common/utils/itti/intertask_interface.c
index 3207e82463..c61dd07636 100644
--- a/common/utils/itti/intertask_interface.c
+++ b/common/utils/itti/intertask_interface.c
@@ -457,7 +457,9 @@ int itti_send_msg_to_task(task_id_t destination_task_id, instance_t instance, Me
new->message_priority = priority;
/* Enqueue message in destination task queue */
- lfds611_queue_enqueue(itti_desc.tasks[destination_task_id].message_queue, new);
+ if (lfds611_queue_enqueue(itti_desc.tasks[destination_task_id].message_queue, new) == 0) {
+ AssertFatal(0, "Error: lfds611_queue_enqueue returns 0, queue is full, exiting\n");
+ }
#if defined(OAI_EMU) || defined(RTAI)
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_ENQUEUE_MESSAGE, VCD_FUNCTION_OUT);
@@ -880,7 +882,7 @@ int itti_init(task_id_t task_max, thread_id_t thread_max, MessagesIds messages_i
ret = lfds611_queue_new(&itti_desc.tasks[task_id].message_queue, itti_desc.tasks_info[task_id].queue_size);
- if (ret < 0) {
+ if (0 == ret) {
AssertFatal (0, "lfds611_queue_new failed for task %s!\n", itti_get_task_name(task_id));
}
}
diff --git a/common/utils/itti/intertask_interface_types.h b/common/utils/itti/intertask_interface_types.h
index 3361911a11..3e0203df6d 100644
--- a/common/utils/itti/intertask_interface_types.h
+++ b/common/utils/itti/intertask_interface_types.h
@@ -37,6 +37,7 @@
#define INTERTASK_INTERFACE_TYPES_H_
#include "itti_types.h"
+#include "platform_types.h"
/* Defines to handle bit fields on unsigned long values */
#define UL_BIT_MASK(lENGTH) ((1UL << (lENGTH)) - 1UL)
diff --git a/common/utils/itti/signals.c b/common/utils/itti/signals.c
index c19427293f..e1950b4665 100644
--- a/common/utils/itti/signals.c
+++ b/common/utils/itti/signals.c
@@ -112,7 +112,7 @@ int signal_handle(int *end)
return ret;
}
- printf("Received signal %d\n", info.si_signo);
+ //printf("Received signal %d\n", info.si_signo);
/* Real-time signals are non constant and are therefore not suitable for
* use in switch.
diff --git a/common/utils/itti/timer.c b/common/utils/itti/timer.c
index ec63c9fe9d..25f70f04d7 100644
--- a/common/utils/itti/timer.c
+++ b/common/utils/itti/timer.c
@@ -93,7 +93,8 @@ int timer_handle_signal(siginfo_t *info)
/* Get back pointer to timer list element */
timer_p = (struct timer_elm_s *)info->si_ptr;
- TMR_DEBUG("Timer with id 0x%lx has expired\n", (long)timer_p->timer);
+ // LG: To many traces for msc timer:
+ // TMR_DEBUG("Timer with id 0x%lx has expired\n", (long)timer_p->timer);
task_id = timer_p->task_id;
instance = timer_p->instance;
diff --git a/common/utils/itti_analyzer/INSTALL b/common/utils/itti_analyzer/INSTALL
index a1e89e18ad..2099840756 100644
--- a/common/utils/itti_analyzer/INSTALL
+++ b/common/utils/itti_analyzer/INSTALL
@@ -1,7 +1,7 @@
Installation Instructions
*************************
-Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation,
+Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation,
Inc.
Copying and distribution of this file, with or without modification,
@@ -12,8 +12,8 @@ without warranty of any kind.
Basic Installation
==================
- Briefly, the shell commands `./configure; make; make install' should
-configure, build, and install this package. The following
+ Briefly, the shell command `./configure && make && make install'
+should configure, build, and install this package. The following
more-detailed instructions are generic; see the `README' file for
instructions specific to this package. Some packages provide this
`INSTALL' file but do not implement all of the features documented
@@ -309,9 +309,10 @@ causes the specified `gcc' to be used as the C compiler (unless it is
overridden in the site shell script).
Unfortunately, this technique does not work for `CONFIG_SHELL' due to
-an Autoconf bug. Until the bug is fixed you can use this workaround:
+an Autoconf limitation. Until the limitation is lifted, you can use
+this workaround:
- CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
+ CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
`configure' Invocation
======================
@@ -367,4 +368,3 @@ operates.
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.
-
diff --git a/common/utils/itti_analyzer/filters_mme.xml b/common/utils/itti_analyzer/filters_mme.xml
index 5a0ee89e95..7838982613 100644
--- a/common/utils/itti_analyzer/filters_mme.xml
+++ b/common/utils/itti_analyzer/filters_mme.xml
@@ -1,95 +1,111 @@
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
-
+
-
@@ -101,9 +117,8 @@
-
+
-
diff --git a/common/utils/msc/msc.c b/common/utils/msc/msc.c
index dcb620381f..9f7ed5ac3c 100644
--- a/common/utils/msc/msc.c
+++ b/common/utils/msc/msc.c
@@ -27,7 +27,7 @@
*******************************************************************************/
/*! \file msc.c
- * \brief Message chart generator logging utility (generated files to processed by a scrip to produce a mscgen input file for generating a sequence diagram document)
+ * \brief Message chart generator logging utility (generated files to processed by a script to produce a mscgen input file for generating a sequence diagram document)
* \author Lionel GAUTHIER
* \date 2015
* \email: lionel.gauthier@eurecom.fr
@@ -38,296 +38,358 @@
#include
#include
#include
+
+#include "liblfds611.h"
+#include "intertask_interface.h"
+#include "timer.h"
+
#include "msc.h"
+#include "assertions.h"
+
//-------------------------------
+#define MSC_MAX_QUEUE_ELEMENTS 1024
#define MSC_MAX_PROTO_NAME_LENGTH 16
+#define MSC_MAX_MESSAGE_LENGTH 512
+
//-------------------------------
-FILE* msc_fd[MAX_MSC_PROTOS]; // may need to split in more files to avoid overwrites (want to avoid mutexes)
-char msc_proto2str[MAX_MSC_PROTOS][MSC_MAX_PROTO_NAME_LENGTH];
-uint64_t msc_event_counter = 0;
+FILE* g_msc_fd;
+char g_msc_proto2str[MAX_MSC_PROTOS][MSC_MAX_PROTO_NAME_LENGTH];
+
+
+typedef unsigned long msc_message_number_t;
+typedef struct msc_queue_item_s {
+ char *message_str;
+ uint32_t message_str_size;
+ uint8_t *message_bin;
+ uint32_t message_bin_size;
+} msc_queue_item_t;
+
+msc_message_number_t g_message_number = 0;
+struct lfds611_queue_state *g_msc_message_queue_p = NULL;
+struct lfds611_stack_state *g_msc_memory_stack_p = NULL;
//------------------------------------------------------------------------------
-int msc_init(msc_env_t envP)
+void *msc_task(void *args_p)
//------------------------------------------------------------------------------
{
- int i;
- int rv;
+ MessageDef *received_message_p = NULL;
+ const char *msg_name = NULL;
+ instance_t instance = 0;
+ long timer_id;
+ itti_mark_task_ready(TASK_MSC);
+
+ msc_start_use();
+
+
+ timer_setup(0, // seconds
+ 50000, // usec
+ TASK_MSC,
+ INSTANCE_DEFAULT,
+ TIMER_PERIODIC,
+ NULL,
+ &timer_id);
+
+ while(1) {
+ itti_receive_msg(TASK_MSC, &received_message_p);
+
+ if (received_message_p != NULL) {
+ msg_name = ITTI_MSG_NAME (received_message_p);
+ instance = ITTI_MSG_INSTANCE (received_message_p);
+
+ switch (ITTI_MSG_ID(received_message_p)) {
+
+ case TIMER_HAS_EXPIRED: {
+ msc_flush_messages();
+ }
+ break;
+
+ case TERMINATE_MESSAGE: {
+ timer_remove(timer_id);
+ msc_end();
+ itti_exit_task();
+ }
+ break;
+
+ case MESSAGE_TEST: {
+ }
+ break;
+
+ default: {
+ }
+ break;
+ }
+ }
+ }
+ fprintf(stderr, "Task MSC exiting\n");
+ return NULL;
+}
+
+//------------------------------------------------------------------------------
+int msc_init(const msc_env_t envP, const int max_threadsP)
+//------------------------------------------------------------------------------
+{
+ int i;
+ int rv;
+ void *pointer_p;
+ char msc_filename[256];
fprintf(stderr, "Initializing MSC logs\n");
+
+ rv = snprintf(msc_filename, 256, "/tmp/openair.msc.%u.log", envP); // TODO NAME
+ if ((0 >= rv) || (256 < rv)){
+ fprintf(stderr, "Error in MSC log file name");
+ }
+ g_msc_fd = fopen(msc_filename,"w");
+ AssertFatal(g_msc_fd != NULL, "Could not open MSC log file %s : %s", msc_filename, strerror(errno));
+
+ rv = lfds611_stack_new(&g_msc_memory_stack_p, (lfds611_atom_t)max_threadsP + 2);
+ if (0 >= rv) {
+ AssertFatal (0, "lfds611_stack_new failed!\n");
+ }
+
+ rv = lfds611_queue_new(&g_msc_message_queue_p, (lfds611_atom_t)MSC_MAX_QUEUE_ELEMENTS);
+ AssertFatal (rv, "lfds611_queue_new failed!\n");
+ AssertFatal (g_msc_message_queue_p != NULL, "g_msc_message_queue_p is NULL!\n");
+ msc_start_use();
+
+ for (i=0; i < max_threadsP * 30; i++) {
+ pointer_p = malloc(MSC_MAX_MESSAGE_LENGTH);
+ AssertFatal (pointer_p, "malloc failed!\n");
+ rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, pointer_p );
+ AssertFatal (rv, "lfds611_stack_guaranteed_push failed for item %u\n", i);
+ }
+
for (i = MIN_MSC_PROTOS; i < MAX_MSC_PROTOS; i++) {
- msc_fd[i] = NULL;
- switch (i) {
+ switch (i) {
case MSC_IP_UE:
- rv = snprintf(&msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "IP_UE");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+ rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "IP_UE");
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
- msc_fd[i] = fopen("/tmp/openair.msc.ip_ue.log","w");
- if (msc_fd[i] == NULL) fprintf(stderr, "Could not open MSC log file /tmp/openair.msc.ip_ue.log : %s", strerror(errno));
msc_log_declare_proto(i);
}
break;
case MSC_IP_ENB:
- rv = snprintf(&msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "IP_ENB");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+ rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "IP_ENB");
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
if (envP == MSC_E_UTRAN_LIPA) {
- msc_fd[i] = fopen("/tmp/openair.msc.ip_enb.log","w");
- if (msc_fd[i] == NULL) fprintf(stderr, "Could not open MSC log file /tmp/openair.msc.ip_enb.log : %s", strerror(errno));
msc_log_declare_proto(i);
}
break;
case MSC_NAS_UE:
- rv = snprintf(&msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "NAS_UE");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+ rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "NAS_UE");
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
- msc_fd[i] = fopen("/tmp/openair.msc.nas_ue.log","w");
- if (msc_fd[i] == NULL) fprintf(stderr, "Could not open MSC log file /tmp/openair.msc.nas_ue.log : %s", strerror(errno));
msc_log_declare_proto(i);
}
break;
- case MSC_RRC_UE:
- rv = snprintf(&msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "RRC_UE");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
- if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
- msc_fd[i] = fopen("/tmp/openair.msc.rrc_ue.log","w");
- if (msc_fd[i] == NULL) fprintf(stderr, "Could not open MSC log file /tmp/openair.msc.rrc_ue.log : %s", strerror(errno));
- msc_log_declare_proto(i);
- }
- break;
- case MSC_PDCP_UE:
- rv = snprintf(&msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "PDCP_UE");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
- if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
- msc_fd[i] = fopen("/tmp/openair.msc.pdcp_ue.log","w");
- if (msc_fd[i] == NULL) fprintf(stderr, "Could not open MSC log file /tmp/openair.msc.pdcp_ue.log : %s", strerror(errno));
- msc_log_declare_proto(i);
- }
- break;
- case MSC_RLC_UE:
- rv = snprintf(&msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "RLC_UE");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
- if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
- msc_fd[i] = fopen("/tmp/openair.msc.rlc_ue.log","w");
- if (msc_fd[i] == NULL) fprintf(stderr, "Could not open MSC log file /tmp/openair.msc.rlc_ue.log : %s", strerror(errno));
- msc_log_declare_proto(i);
- }
- break;
- case MSC_MAC_UE:
- rv = snprintf(&msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "MAC_UE");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
- if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
- msc_fd[i] = fopen("/tmp/openair.msc.mac_ue.log","w");
- if (msc_fd[i] == NULL) fprintf(stderr, "Could not open MSC log file /tmp/openair.msc.mac_ue.log : %s", strerror(errno));
- msc_log_declare_proto(i);
- }
- break;
- case MSC_PHY_UE:
- rv = snprintf(&msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "PHY_UE");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
- if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
- msc_fd[i] = fopen("/tmp/openair.msc.phy_ue.log","w");
- if (msc_fd[i] == NULL) fprintf(stderr, "Could not open MSC log file /tmp/openair.msc.phy_ue.log : %s", strerror(errno));
- msc_log_declare_proto(i);
- }
- break;
- case MSC_PHY_ENB:
- rv = snprintf(&msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "PHY_ENB");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
- if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
- msc_fd[i] = fopen("/tmp/openair.msc.phy_enb.log","w");
- if (msc_fd[i] == NULL) fprintf(stderr, "Could not open MSC log file /tmp/openair.msc.phy_enb.log : %s", strerror(errno));
- msc_log_declare_proto(i);
- }
- break;
- case MSC_MAC_ENB:
- rv = snprintf(&msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "MAC_ENB");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
- if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
- msc_fd[i] = fopen("/tmp/openair.msc.mac_enb.log","w");
- if (msc_fd[i] == NULL) fprintf(stderr, "Could not open MSC log file /tmp/openair.msc.mac_enb.log : %s", strerror(errno));
- msc_log_declare_proto(i);
- }
- break;
- case MSC_RLC_ENB:
- rv = snprintf(&msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "RLC_ENB");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
- if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
- msc_fd[i] = fopen("/tmp/openair.msc.rlc_enb.log","w");
- if (msc_fd[i] == NULL) fprintf(stderr, "Could not open MSC log file /tmp/openair.msc.rlc_enb.log : %s", strerror(errno));
- msc_log_declare_proto(i);
- }
- break;
- case MSC_PDCP_ENB:
- rv = snprintf(&msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "PDCP_ENB");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
- if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
- msc_fd[i] = fopen("/tmp/openair.msc.pdcp_enb.log","w");
- if (msc_fd[i] == NULL) fprintf(stderr, "Could not open MSC log file /tmp/openair.msc.pdcp_enb.log : %s", strerror(errno));
- msc_log_declare_proto(i);
- }
- break;
- case MSC_RRC_ENB:
- rv = snprintf(&msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "RRC_ENB");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
- if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
- msc_fd[i] = fopen("/tmp/openair.msc.rrc_enb.log","w");
- if (msc_fd[i] == NULL) fprintf(stderr, "Could not open MSC log file /tmp/openair.msc.rrc_enb.log : %s", strerror(errno));
- msc_log_declare_proto(i);
- }
- break;
- case MSC_S1AP_ENB:
- rv = snprintf(&msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "S1AP_ENB");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
- if ((envP == MSC_E_UTRAN) || (envP == MSC_EPC) || (envP == MSC_MME)) {
- if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
- msc_fd[i] = fopen("/tmp/openair.msc.s1ap_enb.log","w");
- if (msc_fd[i] == NULL) fprintf(stderr, "Could not open MSC log file /tmp/openair.msc.s1ap_enb.log : %s", strerror(errno));
- } else {
- msc_fd[i] = fopen("/tmp/openair.msc.s1ap_enb.epc.log","w");
- if (msc_fd[i] == NULL) fprintf(stderr, "Could not open MSC log file /tmp/openair.msc.s1ap_enb.epc.log : %s", strerror(errno));
- }
- msc_log_declare_proto(i);
- }
- break;
- case MSC_GTPU_ENB:
- rv = snprintf(&msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "GTPU_ENB");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
- if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
- msc_fd[i] = fopen("/tmp/openair.msc.gtpu_enb.log","w");
- if (msc_fd[i] == NULL) fprintf(stderr, "Could not open MSC log file /tmp/openair.msc.gtpu_enb.log : %s", strerror(errno));
- msc_log_declare_proto(i);
- }
- break;
- case MSC_GTPU_SGW:
- rv = snprintf(&msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "GTPU_SGW");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
- if ((envP == MSC_EPC) || (envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
- if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
- msc_fd[i] = fopen("/tmp/openair.msc.gtpu_sgw.utran.log","w");
- if (msc_fd[i] == NULL) fprintf(stderr, "Could not open MSC log file /tmp/openair.msc.gtpu_sgw.utran.log : %s", strerror(errno));
- } else {
- msc_fd[i] = fopen("/tmp/openair.msc.gtpu_sgw.log","w");
- if (msc_fd[i] == NULL) fprintf(stderr, "Could not open MSC log file /tmp/openair.msc.gtpu_sgw.log : %s", strerror(errno));
- }
- msc_log_declare_proto(i);
- }
- break;
- case MSC_S1AP_MME:
- rv = snprintf(&msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "S1AP_MME");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
- if ((envP == MSC_EPC) || (envP == MSC_MME) || (envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
- if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
- msc_fd[i] = fopen("/tmp/openair.msc.s1ap_mme.utran.log","w");
- if (msc_fd[i] == NULL) fprintf(stderr, "Could not open MSC log file /tmp/openair.msc.s1ap_mme.utran.log : %s", strerror(errno));
- } else {
- msc_fd[i] = fopen("/tmp/openair.msc.s1ap_mme.log","w");
- if (msc_fd[i] == NULL) fprintf(stderr, "Could not open MSC log file /tmp/openair.msc.s1ap_mme.log : %s", strerror(errno));
- }
- msc_log_declare_proto(i);
- }
- break;
- case MSC_MMEAPP_MME:
- rv = snprintf(&msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "MME_APP");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
- if ((envP == MSC_EPC) || (envP == MSC_MME)) {
- msc_fd[i] = fopen("/tmp/openair.msc.mme_app.log","w");
- if (msc_fd[i] == NULL) fprintf(stderr, "Could not open MSC log file /tmp/openair.msc.mme_app.log : %s", strerror(errno));
- msc_log_declare_proto(i);
- }
- break;
- case MSC_NAS_MME:
- rv = snprintf(&msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "NAS_MME");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
- if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
- msc_fd[i] = fopen("/tmp/openair.msc.nas_mme.utran.log","w");
- if (msc_fd[i] == NULL) fprintf(stderr, "Could not open MSC log file /tmp/openair.msc.nas_mme.utran.log : %s", strerror(errno));
- } else {
- msc_fd[i] = fopen("/tmp/openair.msc.nas_mme.log","w");
- if (msc_fd[i] == NULL) fprintf(stderr, "Could not open MSC log file /tmp/openair.msc.nas_mme.log : %s", strerror(errno));
- }
+ case MSC_RRC_UE:
+ rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "RRC_UE");
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+ if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
msc_log_declare_proto(i);
- break;
- case MSC_NAS_EMM_MME:
- rv = snprintf(&msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "NAS_EMM");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
- if ((envP == MSC_EPC) || (envP == MSC_MME)) {
- msc_fd[i] = fopen("/tmp/openair.msc.nas_emm_mme.log","w");
- if (msc_fd[i] == NULL) fprintf(stderr, "Could not open MSC log file /tmp/openair.msc.nas_emm_mme.log : %s", strerror(errno));
- msc_log_declare_proto(i);
- }
- break;
- case MSC_NAS_ESM_MME:
- rv = snprintf(&msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "NAS_ESM");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
- if ((envP == MSC_EPC) || (envP == MSC_MME)) {
- msc_fd[i] = fopen("/tmp/openair.msc.nas_esm_mme.log","w");
- if (msc_fd[i] == NULL) fprintf(stderr, "Could not open MSC log file /tmp/openair.msc.nas_esm_mme.log : %s", strerror(errno));
- msc_log_declare_proto(i);
- }
- break;
- case MSC_SP_GWAPP_MME:
- rv = snprintf(&msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "SP_GW_MME");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
- if (envP == MSC_EPC) {
- msc_fd[i] = fopen("/tmp/openair.msc.spgwapp_mme.log","w");
- if (msc_fd[i] == NULL) fprintf(stderr, "Could not open MSC log file /tmp/openair.msc.spgwapp_mme.log : %s", strerror(errno));
- msc_log_declare_proto(i);
- }
- break;
- case MSC_S11_MME:
- rv = snprintf(&msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "S11_MME");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
- if (envP == MSC_MME) {
- msc_fd[i] = fopen("/tmp/openair.msc.s11_mme.log","w");
- if (msc_fd[i] == NULL) fprintf(stderr, "Could not open MSC log file /tmp/openair.msc.s11_mme.log : %s", strerror(errno));
- msc_log_declare_proto(i);
- }
- break;
- case MSC_S6A_MME:
- rv = snprintf(&msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "S6A");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
- if ((envP == MSC_EPC) || (envP == MSC_MME)) {
- msc_fd[i] = fopen("/tmp/openair.msc.s6a_mme.log","w");
- if (msc_fd[i] == NULL) fprintf(stderr, "Could not open MSC log file /tmp/openair.msc.s6a_mme.log : %s", strerror(errno));
- msc_log_declare_proto(i);
- }
- break;
- case MSC_HSS:
- rv = snprintf(&msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "HSS");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
- if ((envP == MSC_EPC) || (envP == MSC_MME)) {
- msc_fd[i] = fopen("/tmp/openair.msc.hss.log","w");
- if (msc_fd[i] == NULL) fprintf(stderr, "Could not open MSC log file /tmp/openair.msc.hss.log : %s", strerror(errno));
- msc_log_declare_proto(i);
- }
- break;
- default:
- rv = snprintf(&msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "UNKNOWN");
- if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
- msc_fd[i] = NULL;
- }
+ }
+ break;
+ case MSC_PDCP_UE:
+ rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "PDCP_UE");
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+ if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
+ msc_log_declare_proto(i);
+ }
+ break;
+ case MSC_RLC_UE:
+ rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "RLC_UE");
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+ if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
+ msc_log_declare_proto(i);
+ }
+ break;
+ case MSC_MAC_UE:
+ rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "MAC_UE");
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+ if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
+ msc_log_declare_proto(i);
+ }
+ break;
+ case MSC_PHY_UE:
+ rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "PHY_UE");
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+ if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
+ msc_log_declare_proto(i);
+ }
+ break;
+ case MSC_PHY_ENB:
+ rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "PHY_ENB");
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+ if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
+ msc_log_declare_proto(i);
+ }
+ break;
+ case MSC_MAC_ENB:
+ rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "MAC_ENB");
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+ if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
+ msc_log_declare_proto(i);
+ }
+ break;
+ case MSC_RLC_ENB:
+ rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "RLC_ENB");
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+ if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
+ msc_log_declare_proto(i);
+ }
+ break;
+ case MSC_PDCP_ENB:
+ rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "PDCP_ENB");
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+ if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
+ msc_log_declare_proto(i);
+ }
+ break;
+ case MSC_RRC_ENB:
+ rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "RRC_ENB");
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+ if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
+ msc_log_declare_proto(i);
+ }
+ break;
+ case MSC_S1AP_ENB:
+ rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "S1AP_ENB");
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+ if ((envP == MSC_E_UTRAN) || (envP == MSC_MME_GW) || (envP == MSC_MME)) {
+ msc_log_declare_proto(i);
+ }
+ break;
+ case MSC_GTPU_ENB:
+ rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "GTPU_ENB");
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+ if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
+ msc_log_declare_proto(i);
+ }
+ break;
+ case MSC_GTPU_SGW:
+ rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "GTPU_SGW");
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+ if ((envP == MSC_MME_GW) || (envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
+ msc_log_declare_proto(i);
+ }
+ break;
+ case MSC_S1AP_MME:
+ rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "S1AP_MME");
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+ if ((envP == MSC_MME_GW) || (envP == MSC_MME) || (envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
+ msc_log_declare_proto(i);
+ }
+ break;
+ case MSC_MMEAPP_MME:
+ rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "MME_APP");
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+ if ((envP == MSC_MME_GW) || (envP == MSC_MME)) {
+ msc_log_declare_proto(i);
+ }
+ break;
+ case MSC_NAS_MME:
+ rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "NAS_MME");
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+ msc_log_declare_proto(i);
+ break;
+ case MSC_NAS_EMM_MME:
+ rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "NAS_EMM");
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+ if ((envP == MSC_MME_GW) || (envP == MSC_MME)) {
+ msc_log_declare_proto(i);
+ }
+ break;
+ case MSC_NAS_ESM_MME:
+ rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "NAS_ESM");
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+ if ((envP == MSC_MME_GW) || (envP == MSC_MME)) {
+ msc_log_declare_proto(i);
+ }
+ break;
+ case MSC_SP_GWAPP_MME:
+ rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "SP_GW_MME");
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+ if (envP == MSC_MME_GW) {
+ msc_log_declare_proto(i);
+ }
+ break;
+ case MSC_S11_MME:
+ rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "S11_MME");
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+ if (envP == MSC_MME) {
+ msc_log_declare_proto(i);
+ }
+ break;
+ case MSC_S6A_MME:
+ rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "S6A");
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+ if ((envP == MSC_MME_GW) || (envP == MSC_MME)) {
+ msc_log_declare_proto(i);
+ }
+ break;
+ case MSC_HSS:
+ rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "HSS");
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+ if ((envP == MSC_MME_GW) || (envP == MSC_MME)) {
+ msc_log_declare_proto(i);
+ }
+ break;
+ default:
+ rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "UNKNOWN");
+ if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+ }
}
+ rv = itti_create_task (TASK_MSC, msc_task, NULL);
+ AssertFatal (rv == 0, "Create task for MSC failed!\n");
+ fprintf(stderr, "Initializing MSC logs Done\n");
return 0;
}
+//------------------------------------------------------------------------------
+void msc_start_use(void)
+//------------------------------------------------------------------------------
+{
+ lfds611_queue_use(g_msc_message_queue_p);
+ lfds611_stack_use(g_msc_memory_stack_p);
+}
+
+
+//------------------------------------------------------------------------------
+void msc_flush_messages(void)
+//------------------------------------------------------------------------------
+{
+ int rv;
+ msc_queue_item_t *item_p = NULL;
+
+ while ((rv = lfds611_queue_dequeue( g_msc_message_queue_p, (void**)&item_p )) == 1) {
+ if (NULL != item_p->message_str) {
+ fputs(item_p->message_str, g_msc_fd);
+ // TODO BIN DATA
+ rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, item_p->message_str );
+ }
+ // TODO FREE BIN DATA
+ free(item_p);
+ }
+ fflush(g_msc_fd);
+}
+
//------------------------------------------------------------------------------
void msc_end(void)
//------------------------------------------------------------------------------
{
int rv;
- int i;
- for (i = MIN_MSC_PROTOS; i < MAX_MSC_PROTOS; i++) {
- if (msc_fd[i] != NULL) {
- rv = fflush(msc_fd[i]);
- if (rv != 0) {
- fprintf(stderr, "Error while flushing stream of MSC log file: %s", strerror(errno));
- }
- rv = fclose(msc_fd[i]);
- if (rv != 0) {
- fprintf(stderr, "Error while closing MSC log file: %s", strerror(errno));
- }
- }
+ if (NULL != g_msc_fd ) {
+ msc_flush_messages();
+ rv = fflush(g_msc_fd);
+ if (rv != 0) {
+ fprintf(stderr, "Error while flushing stream of MSC log file: %s", strerror(errno));
+ }
+ rv = fclose(g_msc_fd);
+ if (rv != 0) {
+ fprintf(stderr, "Error while closing MSC log file: %s", strerror(errno));
+ }
}
}
@@ -337,20 +399,46 @@ void msc_log_declare_proto(
)
//------------------------------------------------------------------------------
{
- int rv;
- uint64_t local_msc_event_counter = msc_event_counter;
- msc_event_counter++;
- if ((protoP >= MIN_MSC_PROTOS) && (protoP < MAX_MSC_PROTOS)) {
- if (msc_fd[protoP] != NULL) {
- rv = fprintf(msc_fd[protoP], "%"PRIu64" [PROTO] %d %s\n", local_msc_event_counter, protoP, &msc_proto2str[protoP][0]);
- if (rv < 0) {
- fprintf(stderr, "Error while declaring new protocol in MSC log file: %s", strerror(errno));
- }
- rv = fflush(msc_fd[protoP]);
- if (rv != 0) {
- fprintf(stderr, "Error while flushing stream of MSC log file: %s", strerror(errno));
- }
- }
+ int rv = 0;
+ msc_queue_item_t *new_item_p = NULL;
+ char *char_message_p = NULL;
+
+ if ((MIN_MSC_PROTOS <= protoP) && (MAX_MSC_PROTOS > protoP)) {
+ // may be build a memory pool for that also ?
+ new_item_p = malloc(sizeof(msc_queue_item_t));
+ if (NULL != new_item_p) {
+
+ rv = lfds611_stack_pop(g_msc_memory_stack_p, (void**)&char_message_p);
+ if (0 == rv) {
+ msc_flush_messages();
+ rv = lfds611_stack_pop(g_msc_memory_stack_p, (void**)&char_message_p);
+ }
+ if (1 == rv) {
+ rv = snprintf(char_message_p, MSC_MAX_MESSAGE_LENGTH, "%"PRIu64" [PROTO] %d %s\n", __sync_fetch_and_add (&g_message_number, 1), protoP, &g_msc_proto2str[protoP][0]);
+ if (0 > rv) {
+ fprintf(stderr, "Error while declaring new protocol in MSC: %s", strerror(errno));
+ }
+ new_item_p->message_str = char_message_p;
+ new_item_p->message_str_size = rv;
+ new_item_p->message_bin = NULL;
+ new_item_p->message_bin_size = 0;
+ rv = lfds611_queue_enqueue( g_msc_message_queue_p, new_item_p );
+ if (0 == rv) {
+ rv = lfds611_queue_guaranteed_enqueue(g_msc_message_queue_p, new_item_p );
+ if (0 == rv) {
+ fprintf(stderr, "Error while lfds611_queue_guaranteed_enqueue message %s in MSC", char_message_p);
+ rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, char_message_p );
+ free(new_item_p);
+ }
+ }
+ return;
+ } else {
+ fprintf(stderr, "Error while lfds611_stack_pop()\n");
+ }
+ free(new_item_p);
+ } else {
+ fprintf(stderr, "Error while malloc in MSC");
+ }
}
}
//------------------------------------------------------------------------------
@@ -359,202 +447,134 @@ void msc_log_event(
char *format, ...)
//------------------------------------------------------------------------------
{
- va_list args;
- int rv;
- uint64_t local_msc_event_counter = msc_event_counter;
+ va_list args;
+ int rv;
+ int rv2;
+ msc_queue_item_t *new_item_p = NULL;
+ char *char_message_p = NULL;
- msc_event_counter++;
- if ((protoP < MIN_MSC_PROTOS) || (protoP >= MAX_MSC_PROTOS)) {
+ if ((MIN_MSC_PROTOS > protoP) || (MAX_MSC_PROTOS <= protoP)) {
return;
}
- if (msc_fd[protoP] != NULL) {
- rv = fprintf(msc_fd[protoP], "%"PRIu64" [EVENT] %d ", local_msc_event_counter, protoP);
- if (rv < 0) {
- fprintf(stderr, "Error while logging MSC event : %s", &msc_proto2str[protoP][0]);
+ new_item_p = malloc(sizeof(msc_queue_item_t));
+ if (NULL != new_item_p) {
+
+ rv = lfds611_stack_pop(g_msc_memory_stack_p, (void**)&char_message_p);
+ if (0 == rv) {
+ msc_flush_messages();
+ rv = lfds611_stack_pop(g_msc_memory_stack_p, (void**)&char_message_p);
+ }
+ if (1 == rv) {
+ rv = snprintf(char_message_p, MSC_MAX_MESSAGE_LENGTH, "%"PRIu64" [EVENT] %d ", __sync_fetch_and_add (&g_message_number, 1), protoP);
+ if ((0 > rv) || (MSC_MAX_MESSAGE_LENGTH < rv)) {
+ fprintf(stderr, "Error while logging MSC event : %s", &g_msc_proto2str[protoP][0]);
+ goto error_event;
}
va_start(args, format);
- rv = vfprintf(msc_fd[protoP], format, args);
+ rv2 = vsnprintf(&char_message_p[rv],MSC_MAX_MESSAGE_LENGTH - rv, format, args);
va_end(args);
- if (rv < 0) {
- fprintf(stderr, "Error while logging MSC event : %s", &msc_proto2str[protoP][0]);
+ if ((0 > rv2) || ((MSC_MAX_MESSAGE_LENGTH - rv) < rv2)) {
+ fprintf(stderr, "Error while logging MSC event : %s", &g_msc_proto2str[protoP][0]);
+ goto error_event;
}
- rv = fprintf(msc_fd[protoP], "\n");
- if (rv < 0) {
- fprintf(stderr, "Error while logging MSC event : %s", &msc_proto2str[protoP][0]);
+ rv += rv2;
+ rv2 = snprintf(&char_message_p[rv],MSC_MAX_MESSAGE_LENGTH - rv, "\n");
+ if ((0 > rv2) || ((MSC_MAX_MESSAGE_LENGTH - rv) < rv2)) {
+ fprintf(stderr, "Error while logging MSC event : %s", &g_msc_proto2str[protoP][0]);
+ goto error_event;
}
-#if 1
- rv = fflush(msc_fd[protoP]);
- if (rv != 0) {
- fprintf(stderr, "Error while flushing stream of MSC log file: %s", strerror(errno));
+ rv += rv2;
+ new_item_p->message_str = char_message_p;
+ new_item_p->message_str_size = rv;
+ new_item_p->message_bin = NULL;
+ new_item_p->message_bin_size = 0;
+ rv = lfds611_queue_enqueue( g_msc_message_queue_p, new_item_p );
+ if (0 == rv) {
+ fprintf(stderr, "Error while lfds611_queue_guaranteed_enqueue message %s in MSC", char_message_p);
+ rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, char_message_p );
+ free(new_item_p);
}
-#endif
+ } else {
+ fprintf(stderr, "Error while lfds611_stack_pop()\n");
+ }
}
+ return;
+error_event:
+ rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, char_message_p );
+ free(new_item_p);
}
//------------------------------------------------------------------------------
-void msc_log_rx_message(
- const msc_proto_t receiverP,
- const msc_proto_t senderP,
- const char* bytesP,
+void msc_log_message(
+ const char * const message_operationP,
+ const msc_proto_t proto1P,
+ const msc_proto_t proto2P,
+ const uint8_t * const bytesP,
const unsigned int num_bytes,
char *format, ...)
//------------------------------------------------------------------------------
{
- va_list args;
- int rv;
- uint64_t mac = 0;
- uint64_t local_msc_event_counter = msc_event_counter;
+ va_list args;
+ uint64_t mac = 0; // TO DO mac on bytesP param
+ int rv;
+ int rv2;
+ msc_queue_item_t *new_item_p = NULL;
+ char *char_message_p = NULL;
- msc_event_counter++;
- if ((receiverP < MIN_MSC_PROTOS) || (receiverP >= MAX_MSC_PROTOS) ||
- (senderP < MIN_MSC_PROTOS) || (senderP >= MAX_MSC_PROTOS)) {
- return;
+ if ((MIN_MSC_PROTOS > proto1P) || (MAX_MSC_PROTOS <= proto1P) ||
+ (MIN_MSC_PROTOS > proto2P) || (MAX_MSC_PROTOS <= proto2P) ) {
+ return;
}
- if (msc_fd[receiverP] != NULL) {
- rv = fprintf(msc_fd[receiverP], "%"PRIu64" [MESSAGE] %d <- %d %"PRIu64" ",
- local_msc_event_counter, receiverP, senderP, mac);
- if (rv < 0) {
- fprintf(stderr, "Error while logging MSC RX message : %s", &msc_proto2str[receiverP][0]);
+
+ new_item_p = malloc(sizeof(msc_queue_item_t));
+ if (NULL != new_item_p) {
+
+ rv = lfds611_stack_pop(g_msc_memory_stack_p, (void**)&char_message_p);
+ if (0 == rv) {
+ msc_flush_messages();
+ rv = lfds611_stack_pop(g_msc_memory_stack_p, (void**)&char_message_p);
+ }
+ if (1 == rv) {
+ rv = snprintf(char_message_p, MSC_MAX_MESSAGE_LENGTH, "%"PRIu64" [MESSAGE] %d %s %d %"PRIu64" ",
+ __sync_fetch_and_add (&g_message_number, 1), proto1P, message_operationP, proto2P, mac);
+ if ((0 > rv) || (MSC_MAX_MESSAGE_LENGTH < rv)) {
+ fprintf(stderr, "Error while logging MSC message : %s/%s", &g_msc_proto2str[proto1P][0], &g_msc_proto2str[proto2P][0]);
+ goto error_event;
}
va_start(args, format);
- rv = vfprintf(msc_fd[receiverP], format, args);
+ rv2 = vsnprintf(&char_message_p[rv],MSC_MAX_MESSAGE_LENGTH - rv, format, args);
va_end(args);
- if (rv < 0) {
- fprintf(stderr, "Error while logging MSC RX message : %s", &msc_proto2str[receiverP][0]);
+ if ((0 > rv2) || ((MSC_MAX_MESSAGE_LENGTH - rv) < rv2)) {
+ fprintf(stderr, "Error while logging MSC message : %s/%s", &g_msc_proto2str[proto1P][0], &g_msc_proto2str[proto2P][0]);
+ goto error_event;
}
- rv = fprintf(msc_fd[receiverP], "\n");
- if (rv < 0) {
- fprintf(stderr, "Error while logging MSC RX message : %s", &msc_proto2str[receiverP][0]);
- }
- if ((msc_event_counter & 0x000000000000000F) == 0x000000000000000F) {
- fflush(msc_fd[receiverP]);
- }
- }
-}
-//------------------------------------------------------------------------------
-void msc_log_rx_discarded_message(
- const msc_proto_t receiverP,
- const msc_proto_t senderP,
- const char* bytesP,
- const unsigned int num_bytes,
- char *format, ...)
-//------------------------------------------------------------------------------
-{
- va_list args;
- int rv;
- uint64_t mac = 0;
- uint64_t local_msc_event_counter = msc_event_counter;
-
- msc_event_counter++;
-
- if ((receiverP < MIN_MSC_PROTOS) || (receiverP >= MAX_MSC_PROTOS) ||
- (senderP < MIN_MSC_PROTOS) || (senderP >= MAX_MSC_PROTOS)) {
- return;
- }
- if (msc_fd[receiverP] != NULL) {
- rv = fprintf(msc_fd[receiverP], "%"PRIu64" [MESSAGE] %d x- %d %"PRIu64" ",
- local_msc_event_counter, receiverP, senderP, mac);
- if (rv < 0) {
- fprintf(stderr, "Error while logging MSC RX message : %s", &msc_proto2str[receiverP][0]);
- }
- va_start(args, format);
- rv = vfprintf(msc_fd[receiverP], format, args);
- va_end(args);
- if (rv < 0) {
- fprintf(stderr, "Error while logging MSC RX message : %s", &msc_proto2str[receiverP][0]);
- }
- rv = fprintf(msc_fd[receiverP], "\n");
- if (rv < 0) {
- fprintf(stderr, "Error while logging MSC RX message : %s", &msc_proto2str[receiverP][0]);
- }
- if ((msc_event_counter & 0x000000000000000F) == 0x000000000000000F) {
- fflush(msc_fd[receiverP]);
- }
- }
-}
-//------------------------------------------------------------------------------
-void msc_log_tx_message(
- const msc_proto_t senderP,
- const msc_proto_t receiverP,
- const char* bytesP,
- const unsigned int num_bytes,
- char *format, ...)
-//------------------------------------------------------------------------------
-{
- va_list args;
- int rv;
- uint64_t mac = 0;
- uint64_t local_msc_event_counter = msc_event_counter;
-
- msc_event_counter++;
-
- if ((receiverP < MIN_MSC_PROTOS) || (receiverP >= MAX_MSC_PROTOS) ||
- (senderP < MIN_MSC_PROTOS) || (senderP >= MAX_MSC_PROTOS)) {
- return;
- }
- if (msc_fd[senderP] != NULL) {
- rv = fprintf(msc_fd[senderP], "%"PRIu64" [MESSAGE] %d -> %d %"PRIu64" ",
- local_msc_event_counter, senderP, receiverP, mac);
- if (rv < 0) {
- fprintf(stderr, "Error while logging MSC TX message : %s", &msc_proto2str[senderP][0]);
- }
- va_start(args, format);
- rv = vfprintf(msc_fd[senderP], format, args);
- va_end(args);
- if (rv < 0) {
- fprintf(stderr, "Error while logging MSC TX message : %s", &msc_proto2str[senderP][0]);
- }
- rv = fprintf(msc_fd[senderP], "\n");
- if (rv < 0) {
- fprintf(stderr, "Error while logging MSC TX message : %s", &msc_proto2str[senderP][0]);
- }
- if ((msc_event_counter & 0x000000000000000F) == 0x000000000000000F) {
- fflush(msc_fd[senderP]);
- }
- }
-}
-
-//------------------------------------------------------------------------------
-void msc_log_tx_message_failed(
- const msc_proto_t senderP,
- const msc_proto_t receiverP,
- const char* bytesP,
- const unsigned int num_bytes,
- char *format, ...)
-//------------------------------------------------------------------------------
-{
- va_list args;
- int rv;
- uint64_t mac = 0;
- uint64_t local_msc_event_counter = msc_event_counter;
-
- msc_event_counter++;
-
- if ((receiverP < MIN_MSC_PROTOS) || (receiverP >= MAX_MSC_PROTOS) ||
- (senderP < MIN_MSC_PROTOS) || (senderP >= MAX_MSC_PROTOS)) {
- return;
- }
- if (msc_fd[senderP] != NULL) {
- rv = fprintf(msc_fd[senderP], "%"PRIu64" [MESSAGE] %d -x %d %"PRIu64" ",
- local_msc_event_counter, senderP, receiverP, mac);
- if (rv < 0) {
- fprintf(stderr, "Error while logging MSC TX message : %s", &msc_proto2str[senderP][0]);
- }
- va_start(args, format);
- rv = vfprintf(msc_fd[senderP], format, args);
- va_end(args);
- if (rv < 0) {
- fprintf(stderr, "Error while logging MSC TX message : %s", &msc_proto2str[senderP][0]);
- }
- rv = fprintf(msc_fd[senderP], "\n");
- if (rv < 0) {
- fprintf(stderr, "Error while logging MSC TX message : %s", &msc_proto2str[senderP][0]);
- }
- if ((msc_event_counter & 0x000000000000000F) == 0x000000000000000F) {
- fflush(msc_fd[senderP]);
+ rv += rv2;
+ rv2 = snprintf(&char_message_p[rv],MSC_MAX_MESSAGE_LENGTH - rv, "\n");
+ if ((0 > rv2) || ((MSC_MAX_MESSAGE_LENGTH - rv) < rv2)) {
+ fprintf(stderr, "Error while logging MSC message : %s/%s", &g_msc_proto2str[proto1P][0], &g_msc_proto2str[proto2P][0]);
+ goto error_event;
}
+ rv += rv2;
+ new_item_p->message_str = char_message_p;
+ new_item_p->message_str_size = rv;
+ new_item_p->message_bin = NULL; // TO DO
+ new_item_p->message_bin_size = 0; // TO DO
+ rv = lfds611_queue_enqueue( g_msc_message_queue_p, new_item_p );
+ if (0 == rv) {
+ fprintf(stderr, "Error while lfds611_queue_guaranteed_enqueue message %s in MSC", char_message_p);
+ rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, char_message_p );
+ free(new_item_p);
+ }
+ } else {
+ fprintf(stderr, "Error while lfds611_stack_pop()\n");
+ msc_flush_messages();
+ }
}
+ return;
+error_event:
+ rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, char_message_p );
+ free(new_item_p);
}
diff --git a/common/utils/msc/msc.h b/common/utils/msc/msc.h
index c7d541e5a6..b5c0c83280 100644
--- a/common/utils/msc/msc.h
+++ b/common/utils/msc/msc.h
@@ -30,12 +30,13 @@
#ifndef MSC_H_
#define MSC_H_
#include
+#include
typedef enum {
MIN_MSC_ENV = 0,
MSC_E_UTRAN = MIN_MSC_ENV,
MSC_E_UTRAN_LIPA,
- MSC_EPC,
+ MSC_MME_GW,
MSC_MME,
MSC_SP_GW,
MAX_MSC_ENV
@@ -81,44 +82,32 @@ typedef enum {
(CTXT_Pp)->frame, \
(CTXT_Pp)->subframe
#if defined(MESSAGE_CHART_GENERATOR)
-int msc_init(msc_env_t envP);
+int msc_init(const msc_env_t envP, const int max_threadsP);
+void msc_start_use(void);
+void msc_flush_messages(void);
void msc_end(void);
void msc_log_declare_proto(const msc_proto_t protoP);
void msc_log_event(const msc_proto_t protoP,char *format, ...);
-void msc_log_rx_message(
+void msc_log_message(
+ const char * const message_operationP,
const msc_proto_t receiverP,
const msc_proto_t senderP,
- const char* bytesP,
+ const uint8_t* const bytesP,
const unsigned int num_bytes,
char *format, ...);
-void msc_log_rx_discarded_message(
- const msc_proto_t receiverP,
- const msc_proto_t senderP,
- const char* bytesP,
- const unsigned int num_bytes,
- char *format, ...);
-void msc_log_tx_message(
- const msc_proto_t senderP,
- const msc_proto_t receiverP,
- const char* bytesP,
- const unsigned int num_bytes,
- char *format, ...);
-void msc_log_tx_message_failed(
- const msc_proto_t senderP,
- const msc_proto_t receiverP,
- const char* bytesP,
- const unsigned int num_bytes,
- char *format, ...);
-#define MSC_INIT(mScPaRaMs) msc_init(mScPaRaMs)
+
+#define MSC_INIT(arg1,arg2) msc_init(arg1,arg2)
+#define MSC_START_USE msc_start_use
#define MSC_END msc_end
#define MSC_LOG_EVENT(mScPaRaMs, fORMAT, aRGS...) msc_log_event(mScPaRaMs, fORMAT, ##aRGS)
-#define MSC_LOG_RX_MESSAGE(mScPaRaMs, fORMAT, aRGS...) msc_log_rx_message(mScPaRaMs, fORMAT, ##aRGS)
-#define MSC_LOG_RX_DISCARDED_MESSAGE(mScPaRaMs, fORMAT, aRGS...) msc_log_rx_discarded_message(mScPaRaMs, fORMAT, ##aRGS)
-#define MSC_LOG_TX_MESSAGE(mScPaRaMs, fORMAT, aRGS...) msc_log_tx_message(mScPaRaMs, fORMAT, ##aRGS)
-#define MSC_LOG_TX_MESSAGE_FAILED(mScPaRaMs, fORMAT, aRGS...) msc_log_tx_message_failed(mScPaRaMs, fORMAT, ##aRGS)
+#define MSC_LOG_RX_MESSAGE(rECEIVER, sENDER, bYTES, nUMbYTES, fORMAT, aRGS...) msc_log_message("<-",rECEIVER, sENDER, bYTES, nUMbYTES, fORMAT, ##aRGS)
+#define MSC_LOG_RX_DISCARDED_MESSAGE(rECEIVER, sENDER, bYTES, nUMbYTES, fORMAT, aRGS...) msc_log_message("x-",rECEIVER, sENDER, bYTES, nUMbYTES, fORMAT, ##aRGS)
+#define MSC_LOG_TX_MESSAGE(sENDER, rECEIVER, bYTES, nUMbYTES, fORMAT, aRGS...) msc_log_message("->",sENDER, rECEIVER, bYTES, nUMbYTES, fORMAT, ##aRGS)
+#define MSC_LOG_TX_MESSAGE_FAILED(sENDER, rECEIVER, bYTES, nUMbYTES, fORMAT, aRGS...) msc_log_message("-x",sENDER, rECEIVER, bYTES, nUMbYTES, fORMAT, ##aRGS)
#else
-#define MSC_INIT(mScPaRaMs)
-#define MSC_END
+#define MSC_INIT(arg1,arg2)
+#define MSC_START_USE(mScPaRaMs)
+#define MSC_END(mScPaRaMs)
#define MSC_LOG_EVENT(mScPaRaMs, fORMAT, aRGS...)
#define MSC_LOG_RX_MESSAGE(mScPaRaMs, fORMAT, aRGS...)
#define MSC_LOG_RX_DISCARDED_MESSAGE(mScPaRaMs, fORMAT, aRGS...)
diff --git a/maketags b/maketags
index df3ded634c..ec283c8bec 100755
--- a/maketags
+++ b/maketags
@@ -1,3 +1,3 @@
#!/bin/sh
echo "building ctags for openair1 and openair2 ..."
-ctags -e -R --exclude=openair3/ --exclude=openair1/DOCS/ --exclude=openair2/DOCS/ --exclude=openair2/RRC/CELLULAR/ --exclude=openair2/NAS/DRIVER/CELLULAR/ --exclude=openair2/SIMULATION/ --exclude=openairITS/ --exclude=openair1/SIMULATION/
+ctags -e -R --exclude=openair1/DOCS/ --exclude=openair2/DOCS/ --exclude=openair2/RRC/CELLULAR/ --exclude=openair2/NAS/DRIVER/CELLULAR/ --exclude=openair2/SIMULATION/ --exclude=targets/DOCS/ --exclude=targets/PROJECTS/ openair1 openair2 targets
diff --git a/openair-cn/COMMON/ip_forward_messages_types.h b/openair-cn/COMMON/ip_forward_messages_types.h
index 89ca43d715..40db8d5c38 100755
--- a/openair-cn/COMMON/ip_forward_messages_types.h
+++ b/openair-cn/COMMON/ip_forward_messages_types.h
@@ -57,6 +57,7 @@ typedef struct {
ebi_t eps_bearer_id; ///< EPS bearer identifier
pdn_type_t pdn_type; ///< PDN Type
PAA_t paa; ///< PDN Address Allocation
+ pco_flat_t pco; ///< Protocol configuration options
} SGICreateEndpointResp;
typedef struct {
diff --git a/openair-cn/COMMON/nas_messages_types.h b/openair-cn/COMMON/nas_messages_types.h
index 7e5b49f228..6c03d25252 100644
--- a/openair-cn/COMMON/nas_messages_types.h
+++ b/openair-cn/COMMON/nas_messages_types.h
@@ -177,6 +177,7 @@ typedef struct nas_pdn_connectivity_req_s {
char imsi[16];
uint8_t imsi_length;
network_qos_t qos;
+ pco_flat_t pco;
OctetString apn;
OctetString pdn_addr;
int pdn_type;
@@ -189,6 +190,7 @@ typedef struct nas_pdn_connectivity_rsp_s {
int pti; // nas ref Identity of the procedure transaction executed to activate the PDN connection entry
unsigned ue_id; // nas ref
network_qos_t qos;
+ pco_flat_t pco;
OctetString apn;
OctetString pdn_addr;
int pdn_type;
diff --git a/openair-cn/COMMON/sgw_lite_messages_types.h b/openair-cn/COMMON/sgw_lite_messages_types.h
index 178618423b..f83015b6bb 100644
--- a/openair-cn/COMMON/sgw_lite_messages_types.h
+++ b/openair-cn/COMMON/sgw_lite_messages_types.h
@@ -55,6 +55,10 @@
/** @struct SgwCreateSessionRequest
* @brief Create Session Request
*
+ * Spec 3GPP TS 29.274, Universal Mobile Telecommunications System (UMTS);
+ * LTE; 3GPP Evolved Packet System (EPS);
+ * Evolved General Packet Radio Service (GPRS);
+ * Tunnelling Protocol for Control plane (GTPv2-C); Stage 3
* The Create Session Request will be sent on S11 interface as
* part of these procedures:
* - E-UTRAN Initial Attach
@@ -250,7 +254,8 @@ typedef struct SgwCreateSessionRequest_s {
///< RAU/TAU/HO procedures with SGW change to identify the
///< default bearer of the PDN Connection
- // PCO protocol_configuration_options ///< This IE is not applicable to TAU/RAU/Handover. If
+ pco_flat_t pco; /// PCO protocol_configuration_options
+ ///< This IE is not applicable to TAU/RAU/Handover. If
///< MME/SGSN receives PCO from UE (during the attach
///< procedures), the MME/SGSN shall forward the PCO IE to
///< SGW. The SGW shall also forward it to PGW.
@@ -413,7 +418,9 @@ typedef struct SgwCreateSessionResponse_s {
///< Gn/Gp SGSN to S4-SGSN/MME RAU/TAU procedure to
///< identify the default bearer the PGW selects for the PDN
///< Connection.
- // PCO protocol_configuration_options ///< This IE is not applicable for TAU/RAU/Handover. If PGW
+
+ pco_flat_t pco;// PCO protocol_configuration_options
+ ///< This IE is not applicable for TAU/RAU/Handover. If PGW
///< decides to return PCO to the UE, PGW shall send PCO to
///< SGW. If SGW receives the PCO IE, SGW shall forward it
///< MME/SGSN.
diff --git a/openair-cn/COMMON/tasks_def.h b/openair-cn/COMMON/tasks_def.h
index 0334eb45c6..e257778052 100644
--- a/openair-cn/COMMON/tasks_def.h
+++ b/openair-cn/COMMON/tasks_def.h
@@ -51,3 +51,5 @@ TASK_DEF(TASK_SCTP, TASK_PRIORITY_MED, 200)
TASK_DEF(TASK_SPGW_APP, TASK_PRIORITY_MED, 200)
/// UDP task
TASK_DEF(TASK_UDP, TASK_PRIORITY_MED, 200)
+//MESSAGE GENERATOR TASK
+TASK_DEF(TASK_MSC, TASK_PRIORITY_MED, 200)
diff --git a/openair-cn/DOCS/EPC_User_Guide.docx b/openair-cn/DOCS/EPC_User_Guide.docx
new file mode 100644
index 0000000000..b9cca8254c
Binary files /dev/null and b/openair-cn/DOCS/EPC_User_Guide.docx differ
diff --git a/openair-cn/DOCS/EPC_User_Guide.pdf b/openair-cn/DOCS/EPC_User_Guide.pdf
new file mode 100644
index 0000000000..6b8a476bad
Binary files /dev/null and b/openair-cn/DOCS/EPC_User_Guide.pdf differ
diff --git a/openair-cn/GTPV1-U/GTPUAH/cmd.sh b/openair-cn/GTPV1-U/GTPUAH/cmd.sh
deleted file mode 100755
index 94c35b043e..0000000000
--- a/openair-cn/GTPV1-U/GTPUAH/cmd.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-# Clear the iptables mangle table
-iptables -t mangle -F
-
-# Remove GTPU KLM
-rmmod xt_GTPUAH
-
-# Insert the GTPUAH KLM
-insmod ./Bin/xt_GTPUAH.ko
-
-# Copy the userland iptables extenstion library
-if [ -d /lib/xtables ]; then
- /bin/cp -f ./Bin/libxt_GTPUAH.so /lib/xtables/
-fi
-
-if [ -d /lib/iptables ]; then
- /bin/cp -f ./Bin/libxt_GTPUAH.so /lib/iptables/libipt_GTPUAH.so
-fi
-
diff --git a/openair-cn/GTPV1-U/GTPUAH/COPYING b/openair-cn/GTPV1-U/GTPU_SP/COPYING
similarity index 100%
rename from openair-cn/GTPV1-U/GTPUAH/COPYING
rename to openair-cn/GTPV1-U/GTPU_SP/COPYING
diff --git a/openair-cn/GTPV1-U/GTPUAH/INSTALL b/openair-cn/GTPV1-U/GTPU_SP/INSTALL
similarity index 100%
rename from openair-cn/GTPV1-U/GTPUAH/INSTALL
rename to openair-cn/GTPV1-U/GTPU_SP/INSTALL
diff --git a/openair-cn/GTPV1-U/GTPUAH/Makefile b/openair-cn/GTPV1-U/GTPU_SP/Makefile
similarity index 90%
rename from openair-cn/GTPV1-U/GTPUAH/Makefile
rename to openair-cn/GTPV1-U/GTPU_SP/Makefile
index 1c581789e4..f8b59266e1 100755
--- a/openair-cn/GTPV1-U/GTPUAH/Makefile
+++ b/openair-cn/GTPV1-U/GTPU_SP/Makefile
@@ -1,5 +1,5 @@
####################################################################################
-# Makefile for iptables extension for the GTPUAH target and GTPUAH klm
+# Makefile for iptables extension for the GTPUSP target and GTPUSP klm
#
# Copyright (c) 2010-2011 Polaris Networks
# Author: Pradip Biswas
@@ -14,20 +14,20 @@ export BIN_DIR ?= $(shell pwd)/Bin
KVERSION = $(shell uname -r)
KVERSION_LAST_DIGIT = $(shell echo ${KVERSION} | cut -d "." -f 3 | cut -d "-" -f 1)
-obj-m = xt_GTPUAH.o
+obj-m = xt_GTPUSP.o
EXTRA_CFLAGS += -DKVERSION=$(KVERSION_LAST_DIGIT)
all: xtlib
echo "Building for Kernel Version: $(KVERSION_LAST_DIGIT)"
make -C /lib/modules/$(KVERSION)/build M=$(PWD) modules
- chmod 777 xt_GTPUAH.ko
- mv xt_GTPUAH.ko $(BIN_DIR)/
+ chmod 777 xt_GTPUSP.ko
+ mv xt_GTPUSP.ko $(BIN_DIR)/
clean: libclean
make -C /lib/modules/$(KVERSION)/build M=$(PWD) clean
################################################################################
-# The next section is used by libxt_GTPUAH
+# The next section is used by libxt_GTPUSP
################################################################################
XT_IPTABLES_VERSION = $(shell /sbin/iptables -V | cut -d " " -f 2 | cut -b 2-)
@@ -47,11 +47,11 @@ endif
LIB_CFLAGS := -fPIC -Wall -MMD -D_LARGEFILE_SOURCE=1 -D_LARGE_FILES -D_FILE_OFFSET_BITS=64 \
-D_REENTRANT -pipe -DXTABLES_LIBDIR=\"/usr/local/libexec/xtables\" -DXTABLES_INTERNAL \
- -D_INIT=libxt_GTPUAH_init -DPIC -fPIC -O2 \
+ -D_INIT=libxt_GTPUSP_init -DPIC -fPIC -O2 \
-DIPTVERSION=$(IPTVERSION) \
-DIPTABLES_VERSION_STRING=$(IPTABLES_VERSION_STRING)
-XT_TARGET := xt_GTPUAH
+XT_TARGET := xt_GTPUSP
XT_LIBNAME := lib$(XT_TARGET).so
XT_BUILD_DIR = $(BIN_DIR)/$(XT_TARGET)
@@ -70,7 +70,7 @@ INCLUDE_DIR = -I. \
-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include \
-I/usr/lib64/glib-2.0/include
-XT_SOURCES = libxt_GTPUAH.c
+XT_SOURCES = libxt_GTPUSP.c
XT_OBJECTS := $(addprefix $(XT_BUILD_DIR)/, $(notdir $(XT_SOURCES:.c=.o)))
@@ -91,7 +91,7 @@ $(BIN_DIR)/$(XT_LIBNAME): $(XT_OBJECTS)
@$(LIB_LD) -shared $(XT_OBJECTS) -o $@
$(XT_BUILD_DIR)/%.o : %.c
- @echo "Building GTPUAH ext for version $(IPTVERSION) $(IPTABLES_VERSION_STRING)"
+ @echo "Building GTPUSP ext for version $(IPTVERSION) $(IPTABLES_VERSION_STRING)"
@echo Compiling $<
@$(LIB_CC) $(LIB_CFLAGS) -MF $(DF).d $(INCLUDE_DIR) -o $@ -c $<
@cp $(DF).d $(DF).P; \
diff --git a/openair-cn/GTPV1-U/GTPUAH/README b/openair-cn/GTPV1-U/GTPU_SP/README
similarity index 100%
rename from openair-cn/GTPV1-U/GTPUAH/README
rename to openair-cn/GTPV1-U/GTPU_SP/README
diff --git a/openair-cn/GTPV1-U/GTPUAH/RELEASE_NOTES b/openair-cn/GTPV1-U/GTPU_SP/RELEASE_NOTES
similarity index 70%
rename from openair-cn/GTPV1-U/GTPUAH/RELEASE_NOTES
rename to openair-cn/GTPV1-U/GTPU_SP/RELEASE_NOTES
index e8617a4978..022846fcd5 100755
--- a/openair-cn/GTPV1-U/GTPUAH/RELEASE_NOTES
+++ b/openair-cn/GTPV1-U/GTPU_SP/RELEASE_NOTES
@@ -3,5 +3,4 @@ Known issues in GTPU v1.0
-------------------------
1. Does not implement the "Transport" action.
-2. Does not handle segmented GTPu packets.
diff --git a/openair-cn/GTPV1-U/GTPU_SP/cmd.sh b/openair-cn/GTPV1-U/GTPU_SP/cmd.sh
new file mode 100755
index 0000000000..428b5b155a
--- /dev/null
+++ b/openair-cn/GTPV1-U/GTPU_SP/cmd.sh
@@ -0,0 +1,18 @@
+# Clear the iptables mangle table
+iptables -t mangle -F
+
+# Remove GTPU KLM
+rmmod xt_GTPUSP
+
+# Insert the GTPUSP KLM
+insmod ./Bin/xt_GTPUSP.ko
+
+# Copy the userland iptables extenstion library
+if [ -d /lib/xtables ]; then
+ /bin/cp -f ./Bin/libxt_GTPUSP.so /lib/xtables/
+fi
+
+if [ -d /lib/iptables ]; then
+ /bin/cp -f ./Bin/libxt_GTPUSP.so /lib/iptables/libipt_GTPUSP.so
+fi
+
diff --git a/openair-cn/GTPV1-U/GTPUAH/libxt_GTPUAH.c b/openair-cn/GTPV1-U/GTPU_SP/libxt_GTPUSP.c
similarity index 54%
rename from openair-cn/GTPV1-U/GTPUAH/libxt_GTPUAH.c
rename to openair-cn/GTPV1-U/GTPU_SP/libxt_GTPUSP.c
index 0e9c4dc28d..0b749a8759 100755
--- a/openair-cn/GTPV1-U/GTPUAH/libxt_GTPUAH.c
+++ b/openair-cn/GTPV1-U/GTPU_SP/libxt_GTPUSP.c
@@ -1,4 +1,4 @@
-/* Shared library add-on to iptables for the GTPUAH target
+/* Shared library add-on to iptables for the GTPUSP target
*
* Copyright (c) 2010-2011 Polaris Networks
* Author: Pradip Biswas
@@ -19,7 +19,7 @@
#include
#include
-#include "xt_GTPUAH.h"
+#include "xt_GTPUSP.h"
#if (IPTVERSION <= 135)
#include
@@ -28,25 +28,25 @@
#endif
#if (IPTVERSION <= 135)
-#define GTPUAH_PARAM_BAD_VALUE 0
-#define GTPUAH_PARAM_ONLY_ONCE 1
-#define XT_GTPUAH_VERSION IPTABLES_VERSION_STRING
-#define gtpuah_strtoui(s,v,m,M) !string_to_number(s,m,M,v)
-#define gtpuah_exit_error exit_error
+#define GTPUSP_PARAM_BAD_VALUE 0
+#define GTPUSP_PARAM_ONLY_ONCE 1
+#define XT_GTPUSP_VERSION IPTABLES_VERSION_STRING
+#define gtpusp_strtoui(s,v,m,M) !string_to_number(s,m,M,v)
+#define gtpusp_exit_error exit_error
#elif (IPTVERSION > 135) && (IPTVERSION <= 141)
-#define GTPUAH_PARAM_BAD_VALUE P_BAD_VALUE
-#define GTPUAH_PARAM_ONLY_ONCE P_ONLY_ONCE
-#define XT_GTPUAH_VERSION XTABLES_VERSION
-#define gtpuah_param_act param_act
-#define gtpuah_strtoui(s,v,m,M) !string_to_number(s,m,M,v)
-#define gtpuah_exit_error exit_error
+#define GTPUSP_PARAM_BAD_VALUE P_BAD_VALUE
+#define GTPUSP_PARAM_ONLY_ONCE P_ONLY_ONCE
+#define XT_GTPUSP_VERSION XTABLES_VERSION
+#define gtpusp_param_act param_act
+#define gtpusp_strtoui(s,v,m,M) !string_to_number(s,m,M,v)
+#define gtpusp_exit_error exit_error
#elif (IPTVERSION > 141)
-#define GTPUAH_PARAM_BAD_VALUE XTF_BAD_VALUE
-#define GTPUAH_PARAM_ONLY_ONCE XTF_ONLY_ONCE
-#define XT_GTPUAH_VERSION XTABLES_VERSION
-#define gtpuah_param_act xtables_param_act
-#define gtpuah_strtoui(s,v,m,M) xtables_strtoui(s,NULL,v,m,M)
-#define gtpuah_exit_error xtables_error
+#define GTPUSP_PARAM_BAD_VALUE XTF_BAD_VALUE
+#define GTPUSP_PARAM_ONLY_ONCE XTF_ONLY_ONCE
+#define XT_GTPUSP_VERSION XTABLES_VERSION
+#define gtpusp_param_act xtables_param_act
+#define gtpusp_strtoui(s,v,m,M) xtables_strtoui(s,NULL,v,m,M)
+#define gtpusp_exit_error xtables_error
#endif
enum {
@@ -57,10 +57,10 @@ enum {
PARAM_ACTION = 1 << 4,
};
-static void GTPUAH_help(void)
+static void GTPUSP_help(void)
{
printf(
- "GTPUAH target options\n"
+ "GTPUSP target options\n"
" --action value Set action \n"
" --own-ip value Set own IP address\n"
" --own-tun value Set own tunnel id \n"
@@ -70,7 +70,7 @@ static void GTPUAH_help(void)
#if (IPTVERSION <= 135)
/* Stolen from iptables v1.4.7 code */
-void gtpuah_param_act(unsigned int status, const char *p1, ...)
+void gtpusp_param_act(unsigned int status, const char *p1, ...)
{
const char *p2, *p3;
va_list args;
@@ -79,7 +79,7 @@ void gtpuah_param_act(unsigned int status, const char *p1, ...)
va_start(args, p1);
switch (status) {
- case GTPUAH_PARAM_ONLY_ONCE:
+ case GTPUSP_PARAM_ONLY_ONCE:
p2 = va_arg(args, const char *);
b = va_arg(args, unsigned int);
@@ -91,7 +91,7 @@ void gtpuah_param_act(unsigned int status, const char *p1, ...)
p1, p2);
break;
- case GTPUAH_PARAM_BAD_VALUE:
+ case GTPUSP_PARAM_BAD_VALUE:
p2 = va_arg(args, const char *);
p3 = va_arg(args, const char *);
exit_error(PARAMETER_PROBLEM,
@@ -109,18 +109,18 @@ void gtpuah_param_act(unsigned int status, const char *p1, ...)
#endif
-static void parse_gtpuah_addr(const char *s, struct xt_gtpuah_target_info *info, int flag)
+static void parse_gtpusp_addr(const char *s, struct xt_gtpusp_target_info *info, int flag)
{
in_addr_t addr;
if ((addr = inet_addr(s)) == -1) {
switch (flag) {
case PARAM_LADDR:
- gtpuah_param_act(GTPUAH_PARAM_BAD_VALUE, "GTPUAH", "--own-ip", s);
+ gtpusp_param_act(GTPUSP_PARAM_BAD_VALUE, "GTPUSP", "--own-ip", s);
break;
case PARAM_RADDR:
- gtpuah_param_act(GTPUAH_PARAM_BAD_VALUE, "GTPUAH", "--peer-ip", s);
+ gtpusp_param_act(GTPUSP_PARAM_BAD_VALUE, "GTPUSP", "--peer-ip", s);
break;
}
}
@@ -136,18 +136,18 @@ static void parse_gtpuah_addr(const char *s, struct xt_gtpuah_target_info *info,
}
}
-static void parse_gtpuah_tunid(char *s, struct xt_gtpuah_target_info *info, int flag)
+static void parse_gtpusp_tunid(char *s, struct xt_gtpusp_target_info *info, int flag)
{
unsigned int value;
- if (!gtpuah_strtoui(s, &value, 0, UINT32_MAX)) {
+ if (!gtpusp_strtoui(s, &value, 0, UINT32_MAX)) {
switch (flag) {
case PARAM_LTUN:
- gtpuah_param_act(GTPUAH_PARAM_BAD_VALUE, "GTPUAH", "--own-tun", s);
+ gtpusp_param_act(GTPUSP_PARAM_BAD_VALUE, "GTPUSP", "--own-tun", s);
break;
case PARAM_RTUN:
- gtpuah_param_act(GTPUAH_PARAM_BAD_VALUE, "GTPUAH", "--peer-tun", s);
+ gtpusp_param_act(GTPUSP_PARAM_BAD_VALUE, "GTPUSP", "--peer-tun", s);
break;
}
}
@@ -163,57 +163,57 @@ static void parse_gtpuah_tunid(char *s, struct xt_gtpuah_target_info *info, int
}
}
-static void parse_gtpuah_action(char *s, struct xt_gtpuah_target_info *info, unsigned int *flags)
+static void parse_gtpusp_action(char *s, struct xt_gtpusp_target_info *info, unsigned int *flags)
{
if (!strcmp(s, "add")) {
- info->action = PARAM_GTPUAH_ACTION_ADD;
- *flags |= PARAM_GTPUAH_ACTION_ADD;
+ info->action = PARAM_GTPUSP_ACTION_ADD;
+ *flags |= PARAM_GTPUSP_ACTION_ADD;
} else {
- gtpuah_param_act(GTPUAH_PARAM_BAD_VALUE, "GTPUAH", "--action", s);
+ gtpusp_param_act(GTPUSP_PARAM_BAD_VALUE, "GTPUSP", "--action", s);
}
}
#if (IPTVERSION <= 135)
static int
-GTPUAH_parse(int c, char **argv, int invert, unsigned int *flags,
+GTPUSP_parse(int c, char **argv, int invert, unsigned int *flags,
const struct ipt_entry *entry,
struct ipt_entry_target **target)
#else
static int
-GTPUAH_parse(int c, char **argv, int invert, unsigned int *flags,
+GTPUSP_parse(int c, char **argv, int invert, unsigned int *flags,
const void *entry, struct xt_entry_target **target)
#endif
{
- struct xt_gtpuah_target_info *info = (struct xt_gtpuah_target_info *) (*target)->data;
+ struct xt_gtpusp_target_info *info = (struct xt_gtpusp_target_info *) (*target)->data;
switch (c) {
case '1':
- gtpuah_param_act(GTPUAH_PARAM_ONLY_ONCE, "GTPUAH", "--own-ip", *flags & PARAM_LADDR);
- parse_gtpuah_addr(optarg, info, PARAM_LADDR);
+ gtpusp_param_act(GTPUSP_PARAM_ONLY_ONCE, "GTPUSP", "--own-ip", *flags & PARAM_LADDR);
+ parse_gtpusp_addr(optarg, info, PARAM_LADDR);
*flags |= PARAM_LADDR;
return 1;
case '2':
- gtpuah_param_act(GTPUAH_PARAM_ONLY_ONCE, "GTPUAH", "--own-tun", *flags & PARAM_LTUN);
- parse_gtpuah_tunid(optarg, info, PARAM_LTUN);
+ gtpusp_param_act(GTPUSP_PARAM_ONLY_ONCE, "GTPUSP", "--own-tun", *flags & PARAM_LTUN);
+ parse_gtpusp_tunid(optarg, info, PARAM_LTUN);
*flags |= PARAM_LTUN;
return 1;
case '3':
- gtpuah_param_act(GTPUAH_PARAM_ONLY_ONCE, "GTPUAH", "--peer-ip", *flags & PARAM_RADDR);
- parse_gtpuah_addr(optarg, info, PARAM_RADDR);
+ gtpusp_param_act(GTPUSP_PARAM_ONLY_ONCE, "GTPUSP", "--peer-ip", *flags & PARAM_RADDR);
+ parse_gtpusp_addr(optarg, info, PARAM_RADDR);
*flags |= PARAM_RADDR;
return 1;
case '4':
- gtpuah_param_act(GTPUAH_PARAM_ONLY_ONCE, "GTPUAH", "--peer-tun", *flags & PARAM_RTUN);
- parse_gtpuah_tunid(optarg, info, PARAM_RTUN);
+ gtpusp_param_act(GTPUSP_PARAM_ONLY_ONCE, "GTPUSP", "--peer-tun", *flags & PARAM_RTUN);
+ parse_gtpusp_tunid(optarg, info, PARAM_RTUN);
*flags |= PARAM_RTUN;
return 1;
case '5':
- gtpuah_param_act(GTPUAH_PARAM_ONLY_ONCE, "GTPUAH", "--action", *flags & PARAM_ACTION);
- parse_gtpuah_action(optarg, info, flags);
+ gtpusp_param_act(GTPUSP_PARAM_ONLY_ONCE, "GTPUSP", "--action", *flags & PARAM_ACTION);
+ parse_gtpusp_action(optarg, info, flags);
*flags |= PARAM_ACTION;
return 1;
}
@@ -221,33 +221,33 @@ GTPUAH_parse(int c, char **argv, int invert, unsigned int *flags,
return 1;
}
-static void GTPUAH_check(unsigned int flags)
+static void GTPUSP_check(unsigned int flags)
{
if (!(flags & PARAM_ACTION)) {
- gtpuah_exit_error(PARAMETER_PROBLEM, "GTPUAH: You must specify action");
+ gtpusp_exit_error(PARAMETER_PROBLEM, "GTPUSP: You must specify action");
}
if (!(flags & PARAM_LADDR)) {
- gtpuah_exit_error(PARAMETER_PROBLEM, "GTPUAH: You must specify local addr");
+ gtpusp_exit_error(PARAMETER_PROBLEM, "GTPUSP: You must specify local addr");
}
if (!(flags & PARAM_LTUN)) {
- gtpuah_exit_error(PARAMETER_PROBLEM, "GTPUAH: You must specify local tunnel id");
+ gtpusp_exit_error(PARAMETER_PROBLEM, "GTPUSP: You must specify local tunnel id");
}
if (!(flags & PARAM_RADDR)) {
- gtpuah_exit_error(PARAMETER_PROBLEM, "GTPUAH: You must specify remote addr");
+ gtpusp_exit_error(PARAMETER_PROBLEM, "GTPUSP: You must specify remote addr");
}
if (!(flags & PARAM_RTUN)) {
- gtpuah_exit_error(PARAMETER_PROBLEM, "GTPUAH: You must specify remote tunnel id");
+ gtpusp_exit_error(PARAMETER_PROBLEM, "GTPUSP: You must specify remote tunnel id");
}
}
static void convert_action_to_string(int action, char *actionstr)
{
switch(action) {
- case PARAM_GTPUAH_ACTION_ADD:
+ case PARAM_GTPUSP_ACTION_ADD:
sprintf (actionstr, "add");
break;
@@ -259,19 +259,19 @@ static void convert_action_to_string(int action, char *actionstr)
#if (IPTVERSION <= 135)
static void
-GTPUAH_print(const struct ipt_ip *ip,
+GTPUSP_print(const struct ipt_ip *ip,
const struct ipt_entry_target *target,
int numeric)
#else
static void
-GTPUAH_print(const void *ip,
+GTPUSP_print(const void *ip,
const struct xt_entry_target *target,
int numeric)
#endif
{
- const struct xt_gtpuah_target_info *info =
- (struct xt_gtpuah_target_info *) target->data;
+ const struct xt_gtpusp_target_info *info =
+ (struct xt_gtpusp_target_info *) target->data;
char laddr[64], raddr[64], actionstr[32];
@@ -279,11 +279,11 @@ GTPUAH_print(const void *ip,
sprintf (laddr, "%s", inet_ntoa(*(struct in_addr*)&info->laddr));
sprintf (raddr, "%s", inet_ntoa(*(struct in_addr*)&info->raddr));
- printf("GTPUAH self: %s tunnel: 0x%x / peer: %s tunnel: 0x%x / action: %s",
+ printf("GTPUSP self: %s tunnel: 0x%x / peer: %s tunnel: 0x%x / action: %s",
laddr, info->ltun, raddr, info->rtun, actionstr);
}
-static struct option GTPUAH_opts[] = {
+static struct option GTPUSP_opts[] = {
{ "own-ip", 1, NULL, '1' },
{ "own-tun", 1, NULL, '2' },
{ "peer-ip", 1, NULL, '3' },
@@ -293,30 +293,30 @@ static struct option GTPUAH_opts[] = {
};
#if (IPTVERSION <= 135)
-static struct iptables_target gtpuah_tg_reg = {
+static struct iptables_target gtpusp_tg_reg = {
#else
-static struct xtables_target gtpuah_tg_reg = {
+static struct xtables_target gtpusp_tg_reg = {
#endif
- .name = "GTPUAH",
- .version = XT_GTPUAH_VERSION,
+ .name = "GTPUSP",
+ .version = XT_GTPUSP_VERSION,
#if (IPTVERSION > 135)
.family = NFPROTO_IPV4,
#endif
- .size = XT_ALIGN(sizeof(struct xt_gtpuah_target_info)),
- .userspacesize = XT_ALIGN(sizeof(struct xt_gtpuah_target_info)),
- .help = GTPUAH_help,
- .parse = GTPUAH_parse,
- .final_check = GTPUAH_check,
- .print = GTPUAH_print,
- .extra_opts = GTPUAH_opts,
+ .size = XT_ALIGN(sizeof(struct xt_gtpusp_target_info)),
+ .userspacesize = XT_ALIGN(sizeof(struct xt_gtpusp_target_info)),
+ .help = GTPUSP_help,
+ .parse = GTPUSP_parse,
+ .final_check = GTPUSP_check,
+ .print = GTPUSP_print,
+ .extra_opts = GTPUSP_opts,
};
void _init(void)
{
#if (IPTVERSION <= 135)
- register_target(>puah_tg_reg);
+ register_target(>pusp_tg_reg);
#else
- xtables_register_target(>puah_tg_reg);
+ xtables_register_target(>pusp_tg_reg);
#endif
}
diff --git a/openair-cn/GTPV1-U/GTPUAH/xt_GTPUAH.c b/openair-cn/GTPV1-U/GTPU_SP/xt_GTPUSP.c
similarity index 77%
rename from openair-cn/GTPV1-U/GTPUAH/xt_GTPUAH.c
rename to openair-cn/GTPV1-U/GTPU_SP/xt_GTPUSP.c
index 1da3edbdb2..24f210e371 100755
--- a/openair-cn/GTPV1-U/GTPUAH/xt_GTPUAH.c
+++ b/openair-cn/GTPV1-U/GTPU_SP/xt_GTPUSP.c
@@ -47,14 +47,14 @@
#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE)
# define WITH_IPV6 1
#endif
-#include "xt_GTPUAH.h"
+#include "xt_GTPUSP.h"
#if !(defined KVERSION)
# error "Kernel version is not defined!!!! Exiting."
#endif
-#define TRACE_IN_KERN_LOG 1
+#define GTPU_TRACE_IN_KERN_LOG 0
-#if defined(TRACE_IN_KERN_LOG)
+#if defined(GTPU_TRACE_IN_KERN_LOG)
#define PR_INFO(fORMAT, aRGS...) pr_info(fORMAT, ##aRGS)
#else
#define PR_INFO(fORMAT, aRGS...)
@@ -62,27 +62,27 @@
#define INT_MODULE_PARM(n, v) static int n = v; module_param(n, int, 0444)
#define STRING_MODULE_PARM(s, v) static char* s = v; module_param(s, charp, 0000);
//-----------------------------------------------------------------------------
-static char* _gtpuah_nf_inet_hook_2_string(int nf_inet_hookP);
-static void _gtpuah_print_hex_octets(unsigned char* data_pP, unsigned short sizeP);
-static void _gtpuah_tg4_add(struct sk_buff *old_skb_pP, const struct xt_action_param *par_pP);
+static char* _gtpusp_nf_inet_hook_2_string(int nf_inet_hookP);
+static void _gtpusp_print_hex_octets(unsigned char* data_pP, unsigned short sizeP);
+static void _gtpusp_tg4_add(struct sk_buff *old_skb_pP, const struct xt_action_param *par_pP);
#ifdef WITH_IPV6
-static void _gtpuah_tg6_add(struct sk_buff *old_skb_pP, const struct xt_action_param *par_pP);
-static unsigned int _gtpuah_tg6(struct sk_buff *skb_pP, const struct xt_action_param *par_pP);
+static void _gtpusp_tg6_add(struct sk_buff *old_skb_pP, const struct xt_action_param *par_pP);
+static unsigned int _gtpusp_tg6(struct sk_buff *skb_pP, const struct xt_action_param *par_pP);
#endif
-static unsigned int _gtpuah_tg4(struct sk_buff *skb_pP, const struct xt_action_param *par_pP);
-static int __init gtpuah_tg_init(void);
-static void __exit gtpuah_tg_exit(void);
+static unsigned int _gtpusp_tg4(struct sk_buff *skb_pP, const struct xt_action_param *par_pP);
+static int __init gtpusp_tg_init(void);
+static void __exit gtpusp_tg_exit(void);
static int _udp_thread(void *data);
-static int _gtpuah_ksocket_send(struct socket *sock_pP, struct sockaddr_in *addr_pP, unsigned char *gtpuh_pP, int len_gtpP, unsigned char *buf_ip_pP, int len_ipP);
-static int _gtpuah_ksocket_receive(struct socket* sock_pP, struct sockaddr_in* addr_pP, unsigned char* buf_pP, int lenP);
-static int _gtpuah_ksocket_process_gtp(const unsigned char * const rx_buf_pP, const int lenP, unsigned char* tx_buf_pP);
+static int _gtpusp_ksocket_send(struct socket *sock_pP, struct sockaddr_in *addr_pP, unsigned char *gtpuh_pP, int len_gtpP, unsigned char *buf_ip_pP, int len_ipP);
+static int _gtpusp_ksocket_receive(struct socket* sock_pP, struct sockaddr_in* addr_pP, unsigned char* buf_pP, int lenP);
+static int _gtpusp_ksocket_process_gtp(const unsigned char * const rx_buf_pP, const int lenP, unsigned char* tx_buf_pP);
//-----------------------------------------------------------------------------
-#define MODULE_NAME "GTPUAH"
+#define MODULE_NAME "GTPUSP"
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Pradip Biswas ");
MODULE_DESCRIPTION("GTPu Data Path extension on netfilter");
//-----------------------------------------------------------------------------
-static struct xt_target gtpuah_tg_reg[] __read_mostly = {
+static struct xt_target gtpusp_tg_reg[] __read_mostly = {
{
.name = MODULE_NAME,
.revision = 0,
@@ -91,8 +91,8 @@ static struct xt_target gtpuah_tg_reg[] __read_mostly = {
(1 << NF_INET_LOCAL_IN) |
(1 << NF_INET_FORWARD),
.table = "mangle",
- .target = _gtpuah_tg4,
- .targetsize = sizeof(struct xt_gtpuah_target_info),
+ .target = _gtpusp_tg4,
+ .targetsize = sizeof(struct xt_gtpusp_target_info),
.me = THIS_MODULE,
},
#ifdef WITH_IPV6
@@ -104,8 +104,8 @@ static struct xt_target gtpuah_tg_reg[] __read_mostly = {
(1 << NF_INET_LOCAL_IN) |
(1 << NF_INET_FORWARD),
.table = "mangle",
- .target = _gtpuah_tg6,
- .targetsize = sizeof(struct xt_gtpuah_target_info),
+ .target = _gtpusp_tg6,
+ .targetsize = sizeof(struct xt_gtpusp_target_info),
.me = THIS_MODULE,
},
#endif
@@ -138,14 +138,14 @@ struct gtpuhdr {
u_int16_t length;
u_int32_t tunid;
};
-typedef struct gtpuah_sock_s {
+typedef struct gtpusp_sock_s {
struct task_struct *thread;
struct sockaddr_in addr;
struct socket *sock;
struct sockaddr_in addr_send;
int running;
int thread_stop_requested;
-} gtpuah_sock_t;
+} gtpusp_sock_t;
//-----------------------------------------------------------------------------
#define GTPU_HDR_PNBIT 1
@@ -155,7 +155,7 @@ typedef struct gtpuah_sock_s {
#define GTPU_FAILURE 1
#define GTPU_SUCCESS !GTPU_FAILURE
-#define GTPUAH_2_PRINT_BUFFER_LEN 8192
+#define GTPUSP_2_PRINT_BUFFER_LEN 8192
#define IP_MORE_FRAGMENTS 0x2000
#define NIPADDR(addr) \
@@ -164,8 +164,8 @@ typedef struct gtpuah_sock_s {
(uint8_t)((addr & 0x00FF0000) >> 16), \
(uint8_t)((addr & 0xFF000000) >> 24)
//-----------------------------------------------------------------------------
-static char _gtpuah_print_buffer[GTPUAH_2_PRINT_BUFFER_LEN];
-gtpuah_sock_t _gtpuah_sock;
+static char _gtpusp_print_buffer[GTPUSP_2_PRINT_BUFFER_LEN];
+gtpusp_sock_t _gtpusp_sock;
INT_MODULE_PARM(gtpu_sgw_port, 2152);
MODULE_PARM_DESC(gtpu_sgw_port, "UDP port number for S1U interface (s-GW side)");
@@ -178,7 +178,7 @@ MODULE_PARM_DESC(sgw_addr, "IPv4 address of the S1U IP interface");
//-----------------------------------------------------------------------------
static char*
-_gtpuah_icmph_type_2_string(uint8_t typeP)
+_gtpusp_icmph_type_2_string(uint8_t typeP)
//-----------------------------------------------------------------------------
{
switch (typeP) {
@@ -200,7 +200,7 @@ _gtpuah_icmph_type_2_string(uint8_t typeP)
}
//-----------------------------------------------------------------------------
static char*
-_gtpuah_nf_inet_hook_2_string(int nf_inet_hookP)
+_gtpusp_nf_inet_hook_2_string(int nf_inet_hookP)
{
//-----------------------------------------------------------------------------
switch (nf_inet_hookP) {
@@ -230,7 +230,7 @@ _gtpuah_nf_inet_hook_2_string(int nf_inet_hookP)
}
//-----------------------------------------------------------------------------
void
-_gtpuah_print_hex_octets(unsigned char* data_pP, unsigned short sizeP)
+_gtpusp_print_hex_octets(unsigned char* data_pP, unsigned short sizeP)
{
//-----------------------------------------------------------------------------
@@ -255,27 +255,27 @@ _gtpuah_print_hex_octets(unsigned char* data_pP, unsigned short sizeP)
s = tv.tv_sec % 60;
snprintf(timeofday, 64, "%02d:%02d:%02d.%06ld", h,m,s,tv.tv_usec);
- buffer_marker+=snprintf(&_gtpuah_print_buffer[buffer_marker], GTPUAH_2_PRINT_BUFFER_LEN - buffer_marker,"%s------+-------------------------------------------------+\n",timeofday);
- buffer_marker+=snprintf(&_gtpuah_print_buffer[buffer_marker], GTPUAH_2_PRINT_BUFFER_LEN - buffer_marker,"%s | 0 1 2 3 4 5 6 7 8 9 a b c d e f |\n",timeofday);
- buffer_marker+=snprintf(&_gtpuah_print_buffer[buffer_marker], GTPUAH_2_PRINT_BUFFER_LEN - buffer_marker,"%s------+-------------------------------------------------+\n",timeofday);
- pr_info("%s",_gtpuah_print_buffer);
+ buffer_marker+=snprintf(&_gtpusp_print_buffer[buffer_marker], GTPUSP_2_PRINT_BUFFER_LEN - buffer_marker,"%s------+-------------------------------------------------+\n",timeofday);
+ buffer_marker+=snprintf(&_gtpusp_print_buffer[buffer_marker], GTPUSP_2_PRINT_BUFFER_LEN - buffer_marker,"%s | 0 1 2 3 4 5 6 7 8 9 a b c d e f |\n",timeofday);
+ buffer_marker+=snprintf(&_gtpusp_print_buffer[buffer_marker], GTPUSP_2_PRINT_BUFFER_LEN - buffer_marker,"%s------+-------------------------------------------------+\n",timeofday);
+ pr_info("%s",_gtpusp_print_buffer);
buffer_marker = 0;
for (octet_index = 0; octet_index < sizeP; octet_index++) {
if ((octet_index % 16) == 0) {
if (octet_index != 0) {
- buffer_marker+=snprintf(&_gtpuah_print_buffer[buffer_marker], GTPUAH_2_PRINT_BUFFER_LEN - buffer_marker, " |\n");
- pr_info("%s",_gtpuah_print_buffer);
+ buffer_marker+=snprintf(&_gtpusp_print_buffer[buffer_marker], GTPUSP_2_PRINT_BUFFER_LEN - buffer_marker, " |\n");
+ pr_info("%s",_gtpusp_print_buffer);
buffer_marker = 0;
}
- buffer_marker+=snprintf(&_gtpuah_print_buffer[buffer_marker], GTPUAH_2_PRINT_BUFFER_LEN - buffer_marker, "%s %04ld |",timeofday, octet_index);
+ buffer_marker+=snprintf(&_gtpusp_print_buffer[buffer_marker], GTPUSP_2_PRINT_BUFFER_LEN - buffer_marker, "%s %04ld |",timeofday, octet_index);
}
/*
* Print every single octet in hexadecimal form
*/
- buffer_marker+=snprintf(&_gtpuah_print_buffer[buffer_marker], GTPUAH_2_PRINT_BUFFER_LEN - buffer_marker, " %02x", data_pP[octet_index]);
+ buffer_marker+=snprintf(&_gtpusp_print_buffer[buffer_marker], GTPUSP_2_PRINT_BUFFER_LEN - buffer_marker, " %02x", data_pP[octet_index]);
/*
* Align newline and pipes according to the octets in groups of 2
*/
@@ -285,11 +285,11 @@ _gtpuah_print_hex_octets(unsigned char* data_pP, unsigned short sizeP)
* Append enough spaces and put final pipe
*/
for (aindex = octet_index; aindex < 16; ++aindex)
- buffer_marker+=snprintf(&_gtpuah_print_buffer[buffer_marker], GTPUAH_2_PRINT_BUFFER_LEN - buffer_marker, " ");
+ buffer_marker+=snprintf(&_gtpusp_print_buffer[buffer_marker], GTPUSP_2_PRINT_BUFFER_LEN - buffer_marker, " ");
//SGI_IF_DEBUG(" ");
- buffer_marker+=snprintf(&_gtpuah_print_buffer[buffer_marker], GTPUAH_2_PRINT_BUFFER_LEN - buffer_marker, " |\n");
- pr_info("%s",_gtpuah_print_buffer);
+ buffer_marker+=snprintf(&_gtpusp_print_buffer[buffer_marker], GTPUSP_2_PRINT_BUFFER_LEN - buffer_marker, " |\n");
+ pr_info("%s",_gtpusp_print_buffer);
}
// for uplink GTPU traffic on S-GW
@@ -307,18 +307,18 @@ static int _udp_thread(void *data)
unsigned char gtp_resp[1024];
/* kernel thread initialization */
- _gtpuah_sock.running = 1;
+ _gtpusp_sock.running = 1;
PR_INFO(MODULE_NAME": listening on port %d\n", gtpu_sgw_port);
/* main loop */
- while(_gtpuah_sock.thread_stop_requested == 0){
+ while(_gtpusp_sock.thread_stop_requested == 0){
if (kthread_should_stop()) {
- _gtpuah_sock.running = 0;
+ _gtpusp_sock.running = 0;
PR_INFO(MODULE_NAME": kthread_stop initiated exit at %lu \n", jiffies);
return -1; //Exit from the thread. Return value will be passed to kthread_stop()
}
- size = _gtpuah_ksocket_receive(_gtpuah_sock.sock, &_gtpuah_sock.addr, buf, bufsize);
+ size = _gtpusp_ksocket_receive(_gtpusp_sock.sock, &_gtpusp_sock.addr, buf, bufsize);
if (size <= 0) {
if (size != -EAGAIN) {
@@ -337,12 +337,12 @@ static int _udp_thread(void *data)
#endif
PR_INFO(MODULE_NAME": received %d bytes\n", size);
- if ((tx_size = _gtpuah_ksocket_process_gtp(buf, size, gtp_resp)) > 0) {
- //ksocket_send(_gtpuah_sock.sock, &_gtpuah_sock.addr_send, buf, gtp_resp, tx_size, NULL, 0));
+ if ((tx_size = _gtpusp_ksocket_process_gtp(buf, size, gtp_resp)) > 0) {
+ //ksocket_send(_gtpusp_sock.sock, &_gtpusp_sock.addr_send, buf, gtp_resp, tx_size, NULL, 0));
}
}
}
- _gtpuah_sock.running = 0;
+ _gtpusp_sock.running = 0;
if (kthread_should_stop()) {
PR_INFO(MODULE_NAME": kthread_stop initiated exit at %lu \n", jiffies);
return -1; //Exit from the thread. Return value will be passed to kthread_stop()
@@ -352,7 +352,7 @@ static int _udp_thread(void *data)
}
//-----------------------------------------------------------------------------
-static int _gtpuah_ksocket_process_gtp(const unsigned char * const rx_buf_pP, const int lenP, unsigned char* tx_buf_pP)
+static int _gtpusp_ksocket_process_gtp(const unsigned char * const rx_buf_pP, const int lenP, unsigned char* tx_buf_pP)
//-----------------------------------------------------------------------------
{
gtpv1u_msg_t gtpv1u_msg;
@@ -482,7 +482,7 @@ free_skb:
}
//-----------------------------------------------------------------------------
-static int _gtpuah_ksocket_receive(struct socket* sock_pP, struct sockaddr_in* addr_pP, unsigned char* buf_pP, int lenP)
+static int _gtpusp_ksocket_receive(struct socket* sock_pP, struct sockaddr_in* addr_pP, unsigned char* buf_pP, int lenP)
//-----------------------------------------------------------------------------
{
struct msghdr msg;
@@ -517,7 +517,7 @@ static int _gtpuah_ksocket_receive(struct socket* sock_pP, struct sockaddr_in* a
}
//-----------------------------------------------------------------------------
-static int _gtpuah_ksocket_send(struct socket *sock_pP, struct sockaddr_in *addr_pP, unsigned char *gtpuh_pP, int len_gtpP, unsigned char *buf_ip_pP, int len_ipP)
+static int _gtpusp_ksocket_send(struct socket *sock_pP, struct sockaddr_in *addr_pP, unsigned char *gtpuh_pP, int len_gtpP, unsigned char *buf_ip_pP, int len_ipP)
//-----------------------------------------------------------------------------
{
struct msghdr msg;
@@ -566,7 +566,7 @@ static int _gtpuah_ksocket_send(struct socket *sock_pP, struct sockaddr_in *addr
#ifdef WITH_IPV6
//-----------------------------------------------------------------------------
static void
-_gtpuah_tg6_add(struct sk_buff *old_skb_pP, const struct xt_action_param *par_pP)
+_gtpusp_tg6_add(struct sk_buff *old_skb_pP, const struct xt_action_param *par_pP)
{
//-----------------------------------------------------------------------------
}
@@ -574,7 +574,7 @@ _gtpuah_tg6_add(struct sk_buff *old_skb_pP, const struct xt_action_param *par_pP
//-----------------------------------------------------------------------------
static void
-_gtpuah_tg4_add(struct sk_buff *old_skb_pP, const struct xt_action_param *par_pP)
+_gtpusp_tg4_add(struct sk_buff *old_skb_pP, const struct xt_action_param *par_pP)
{
//-----------------------------------------------------------------------------
struct iphdr *old_iph_p = ip_hdr(old_skb_pP);
@@ -596,21 +596,21 @@ _gtpuah_tg4_add(struct sk_buff *old_skb_pP, const struct xt_action_param *par_pP
//----------------------------------------------------------------------------
ct = nf_ct_get(old_skb_pP, &ctinfo);
if (ct == NULL) {
- PR_INFO(MODULE_NAME": _gtpuah_target_add force targinfo ltun %u to skb_pP mark %u\n",
- ((const struct xt_gtpuah_target_info *)(par_pP->targinfo))->ltun,
+ PR_INFO(MODULE_NAME": _gtpusp_target_add force targinfo ltun %u to skb_pP mark %u\n",
+ ((const struct xt_gtpusp_target_info *)(par_pP->targinfo))->ltun,
old_skb_pP->mark);
- newmark = ((const struct xt_gtpuah_target_info *)(par_pP->targinfo))->ltun;
+ newmark = ((const struct xt_gtpusp_target_info *)(par_pP->targinfo))->ltun;
} else {
//XT_CONNMARK_RESTORE:
newmark = old_skb_pP->mark ^ ct->mark;
- PR_INFO(MODULE_NAME": _gtpuah_target_add restore mark %u (skb mark %u ct mark %u) len %u sgw addr %x\n",
+ PR_INFO(MODULE_NAME": _gtpusp_target_add restore mark %u (skb mark %u ct mark %u) len %u sgw addr %x\n",
newmark, old_skb_pP->mark, ct->mark, orig_iplen,
- ((const struct xt_gtpuah_target_info *)(par_pP->targinfo))->raddr);
- if (newmark != ((const struct xt_gtpuah_target_info *)(par_pP->targinfo))->ltun) {
- pr_warn(MODULE_NAME": _gtpuah_target_add restore mark 0x%x mismatch ltun 0x%x (rtun 0x%x)",
- newmark, ((const struct xt_gtpuah_target_info *)(par_pP->targinfo))->ltun,
- ((const struct xt_gtpuah_target_info *)(par_pP->targinfo))->rtun);
+ ((const struct xt_gtpusp_target_info *)(par_pP->targinfo))->raddr);
+ if (newmark != ((const struct xt_gtpusp_target_info *)(par_pP->targinfo))->ltun) {
+ pr_warn(MODULE_NAME": _gtpusp_target_add restore mark 0x%x mismatch ltun 0x%x (rtun 0x%x)",
+ newmark, ((const struct xt_gtpusp_target_info *)(par_pP->targinfo))->ltun,
+ ((const struct xt_gtpusp_target_info *)(par_pP->targinfo))->rtun);
}
}
@@ -619,28 +619,28 @@ _gtpuah_tg4_add(struct sk_buff *old_skb_pP, const struct xt_action_param *par_pP
gtpuh.flags = 0x30; /* v1 and Protocol-type=GTP */
gtpuh.msgtype = 0xff; /* T-PDU */
gtpuh.length = htons(orig_iplen);
- gtpuh.tunid = htonl(((const struct xt_gtpuah_target_info *)(par_pP->targinfo))->rtun);
+ gtpuh.tunid = htonl(((const struct xt_gtpusp_target_info *)(par_pP->targinfo))->rtun);
- _gtpuah_sock.addr_send.sin_addr.s_addr = ((const struct xt_gtpuah_target_info *)(par_pP->targinfo))->raddr;
- _gtpuah_ksocket_send(_gtpuah_sock.sock, &_gtpuah_sock.addr_send, (unsigned char*)>puh, sizeof(gtpuh), (unsigned char*)old_iph_p, orig_iplen);
+ _gtpusp_sock.addr_send.sin_addr.s_addr = ((const struct xt_gtpusp_target_info *)(par_pP->targinfo))->raddr;
+ _gtpusp_ksocket_send(_gtpusp_sock.sock, &_gtpusp_sock.addr_send, (unsigned char*)>puh, sizeof(gtpuh), (unsigned char*)old_iph_p, orig_iplen);
return ;
}
#ifdef WITH_IPV6
//-----------------------------------------------------------------------------
static unsigned int
-_gtpuah_tg6(struct sk_buff *skb_pP, const struct xt_action_param *par_pP)
+_gtpusp_tg6(struct sk_buff *skb_pP, const struct xt_action_param *par_pP)
{
//-----------------------------------------------------------------------------
- const struct xt_gtpuah_target_info *tgi_p = par_pP->targinfo;
+ const struct xt_gtpusp_target_info *tgi_p = par_pP->targinfo;
if (tgi_p == NULL) {
return NF_ACCEPT;
}
- if (tgi_p->action == PARAM_GTPUAH_ACTION_ADD) {
- _gtpuah_tg6_add(skb_pP, par_pP);
+ if (tgi_p->action == PARAM_GTPUSP_ACTION_ADD) {
+ _gtpusp_tg6_add(skb_pP, par_pP);
return NF_DROP; // TODO
}
@@ -650,17 +650,17 @@ _gtpuah_tg6(struct sk_buff *skb_pP, const struct xt_action_param *par_pP)
//-----------------------------------------------------------------------------
static unsigned int
-_gtpuah_tg4(struct sk_buff *skb_pP, const struct xt_action_param *par_pP)
+_gtpusp_tg4(struct sk_buff *skb_pP, const struct xt_action_param *par_pP)
{
//-----------------------------------------------------------------------------
- const struct xt_gtpuah_target_info *tgi_p = par_pP->targinfo;
+ const struct xt_gtpusp_target_info *tgi_p = par_pP->targinfo;
if (tgi_p == NULL) {
return NF_ACCEPT;
}
- if (tgi_p->action == PARAM_GTPUAH_ACTION_ADD) {
- _gtpuah_tg4_add(skb_pP, par_pP);
+ if (tgi_p->action == PARAM_GTPUSP_ACTION_ADD) {
+ _gtpusp_tg4_add(skb_pP, par_pP);
return NF_DROP;
}
@@ -669,7 +669,7 @@ _gtpuah_tg4(struct sk_buff *skb_pP, const struct xt_action_param *par_pP)
//-----------------------------------------------------------------------------
static int
-__init gtpuah_tg_init(void)
+__init gtpusp_tg_init(void)
//-----------------------------------------------------------------------------
{
int err;
@@ -689,69 +689,69 @@ __init gtpuah_tg_init(void)
gtpu_enb_port, gtpu_sgw_port, sgw_addr);
// UDP socket socket
- memset(&_gtpuah_sock, 0, sizeof(gtpuah_sock_t));
+ memset(&_gtpusp_sock, 0, sizeof(gtpusp_sock_t));
/* create a socket */
- if ((err = sock_create(AF_INET, SOCK_DGRAM, IPPROTO_UDP, &_gtpuah_sock.sock)) < 0 ) {
+ if ((err = sock_create(AF_INET, SOCK_DGRAM, IPPROTO_UDP, &_gtpusp_sock.sock)) < 0 ) {
PR_INFO(": Could not create a datagram socket, error = %d\n", -ENXIO);
return err;
}
- _gtpuah_sock.addr.sin_family = AF_INET;
- _gtpuah_sock.addr.sin_port = htons(gtpu_sgw_port);
- _gtpuah_sock.addr.sin_addr.s_addr = in_aton(sgw_addr);
+ _gtpusp_sock.addr.sin_family = AF_INET;
+ _gtpusp_sock.addr.sin_port = htons(gtpu_sgw_port);
+ _gtpusp_sock.addr.sin_addr.s_addr = in_aton(sgw_addr);
- _gtpuah_sock.addr_send.sin_family = AF_INET;
- _gtpuah_sock.addr_send.sin_port = htons(gtpu_enb_port);
- _gtpuah_sock.addr_send.sin_addr.s_addr = in_aton(sgw_addr);
+ _gtpusp_sock.addr_send.sin_family = AF_INET;
+ _gtpusp_sock.addr_send.sin_port = htons(gtpu_enb_port);
+ _gtpusp_sock.addr_send.sin_addr.s_addr = in_aton(sgw_addr);
- _gtpuah_sock.thread_stop_requested = 0;
+ _gtpusp_sock.thread_stop_requested = 0;
- if ( (err = _gtpuah_sock.sock->ops->bind(_gtpuah_sock.sock, (struct sockaddr *)&_gtpuah_sock.addr, sizeof(struct sockaddr) ) ) < 0) {
+ if ( (err = _gtpusp_sock.sock->ops->bind(_gtpusp_sock.sock, (struct sockaddr *)&_gtpusp_sock.addr, sizeof(struct sockaddr) ) ) < 0) {
pr_info(MODULE_NAME": Could not bind socket, error = %d\n", -err);
goto close_and_out;
}
// start kernel thread
- _gtpuah_sock.thread = kthread_run((void *)_udp_thread, NULL, MODULE_NAME);
- if (IS_ERR(_gtpuah_sock.thread)) {
+ _gtpusp_sock.thread = kthread_run((void *)_udp_thread, NULL, MODULE_NAME);
+ if (IS_ERR(_gtpusp_sock.thread)) {
pr_info(MODULE_NAME": unable to start kernel thread\n");
return -ENOMEM;
}
- if((_gtpuah_sock.thread)) {
- wake_up_process(_gtpuah_sock.thread);
+ if((_gtpusp_sock.thread)) {
+ wake_up_process(_gtpusp_sock.thread);
}
- return xt_register_targets(gtpuah_tg_reg, ARRAY_SIZE(gtpuah_tg_reg));
+ return xt_register_targets(gtpusp_tg_reg, ARRAY_SIZE(gtpusp_tg_reg));
close_and_out:
- sock_release(_gtpuah_sock.sock);
- _gtpuah_sock.sock = NULL;
+ sock_release(_gtpusp_sock.sock);
+ _gtpusp_sock.sock = NULL;
return err;
}
//-----------------------------------------------------------------------------
static void
-__exit gtpuah_tg_exit(void)
+__exit gtpusp_tg_exit(void)
//-----------------------------------------------------------------------------
{
int err;
int loop = 0;
- if (_gtpuah_sock.thread==NULL) {
+ if (_gtpusp_sock.thread==NULL) {
pr_info(MODULE_NAME": no kernel thread to kill\n");
} else {
- if (_gtpuah_sock.running > 0) {
- _gtpuah_sock.thread_stop_requested = 1;
+ if (_gtpusp_sock.running > 0) {
+ _gtpusp_sock.thread_stop_requested = 1;
pr_info(MODULE_NAME": exit kernel thread requested\n");
do {
pr_info(MODULE_NAME": waking up thread with datagram\n");
msleep(5);
pr_info(MODULE_NAME": waiting for thread...\n");
loop++;
- } while ((_gtpuah_sock.running > 0) && (loop < 20));
- if (_gtpuah_sock.running > 0) {
+ } while ((_gtpusp_sock.running > 0) && (loop < 20));
+ if (_gtpusp_sock.running > 0) {
pr_info(MODULE_NAME": stopping kernel thread\n");
- err = kthread_stop(_gtpuah_sock.thread);
+ err = kthread_stop(_gtpusp_sock.thread);
if(!err) {
pr_info(MODULE_NAME": Successfully killed kernel thread!\n");
} else {
@@ -764,17 +764,17 @@ __exit gtpuah_tg_exit(void)
}
/* free allocated resources before exit */
- if (_gtpuah_sock.sock != NULL) {
- sock_release(_gtpuah_sock.sock);
- _gtpuah_sock.sock = NULL;
+ if (_gtpusp_sock.sock != NULL) {
+ sock_release(_gtpusp_sock.sock);
+ _gtpusp_sock.sock = NULL;
}
- xt_unregister_targets(gtpuah_tg_reg, ARRAY_SIZE(gtpuah_tg_reg));
+ xt_unregister_targets(gtpusp_tg_reg, ARRAY_SIZE(gtpusp_tg_reg));
pr_info(MODULE_NAME": Unloading module\n");
}
-module_init(gtpuah_tg_init);
-module_exit(gtpuah_tg_exit);
-MODULE_ALIAS("ipt6_GTPUAH");
-MODULE_ALIAS("ipt_GTPUAH");
+module_init(gtpusp_tg_init);
+module_exit(gtpusp_tg_exit);
+MODULE_ALIAS("ipt6_GTPUSP");
+MODULE_ALIAS("ipt_GTPUSP");
diff --git a/openair-cn/GTPV1-U/GTPUAH/xt_GTPUAH.h b/openair-cn/GTPV1-U/GTPU_SP/xt_GTPUSP.h
similarity index 84%
rename from openair-cn/GTPV1-U/GTPUAH/xt_GTPUAH.h
rename to openair-cn/GTPV1-U/GTPU_SP/xt_GTPUSP.h
index e59b722627..e4d72f5875 100755
--- a/openair-cn/GTPV1-U/GTPUAH/xt_GTPUAH.h
+++ b/openair-cn/GTPV1-U/GTPU_SP/xt_GTPUSP.h
@@ -9,11 +9,11 @@
*
*/
-enum xt_gtpuah_mode_ {
- PARAM_GTPUAH_ACTION_ADD = 1 << 8,
+enum xt_gtpusp_mode_ {
+ PARAM_GTPUSP_ACTION_ADD = 1 << 8,
};
-struct xt_gtpuah_target_info {
+struct xt_gtpusp_target_info {
u_int32_t laddr __attribute__((aligned(8)));
u_int32_t raddr __attribute__((aligned(8)));
u_int32_t ltun __attribute__((aligned(8)));
diff --git a/openair-cn/GTPV1-U/gtpv1u_eNB.c b/openair-cn/GTPV1-U/gtpv1u_eNB.c
index 5514483b67..704123c3b2 100644
--- a/openair-cn/GTPV1-U/gtpv1u_eNB.c
+++ b/openair-cn/GTPV1-U/gtpv1u_eNB.c
@@ -78,19 +78,19 @@ gtpv1u_eNB_send_init_udp(
NwGtpv1uRcT
gtpv1u_eNB_log_request(
NwGtpv1uLogMgrHandleT hLogMgr,
- NwU32T logLevel,
+ uint32_t logLevel,
NwCharT *file,
- NwU32T line,
+ uint32_t line,
NwCharT *logStr);
NwGtpv1uRcT
gtpv1u_eNB_send_udp_msg(
NwGtpv1uUdpHandleT udpHandle,
- NwU8T *buffer,
- NwU32T buffer_len,
- NwU32T buffer_offset,
- NwU32T peerIpAddr,
- NwU16T peerPort);
+ uint8_t *buffer,
+ uint32_t buffer_len,
+ uint32_t buffer_offset,
+ uint32_t peerIpAddr,
+ uint16_t peerPort);
NwGtpv1uRcT
gtpv1u_eNB_process_stack_req(
@@ -114,9 +114,9 @@ data_recv_callback(
static NwGtpv1uRcT
gtpv1u_start_timer_wrapper(
NwGtpv1uTimerMgrHandleT tmrMgrHandle,
- NwU32T timeoutSec,
- NwU32T timeoutUsec,
- NwU32T tmrType,
+ uint32_t timeoutSec,
+ uint32_t timeoutUsec,
+ uint32_t tmrType,
void *timeoutArg,
NwGtpv1uTimerHandleT *hTmr);
@@ -142,10 +142,11 @@ gtpv1u_new_data_req(
uint32_t buf_offsetP
);
-static int
+int
gtpv1u_create_s1u_tunnel(
const instance_t instanceP,
- const gtpv1u_enb_create_tunnel_req_t * const create_tunnel_req_pP);
+ const gtpv1u_enb_create_tunnel_req_t * const create_tunnel_req_pP,
+ gtpv1u_enb_create_tunnel_resp_t * const create_tunnel_resp_pP);
static int
gtpv1u_delete_s1u_tunnel(
@@ -241,9 +242,9 @@ static int gtpv1u_eNB_send_init_udp(uint16_t port_number)
//-----------------------------------------------------------------------------
NwGtpv1uRcT gtpv1u_eNB_log_request(NwGtpv1uLogMgrHandleT hLogMgr,
- NwU32T logLevel,
+ uint32_t logLevel,
NwCharT *file,
- NwU32T line,
+ uint32_t line,
NwCharT *logStr)
{
LOG_D(GTPU, "%s\n", logStr);
@@ -253,11 +254,11 @@ NwGtpv1uRcT gtpv1u_eNB_log_request(NwGtpv1uLogMgrHandleT hLogMgr,
//-----------------------------------------------------------------------------
NwGtpv1uRcT gtpv1u_eNB_send_udp_msg(
NwGtpv1uUdpHandleT udpHandle,
- NwU8T *buffer,
- NwU32T buffer_len,
- NwU32T buffer_offset,
- NwU32T peerIpAddr,
- NwU16T peerPort)
+ uint8_t *buffer,
+ uint32_t buffer_len,
+ uint32_t buffer_offset,
+ uint32_t peerIpAddr,
+ uint16_t peerPort)
{
// Create and alloc new message
MessageDef *message_p = NULL;
@@ -491,9 +492,9 @@ int data_recv_callback(uint16_t portP,
//-----------------------------------------------------------------------------
static NwGtpv1uRcT gtpv1u_start_timer_wrapper(
NwGtpv1uTimerMgrHandleT tmrMgrHandle,
- NwU32T timeoutSec,
- NwU32T timeoutUsec,
- NwU32T tmrType,
+ uint32_t timeoutSec,
+ uint32_t timeoutUsec,
+ uint32_t tmrType,
void *timeoutArg,
NwGtpv1uTimerHandleT *hTmr)
{
@@ -658,10 +659,12 @@ gtpv1u_new_data_req(
}
//-----------------------------------------------------------------------------
-static int
+int
gtpv1u_create_s1u_tunnel(
- const instance_t instanceP,
- const gtpv1u_enb_create_tunnel_req_t * const create_tunnel_req_pP)
+ const instance_t instanceP,
+ const gtpv1u_enb_create_tunnel_req_t * const create_tunnel_req_pP,
+ gtpv1u_enb_create_tunnel_resp_t * const create_tunnel_resp_pP
+ )
{
/* Create a new nw-gtpv1-u stack req using API */
NwGtpv1uUlpApiT stack_req;
@@ -689,10 +692,9 @@ gtpv1u_create_s1u_tunnel(
create_tunnel_req_pP->num_tunnels, create_tunnel_req_pP->eps_bearer_id[0],
create_tunnel_req_pP->sgw_S1u_teid[0]);
- message_p = itti_alloc_new_message(TASK_GTPV1_U, GTPV1U_ENB_CREATE_TUNNEL_RESP);
- GTPV1U_ENB_CREATE_TUNNEL_RESP(message_p).rnti = create_tunnel_req_pP->rnti;
- GTPV1U_ENB_CREATE_TUNNEL_RESP(message_p).status = 0;
- GTPV1U_ENB_CREATE_TUNNEL_RESP(message_p).num_tunnels = 0;
+ create_tunnel_resp_pP->rnti = create_tunnel_req_pP->rnti;
+ create_tunnel_resp_pP->status = 0;
+ create_tunnel_resp_pP->num_tunnels = 0;
for (i = 0; i < create_tunnel_req_pP->num_tunnels; i++) {
ip_offset = 0;
@@ -729,10 +731,10 @@ gtpv1u_create_s1u_tunnel(
gtpv1u_ue_data_p->ue_id = create_tunnel_req_pP->rnti;
gtpv1u_ue_data_p->instance_id = 0; // TO DO
- memcpy(>PV1U_ENB_CREATE_TUNNEL_RESP(message_p).enb_addr.buffer,
+ memcpy(&create_tunnel_resp_pP->enb_addr.buffer,
>pv1u_data_g.enb_ip_address_for_S1u_S12_S4_up,
sizeof (in_addr_t));
- GTPV1U_ENB_CREATE_TUNNEL_RESP(message_p).enb_addr.length = sizeof (in_addr_t);
+ create_tunnel_resp_pP->enb_addr.length = sizeof (in_addr_t);
addrs_length_in_bytes = create_tunnel_req_pP->sgw_addr[i].length / 8;
AssertFatal((addrs_length_in_bytes == 4) ||
@@ -755,18 +757,19 @@ gtpv1u_create_s1u_tunnel(
16);
}
- gtpv1u_ue_data_p->bearers[eps_bearer_id - GTPV1U_BEARER_OFFSET].state = BEARER_IN_CONFIG;
- gtpv1u_ue_data_p->bearers[eps_bearer_id - GTPV1U_BEARER_OFFSET].teid_eNB = s1u_teid;
- gtpv1u_ue_data_p->bearers[eps_bearer_id - GTPV1U_BEARER_OFFSET].teid_sgw = create_tunnel_req_pP->sgw_S1u_teid[i];
- GTPV1U_ENB_CREATE_TUNNEL_RESP(message_p).enb_S1u_teid[i] = s1u_teid;
+ gtpv1u_ue_data_p->bearers[eps_bearer_id - GTPV1U_BEARER_OFFSET].state = BEARER_IN_CONFIG;
+ gtpv1u_ue_data_p->bearers[eps_bearer_id - GTPV1U_BEARER_OFFSET].teid_eNB = s1u_teid;
+ gtpv1u_ue_data_p->bearers[eps_bearer_id - GTPV1U_BEARER_OFFSET].teid_eNB_stack_session = stack_req.apiInfo.createTunnelEndPointInfo.hStackSession;
+ gtpv1u_ue_data_p->bearers[eps_bearer_id - GTPV1U_BEARER_OFFSET].teid_sgw = create_tunnel_req_pP->sgw_S1u_teid[i];
+ create_tunnel_resp_pP->enb_S1u_teid[i] = s1u_teid;
} else {
- GTPV1U_ENB_CREATE_TUNNEL_RESP(message_p).enb_S1u_teid[i] = 0;
- GTPV1U_ENB_CREATE_TUNNEL_RESP(message_p).status = 0xFF;
+ create_tunnel_resp_pP->enb_S1u_teid[i] = 0;
+ create_tunnel_resp_pP->status = 0xFF;
}
- GTPV1U_ENB_CREATE_TUNNEL_RESP(message_p).eps_bearer_id[i] = eps_bearer_id;
- GTPV1U_ENB_CREATE_TUNNEL_RESP(message_p).num_tunnels += 1;
+ create_tunnel_resp_pP->eps_bearer_id[i] = eps_bearer_id;
+ create_tunnel_resp_pP->num_tunnels += 1;
//-----------------------
// GTPV1U->PDCP mapping
@@ -781,8 +784,8 @@ gtpv1u_create_s1u_tunnel(
hash_rc = hashtable_insert(gtpv1u_data_g.teid_mapping, s1u_teid, gtpv1u_teid_data_p);
AssertFatal(hash_rc == HASH_TABLE_OK, "Error inserting teid mapping in GTPV1U hashtable");
} else {
- GTPV1U_ENB_CREATE_TUNNEL_RESP(message_p).enb_S1u_teid[i] = 0;
- GTPV1U_ENB_CREATE_TUNNEL_RESP(message_p).status = 0xFF;
+ create_tunnel_resp_pP->enb_S1u_teid[i] = 0;
+ create_tunnel_resp_pP->status = 0xFF;
}
}
MSC_LOG_TX_MESSAGE(
@@ -790,13 +793,13 @@ gtpv1u_create_s1u_tunnel(
MSC_RRC_ENB,
NULL,0,
"0 GTPV1U_ENB_CREATE_TUNNEL_RESP rnti %x teid %x",
- GTPV1U_ENB_CREATE_TUNNEL_RESP(message_p).rnti,
+ create_tunnel_resp_pP->rnti,
s1u_teid);
LOG_D(GTPU, "Tx GTPV1U_ENB_CREATE_TUNNEL_RESP ue rnti %x status %d\n",
create_tunnel_req_pP->rnti,
- GTPV1U_ENB_CREATE_TUNNEL_RESP(message_p).status);
- return itti_send_msg_to_task(TASK_RRC_ENB, instanceP, message_p);
+ create_tunnel_resp_pP->status);
+ return 0;
}
@@ -835,9 +838,7 @@ static int gtpv1u_delete_s1u_tunnel(
LOG_D(GTPU, "gtpv1u_delete_s1u_tunnel erab %u %u\n",
req_pP->eps_bearer_id[erab_index],
teid_eNB);
- stack_req.apiInfo.createTunnelEndPointInfo.teid = teid_eNB;
- stack_req.apiInfo.createTunnelEndPointInfo.hUlpSession = 0;
- stack_req.apiInfo.createTunnelEndPointInfo.hStackSession = 0;
+ stack_req.apiInfo.destroyTunnelEndPointInfo.hStackSessionHandle = gtpv1u_ue_data_p->bearers[req_pP->eps_bearer_id[erab_index] - GTPV1U_BEARER_OFFSET].teid_eNB_stack_session;
rc = nwGtpv1uProcessUlpReq(gtpv1u_data_g.gtpv1u_stack, &stack_req);
LOG_D(GTPU, ".\n");
@@ -1000,6 +1001,7 @@ void *gtpv1u_eNB_task(void *args)
rc = gtpv1u_eNB_init();
AssertFatal(rc == 0, "gtpv1u_eNB_init Failed");
itti_mark_task_ready(TASK_GTPV1_U);
+ MSC_START_USE();
while(1) {
/* Trying to fetch a message from the message queue.
@@ -1015,10 +1017,6 @@ void *gtpv1u_eNB_task(void *args)
msg_name_p = ITTI_MSG_NAME(received_message_p);
switch (ITTI_MSG_ID(received_message_p)) {
- case GTPV1U_ENB_CREATE_TUNNEL_REQ: {
- gtpv1u_create_s1u_tunnel(instance, &received_message_p->ittiMsg.Gtpv1uCreateTunnelReq);
- }
- break;
case GTPV1U_ENB_DELETE_TUNNEL_REQ: {
gtpv1u_delete_s1u_tunnel(instance, &received_message_p->ittiMsg.Gtpv1uDeleteTunnelReq);
@@ -1081,14 +1079,14 @@ void *gtpv1u_eNB_task(void *args)
if (rc != NW_GTPV1U_OK) {
LOG_E(GTPU, "nwGtpv1uGpduMsgNew failed: 0x%x\n", rc);
- MSC_LOG_EVENT(MSC_GTPU_ENB,"Failed send G-PDU ltid %u rtid %u size %u",
+ MSC_LOG_EVENT(MSC_GTPU_ENB,"0 Failed send G-PDU ltid %u rtid %u size %u",
enb_s1u_teid,sgw_s1u_teid,data_req_p->length);
} else {
rc = nwGtpv1uProcessUlpReq(gtpv1u_data_g.gtpv1u_stack, &stack_req);
if (rc != NW_GTPV1U_OK) {
LOG_E(GTPU, "nwGtpv1uProcessUlpReq failed: 0x%x\n", rc);
- MSC_LOG_EVENT(MSC_GTPU_ENB,"Failed send G-PDU ltid %u rtid %u size %u",
+ MSC_LOG_EVENT(MSC_GTPU_ENB,"0 Failed send G-PDU ltid %u rtid %u size %u",
enb_s1u_teid,sgw_s1u_teid,data_req_p->length);
} else {
MSC_LOG_TX_MESSAGE(
diff --git a/openair-cn/GTPV1-U/gtpv1u_eNB_defs.h b/openair-cn/GTPV1-U/gtpv1u_eNB_defs.h
index 454f4effc9..81f00005d9 100644
--- a/openair-cn/GTPV1-U/gtpv1u_eNB_defs.h
+++ b/openair-cn/GTPV1-U/gtpv1u_eNB_defs.h
@@ -35,7 +35,7 @@
*/
#include "hashtable.h"
-
+#include "asn1_constants.h"
#ifndef GTPV1U_ENB_DEFS_H_
#define GTPV1U_ENB_DEFS_H_
@@ -65,8 +65,9 @@ typedef struct gtpv1u_teid_data_s {
typedef struct gtpv1u_bearer_s {
/* TEID used in dl and ul */
- teid_t teid_eNB; ///< eNB TEID
- teid_t teid_sgw; ///< Remote TEID
+ teid_t teid_eNB; ///< eNB TEID
+ uintptr_t teid_eNB_stack_session; ///< eNB TEID
+ teid_t teid_sgw; ///< Remote TEID
in_addr_t sgw_ip_addr;
struct in6_addr sgw_ip6_addr;
tcp_udp_port_t port;
diff --git a/openair-cn/GTPV1-U/gtpv1u_eNB_task.h b/openair-cn/GTPV1-U/gtpv1u_eNB_task.h
index 701f4c7c93..ce6643b131 100755
--- a/openair-cn/GTPV1-U/gtpv1u_eNB_task.h
+++ b/openair-cn/GTPV1-U/gtpv1u_eNB_task.h
@@ -36,6 +36,8 @@
#ifndef GTPV1U_ENB_TASK_H_
#define GTPV1U_ENB_TASK_H_
+#include "messages_types.h"
+
int
gtpv1u_new_data_req(
uint8_t enb_id,
@@ -45,4 +47,11 @@ gtpv1u_new_data_req(
uint32_t buf_len);
void *gtpv1u_eNB_task(void *args);
+int
+gtpv1u_create_s1u_tunnel(
+ const instance_t instanceP,
+ const gtpv1u_enb_create_tunnel_req_t * const create_tunnel_req_pP,
+ gtpv1u_enb_create_tunnel_resp_t * const create_tunnel_resp_pP);
+
+
#endif /* GTPV1U_ENB_TASK_H_ */
diff --git a/openair-cn/GTPV1-U/gtpv1u_sgw_defs.h b/openair-cn/GTPV1-U/gtpv1u_sgw_defs.h
index 75d72c08d8..a525c388a2 100644
--- a/openair-cn/GTPV1-U/gtpv1u_sgw_defs.h
+++ b/openair-cn/GTPV1-U/gtpv1u_sgw_defs.h
@@ -48,12 +48,12 @@ typedef enum {
BEARER_MAX,
} bearer_state_t;
-#define BUFFER_TO_NwU32T(buf, x) \
+#define BUFFER_TO_uint32_t(buf, x) \
do { \
- x = ((NwU32T)((buf)[0]) ) | \
- ((NwU32T)((buf)[1]) << 8) | \
- ((NwU32T)((buf)[2]) << 16) | \
- ((NwU32T)((buf)[3]) << 24); \
+ x = ((uint32_t)((buf)[0]) ) | \
+ ((uint32_t)((buf)[1]) << 8) | \
+ ((uint32_t)((buf)[2]) << 16) | \
+ ((uint32_t)((buf)[3]) << 24); \
} while(0)
diff --git a/openair-cn/GTPV1-U/gtpv1u_task.c b/openair-cn/GTPV1-U/gtpv1u_task.c
index efb849c5ea..f98db6056e 100644
--- a/openair-cn/GTPV1-U/gtpv1u_task.c
+++ b/openair-cn/GTPV1-U/gtpv1u_task.c
@@ -50,13 +50,12 @@
#include "NwLog.h"
#include "gtpv1u_sgw_defs.h"
#include "NwGtpv1uPrivate.h"
+#include "msc.h"
//static NwGtpv1uStackHandleT gtpv1u_stack = 0;
static gtpv1u_data_t gtpv1u_sgw_data;
-#if !defined(ENABLE_USE_GTPU_IN_KERNEL)
-static int gtpv1u_send_init_udp(uint16_t port_number);
-#endif
+
static int gtpv1u_create_s1u_tunnel(Gtpv1uCreateTunnelReq *create_tunnel_reqP);
static int gtpv1u_delete_s1u_tunnel(Teid_t context_teidP, Teid_t S1U_teidP);
static int gtpv1u_update_s1u_tunnel(Gtpv1uUpdateTunnelReq *reqP);
@@ -64,17 +63,17 @@ static void *gtpv1u_thread(void *args);
NwGtpv1uRcT gtpv1u_send_udp_msg(
NwGtpv1uUdpHandleT udpHandle,
- NwU8T *buffer,
- NwU32T buffer_len,
- NwU32T buffer_offset,
- NwU32T peerIpAddr,
- NwU32T peerPort);
+ uint8_t *buffer,
+ uint32_t buffer_len,
+ uint32_t buffer_offset,
+ uint32_t peerIpAddr,
+ uint32_t peerPort);
NwGtpv1uRcT gtpv1u_log_request(
NwGtpv1uLogMgrHandleT hLogMgr,
- NwU32T logLevel,
+ uint32_t logLevel,
NwCharT *file,
- NwU32T line,
+ uint32_t line,
NwCharT *logStr);
NwGtpv1uRcT gtpv1u_process_stack_req(
@@ -149,48 +148,23 @@ void gtpu_print_hex_octets(unsigned char* dataP, unsigned long sizeP)
}
-#if !defined(ENABLE_USE_GTPU_IN_KERNEL)
-static int gtpv1u_send_init_udp(uint16_t port_number)
-{
- // Create and alloc new message
- MessageDef *message_p;
- struct in_addr addr;
-
- message_p = itti_alloc_new_message(TASK_GTPV1_U, UDP_INIT);
-
- if (message_p == NULL) {
- return -1;
- }
-
- UDP_INIT(message_p).port = port_number;
- //LG UDP_INIT(message_p).address = "0.0.0.0"; //ANY address
-
- addr.s_addr = gtpv1u_sgw_data.sgw_ip_address_for_S1u_S12_S4_up;
- UDP_INIT(message_p).address = inet_ntoa(addr);
- GTPU_DEBUG("Tx UDP_INIT IP addr %s\n", UDP_INIT(message_p).address);
-
- return itti_send_msg_to_task(TASK_UDP, INSTANCE_DEFAULT, message_p);
-}
-#endif
-
NwGtpv1uRcT gtpv1u_log_request(NwGtpv1uLogMgrHandleT hLogMgr,
- NwU32T logLevel,
+ uint32_t logLevel,
NwCharT *file,
- NwU32T line,
+ uint32_t line,
NwCharT *logStr)
{
GTPU_DEBUG("%s\n", logStr);
return NW_GTPV1U_OK;
}
-#if !defined(ENABLE_USE_GTPU_IN_KERNEL)
NwGtpv1uRcT gtpv1u_send_udp_msg(
NwGtpv1uUdpHandleT udpHandle,
- NwU8T *buffer,
- NwU32T buffer_len,
- NwU32T buffer_offset,
- NwU32T peerIpAddr,
- NwU32T peerPort)
+ uint8_t *buffer,
+ uint32_t buffer_len,
+ uint32_t buffer_offset,
+ uint32_t peerIpAddr,
+ uint32_t peerPort)
{
// Create and alloc new message
MessageDef *message_p;
@@ -208,7 +182,7 @@ NwGtpv1uRcT gtpv1u_send_udp_msg(
return itti_send_msg_to_task(TASK_UDP, INSTANCE_DEFAULT, message_p);
}
-#endif
+
/* Callback called when a gtpv1u message arrived on UDP interface */
NwGtpv1uRcT gtpv1u_process_stack_req(
NwGtpv1uUlpHandleT hUlp,
@@ -229,7 +203,7 @@ NwGtpv1uRcT gtpv1u_process_stack_req(
* task for transmission.
*/
/*if (NW_GTPV1U_OK != nwGtpv1uMsgGetTpdu(pUlpApi->apiInfo.recvMsgInfo.hMsg,
- buffer, (NwU32T *)&buffer_len)) {
+ buffer, (uint32_t *)&buffer_len)) {
GTPU_ERROR("Error while retrieving T-PDU\n");
}*/
GTPU_DEBUG("Received TPDU from gtpv1u stack %u with size %d\n",
@@ -397,9 +371,9 @@ static int gtpv1u_update_s1u_tunnel(Gtpv1uUpdateTunnelReq *reqP)
static NwGtpv1uRcT gtpv1u_start_timer_wrapper(
NwGtpv1uTimerMgrHandleT tmrMgrHandle,
- NwU32T timeoutSec,
- NwU32T timeoutUsec,
- NwU32T tmrType,
+ uint32_t timeoutSec,
+ uint32_t timeoutUsec,
+ uint32_t tmrType,
void *timeoutArg,
NwGtpv1uTimerHandleT *hTmr)
{
@@ -441,6 +415,7 @@ static NwGtpv1uRcT gtpv1u_stop_timer_wrapper(
static void *gtpv1u_thread(void *args)
{
itti_mark_task_ready(TASK_GTPV1_U);
+ MSC_START_USE();
while(1) {
/* Trying to fetch a message from the message queue.
@@ -451,21 +426,11 @@ static void *gtpv1u_thread(void *args)
itti_receive_msg(TASK_GTPV1_U, &received_message_p);
DevAssert(received_message_p != NULL);
-#if !defined(ENABLE_USE_GTPU_IN_KERNEL)
switch (ITTI_MSG_ID(received_message_p)) {
- case GTPV1U_CREATE_TUNNEL_REQ: {
- gtpv1u_create_s1u_tunnel(&received_message_p->ittiMsg.gtpv1uCreateTunnelReq);
- }
- break;
- case GTPV1U_DELETE_TUNNEL_REQ: {
- gtpv1u_delete_s1u_tunnel(received_message_p->ittiMsg.gtpv1uDeleteTunnelReq.context_teid, received_message_p->ittiMsg.gtpv1uDeleteTunnelReq.S1u_teid);
- }
- break;
-
- case GTPV1U_UPDATE_TUNNEL_REQ: {
- gtpv1u_update_s1u_tunnel(&received_message_p->ittiMsg.gtpv1uUpdateTunnelReq);
+ case TERMINATE_MESSAGE: {
+ itti_exit_task();
}
break;
@@ -474,85 +439,11 @@ static void *gtpv1u_thread(void *args)
udp_data_ind_t *udp_data_ind_p;
udp_data_ind_p = &received_message_p->ittiMsg.udp_data_ind;
nwGtpv1uProcessUdpReq(gtpv1u_sgw_data.gtpv1u_stack,
- udp_data_ind_p->buffer,
- udp_data_ind_p->buffer_length,
- udp_data_ind_p->peer_port,
- udp_data_ind_p->peer_address);
- //itti_free(ITTI_MSG_ORIGIN_ID(received_message_p), udp_data_ind_p->buffer);
- }
- break;
-
- // DATA TO BE SENT TO UDP
- case GTPV1U_TUNNEL_DATA_REQ: {
- Gtpv1uTunnelDataReq *data_req_p = NULL;
- NwGtpv1uUlpApiT stack_req;
- NwGtpv1uRcT rc;
- hashtable_rc_t hash_rc;
- gtpv1u_teid2enb_info_t *gtpv1u_teid2enb_info = NULL;
-
- data_req_p = &received_message_p->ittiMsg.gtpv1uTunnelDataReq;
-
- //GTPU_DEBUG("-- GTPV1U_TUNNEL_DATA_REQ -----------------------------------------------------\n%s :\n",
- // __FUNCTION__);
- //gtpu_print_hex_octets(data_req_p->buffer, data_req_p->length);
-
-
- memset(&stack_req, 0, sizeof(NwGtpv1uUlpApiT));
-
- hash_rc = hashtable_get(gtpv1u_sgw_data.S1U_mapping, (uint64_t)data_req_p->local_S1u_teid, (void**)>pv1u_teid2enb_info);
-
- if (hash_rc == HASH_TABLE_KEY_NOT_EXISTS) {
- GTPU_ERROR("nwGtpv1uProcessUlpReq failed: while getting teid %u in hashtable S1U_mapping\n", data_req_p->local_S1u_teid);
- } else {
- stack_req.apiType = NW_GTPV1U_ULP_API_SEND_TPDU;
- //stack_req.apiInfo.sendtoInfo.teid = data_req_p->local_S1u_teid;
- stack_req.apiInfo.sendtoInfo.teid = gtpv1u_teid2enb_info->teid_enb;
- BUFFER_TO_NwU32T(gtpv1u_teid2enb_info->enb_ip_addr.address.ipv4_address, stack_req.apiInfo.sendtoInfo.ipAddr);
-
- /*nwGtpv1uGpduMsgNew( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
- NW_IN NwU32T teid,
- NW_IN NwU8T seqNumFlag,
- NW_IN NwU16T seqNum,
- NW_IN NwU8T *tpdu,
- NW_IN NwU16T tpduLength,
- NW_OUT NwGtpv1uMsgHandleT *phMsg)*/
- GTPU_DEBUG("GTPV1U_TUNNEL_DATA_REQ seq num %d %d bytes\n",
- gtpv1u_sgw_data.seq_num,
- data_req_p->length);
- rc = nwGtpv1uGpduMsgNew(gtpv1u_sgw_data.gtpv1u_stack,
- 00,// TO DO bearer_p->port, but not needed when looking at processing
- NW_FALSE,
- gtpv1u_sgw_data.seq_num++,
- data_req_p->buffer,
- data_req_p->length,
- data_req_p->offset,
- &(stack_req.apiInfo.sendtoInfo.hMsg));
-
- if (rc != NW_GTPV1U_OK) {
- GTPU_ERROR("nwGtpv1uGpduMsgNew failed: 0x%x\n", rc);
- } else {
- rc = nwGtpv1uProcessUlpReq(gtpv1u_sgw_data.gtpv1u_stack, &stack_req);
-
- if (rc != NW_GTPV1U_OK) {
- GTPU_ERROR("nwGtpv1uProcessUlpReq failed: 0x%x\n", rc);
- }
-
- rc = nwGtpv1uMsgDelete(gtpv1u_sgw_data.gtpv1u_stack,
- stack_req.apiInfo.sendtoInfo.hMsg);
-
- if (rc != NW_GTPV1U_OK) {
- GTPU_ERROR("nwGtpv1uMsgDelete failed: 0x%x\n", rc);
- }
- }
- }
-
- /* Buffer is still needed, do not free it */
- //itti_free(ITTI_MSG_ORIGIN_ID(received_message_p), data_req_p->buffer);
- }
- break;
-
- case TERMINATE_MESSAGE: {
- itti_exit_task();
+ udp_data_ind_p->buffer,
+ udp_data_ind_p->buffer_length,
+ udp_data_ind_p->peer_port,
+ udp_data_ind_p->peer_address);
+ //itti_free(ITTI_MSG_ORIGIN_ID(received_message_p), udp_data_ind_p->buffer);
}
break;
@@ -568,7 +459,6 @@ static void *gtpv1u_thread(void *args)
break;
}
-#endif
itti_free(ITTI_MSG_ORIGIN_ID(received_message_p), received_message_p);
received_message_p = NULL;
}
@@ -591,82 +481,11 @@ int gtpv1u_init(const mme_config_t *mme_config_p)
gtpv1u_sgw_data.sgw_ip_address_for_S1u_S12_S4_up = mme_config_p->ipv4.sgw_ip_address_for_S1u_S12_S4_up;
-#if !defined(ENABLE_USE_GTPU_IN_KERNEL)
- gtpv1u_sgw_data.S1U_mapping = hashtable_create (8192, NULL, NULL);
-
- if (gtpv1u_sgw_data.S1U_mapping == NULL) {
- perror("hashtable_create");
- GTPU_ERROR("Initializing TASK_GTPV1_U task interface: ERROR\n");
- return -1;
- }
-
- /* Initializing GTPv1-U stack */
- if ((rc = nwGtpv1uInitialize(>pv1u_sgw_data.gtpv1u_stack, GTPU_STACK_SGW)) != NW_GTPV1U_OK) {
- GTPU_ERROR("Failed to setup nwGtpv1u stack %x\n", rc);
- return -1;
- }
-
- if ((rc = nwGtpv1uSetLogLevel(gtpv1u_sgw_data.gtpv1u_stack,
- NW_LOG_LEVEL_DEBG)) != NW_GTPV1U_OK) {
- GTPU_ERROR("Failed to setup loglevel for stack %x\n", rc);
- return -1;
- }
-
- /* Set the ULP API callback. Called once message have been processed by the
- * nw-gtpv1u stack.
- */
- ulp.ulpReqCallback = gtpv1u_process_stack_req;
-
- if ((rc = nwGtpv1uSetUlpEntity(gtpv1u_sgw_data.gtpv1u_stack, &ulp)) != NW_GTPV1U_OK) {
- GTPU_ERROR("nwGtpv1uSetUlpEntity: %x", rc);
- return -1;
- }
-
- /* nw-gtpv1u stack requires an udp callback to send data over UDP.
- * We provide a wrapper to UDP task.
- */
- udp.udpDataReqCallback = gtpv1u_send_udp_msg;
-
- if ((rc = nwGtpv1uSetUdpEntity(gtpv1u_sgw_data.gtpv1u_stack, &udp)) != NW_GTPV1U_OK) {
- GTPU_ERROR("nwGtpv1uSetUdpEntity: %x", rc);
- return -1;
- }
-
- log.logReqCallback = gtpv1u_log_request;
-
- if ((rc = nwGtpv1uSetLogMgrEntity(gtpv1u_sgw_data.gtpv1u_stack, &log)) != NW_GTPV1U_OK) {
- GTPU_ERROR("nwGtpv1uSetLogMgrEntity: %x", rc);
- return -1;
- }
-
- /* Timer interface is more complicated as both wrappers doesn't send a message
- * to the timer task but call the timer API functions start/stop timer.
- */
- tmr.tmrMgrHandle = 0;
- tmr.tmrStartCallback = gtpv1u_start_timer_wrapper;
- tmr.tmrStopCallback = gtpv1u_stop_timer_wrapper;
-
- if ((rc = nwGtpv1uSetTimerMgrEntity(gtpv1u_sgw_data.gtpv1u_stack, &tmr)) != NW_GTPV1U_OK) {
- GTPU_ERROR("nwGtpv1uSetTimerMgrEntity: %x", rc);
- return -1;
- }
-
-#endif
-
if (itti_create_task(TASK_GTPV1_U, >pv1u_thread, NULL) < 0) {
GTPU_ERROR("gtpv1u phtread_create: %s", strerror(errno));
return -1;
}
-#if !defined(ENABLE_USE_GTPU_IN_KERNEL)
-
- ret = gtpv1u_send_init_udp(mme_config_p->gtpv1u_config.port_number);
-
- if (ret < 0) {
- return ret;
- }
-
-#endif
GTPU_DEBUG("Initializing GTPV1U interface: DONE\n");
return ret;
diff --git a/openair-cn/GTPV1-U/gtpv1u_teid_pool.c b/openair-cn/GTPV1-U/gtpv1u_teid_pool.c
index 05db901e93..3cbafd8979 100644
--- a/openair-cn/GTPV1-U/gtpv1u_teid_pool.c
+++ b/openair-cn/GTPV1-U/gtpv1u_teid_pool.c
@@ -37,7 +37,7 @@
#include "gtpv1u.h"
-#define GTPV1U_LINEAR_TEID_ALLOCATION 1
+//#define GTPV1U_LINEAR_TEID_ALLOCATION 1
#ifdef GTPV1U_LINEAR_TEID_ALLOCATION
static uint32_t g_gtpv1u_teid = 0;
diff --git a/openair-cn/GTPV1-U/nw-gtpv1u/include/NwGtpv1uPrivate.h b/openair-cn/GTPV1-U/nw-gtpv1u/include/NwGtpv1uPrivate.h
index 5cd030feb9..59ffb1e174 100644
--- a/openair-cn/GTPV1-U/nw-gtpv1u/include/NwGtpv1uPrivate.h
+++ b/openair-cn/GTPV1-U/nw-gtpv1u/include/NwGtpv1uPrivate.h
@@ -79,15 +79,15 @@ extern "C" {
*/
typedef struct NwGtpv1uStack {
- NwU32T stackType;/**< GTPU_STACK_ENB or GTPU_STACK_SGW */
+ uint32_t stackType;/**< GTPU_STACK_ENB or GTPU_STACK_SGW */
NwPtrT id;
- NwU32T seq;
+ uint32_t seq;
NwGtpv1uUlpEntityT ulp;
NwGtpv1uUdpEntityT udp;
NwGtpv1uMemMgrEntityT memMgr;
NwGtpv1uTimerMgrEntityT tmrMgr;
NwGtpv1uLogMgrEntityT logMgr;
- NwU32T logLevel;
+ uint32_t logLevel;
RB_HEAD( NwGtpv1uOutstandingTxSeqNumTrxnMap, NwGtpv1uTrxn) outstandingTxSeqNumMap;
RB_HEAD( NwGtpv1uOutstandingRxSeqNumTrxnMap, NwGtpv1uTrxn) outstandingRxSeqNumMap;
RB_HEAD(NwGtpv1uTunnelEndPointTMap, NwGtpv1uTunnelEndPoint) sessionMap;
@@ -99,8 +99,8 @@ typedef struct NwGtpv1uStack {
*/
typedef struct NwGtpv1uTunnelEndPoint {
- NwU32T teid; /**< Gtpu Tunnel End Point Identifier */
- NwU32T peerAddr; /**< Peer IP address for the session */
+ uint32_t teid; /**< Gtpu Tunnel End Point Identifier */
+ uint32_t peerAddr; /**< Peer IP address for the session */
NwGtpv1uStackT* pStack; /**< Pointer to the parent stack */
NwGtpv1uUlpSessionHandleT hUlpSession; /**< ULP session handle for the session */
RB_ENTRY (NwGtpv1uTunnelEndPoint) sessionMapRbtNode; /**< RB Tree Data Structure Node */
@@ -152,20 +152,20 @@ nwGtpStopTrxnPeerRspTimer(NwGtpv1uStackT* thiz, NwGtpv1uTimerHandleT* phTmr);
* NwGtpv1uMsgT holds gtpv1u messages to/from the peer.
*/
typedef struct NwGtpv1uMsg {
- NwU8T version;
- NwU8T protocolType;
- NwU8T extHdrFlag;
- NwU8T seqNumFlag;
- NwU16T npduNumFlag;
- NwU32T msgType;
- NwU16T msgLen;
- NwU32T teid;
- NwU16T seqNum;
- NwU8T npduNum;
- NwU8T nextExtHdrType;
- NwU8T* msgBuf;
- NwU32T msgBufLen;
- NwU32T msgBufOffset;
+ uint8_t version;
+ uint8_t protocolType;
+ uint8_t extHdrFlag;
+ uint8_t seqNumFlag;
+ uint16_t npduNumFlag;
+ uint32_t msgType;
+ uint16_t msgLen;
+ uint32_t teid;
+ uint16_t seqNum;
+ uint8_t npduNum;
+ uint8_t nextExtHdrType;
+ uint8_t* msgBuf;
+ uint32_t msgBufLen;
+ uint32_t msgBufOffset;
struct NwGtpv1uMsg* next;
} NwGtpv1uMsgT;
@@ -179,16 +179,16 @@ typedef struct NwGtpv1uMsg {
*/
typedef struct NwGtpv1uTrxn {
- NwU32T seqNum;
- NwU32T peerIp;
- NwU32T peerPort;
- NwU8T maxRetries;
- NwU8T t3Timer;
+ uint32_t seqNum;
+ uint32_t peerIp;
+ uint32_t peerPort;
+ uint8_t maxRetries;
+ uint8_t t3Timer;
NwGtpv1uTimerHandleT hRspTmr;
NwGtpv1uTimeoutInfoT peerRspTimeoutInfo;
NwGtpv1uStackT* pStack;
NwGtpv1uTunnelEndPointT* pSession;
- NwU32T hUlpTrxn;
+ uint32_t hUlpTrxn;
NwGtpv1uMsgT* pMsg;
RB_ENTRY (NwGtpv1uTrxn) outstandingTxSeqNumMapRbtNode; /**< RB Tree Data Structure Node */
RB_ENTRY (NwGtpv1uTrxn) outstandingRxSeqNumMapRbtNode; /**< RB Tree Data Structure Node */
@@ -203,15 +203,15 @@ typedef struct NwGtpv1uTrxn {
#pragma pack(1)
typedef struct NwGtpv1uMsgHeader {
- NwU8T PN:1;
- NwU8T S:1;
- NwU8T E:1;
- NwU8T spare:1;
- NwU8T PT:1;
- NwU8T version:3;
- NwU8T msgType;
- NwU16T msgLength;
- NwU32T teid;
+ uint8_t PN:1;
+ uint8_t S:1;
+ uint8_t E:1;
+ uint8_t spare:1;
+ uint8_t PT:1;
+ uint8_t version:3;
+ uint8_t msgType;
+ uint16_t msgLength;
+ uint32_t teid;
} NwGtpv1uMsgHeaderT;
#pragma pack()
diff --git a/openair-cn/GTPV1-U/nw-gtpv1u/include/NwGtpv1uTrxn.h b/openair-cn/GTPV1-U/nw-gtpv1u/include/NwGtpv1uTrxn.h
index 52de4aafd0..76228416a9 100644
--- a/openair-cn/GTPV1-U/nw-gtpv1u/include/NwGtpv1uTrxn.h
+++ b/openair-cn/GTPV1-U/nw-gtpv1u/include/NwGtpv1uTrxn.h
@@ -56,7 +56,7 @@ nwGtpv1uTrxnNew( NW_IN NwGtpv1uStackT* thiz,
NwGtpv1uRcT
nwGtpv1uTrxnWithSeqNew( NW_IN NwGtpv1uStackT* thiz,
- NW_IN NwU32T seqNum,
+ NW_IN uint32_t seqNum,
NW_OUT NwGtpv1uTrxnT **ppTrxn);
NwGtpv1uRcT
@@ -72,8 +72,8 @@ nwGtpv1uTrxnDelete( NW_INOUT NwGtpv1uTrxnT **pthiz);
NwGtpv1uRcT
nwGtpv1uTrxnCreateAndSendMsg( NW_IN NwGtpv1uStackT* thiz,
NW_IN NwGtpv1uTrxnT *pTrxn,
- NW_IN NwU32T peerIp,
- NW_IN NwU32T peerPort,
+ NW_IN uint32_t peerIp,
+ NW_IN uint32_t peerPort,
NW_IN NwGtpv1uMsgT *pMsg);
#ifdef __cplusplus
diff --git a/openair-cn/GTPV1-U/nw-gtpv1u/shared/NwGtpv1u.h b/openair-cn/GTPV1-U/nw-gtpv1u/shared/NwGtpv1u.h
index 7ba8a29348..c6f7c3d6fa 100644
--- a/openair-cn/GTPV1-U/nw-gtpv1u/shared/NwGtpv1u.h
+++ b/openair-cn/GTPV1-U/nw-gtpv1u/shared/NwGtpv1u.h
@@ -80,7 +80,7 @@ typedef NwPtrT NwGtpv1uTimerHandleT; /**< Gtpv2 Stack Timer
typedef NwPtrT NwGtpv1uMsgHandleT; /**< Gtpv2 Msg Handle */
typedef struct NwGtpv1uStackConfig {
- NwU16T udpSrcPort;
+ uint16_t udpSrcPort;
} NwGtpv1uStackConfigT;
/*--------------------------------------------------------------------------*
@@ -121,7 +121,7 @@ typedef enum {
*--------------------------------------------------------------------------*/
typedef NwPtrT NwGtpv1uStackSessionHandleT;/**< Gtpv2 Stack session Handle */
-typedef NwU8T NwGtpv1uMsgTypeT; /**< Gtpv2 Msg Type */
+typedef uint8_t NwGtpv1uMsgTypeT; /**< Gtpv2 Msg Type */
typedef NwPtrT NwGtpv1uTrxnHandleT; /**< Gtpv2 Transaction Handle */
typedef NwPtrT NwGtpv1uUlpTrxnHandleT; /**< Gtpv2 Ulp Transaction Handle */
typedef NwPtrT NwGtpv1uUlpSessionHandleT; /**< Gtpv2 Ulp session Handle */
@@ -132,7 +132,7 @@ typedef NwPtrT NwGtpv1uUlpSessionHandleT; /**< Gtpv2 Ulp session Handle */
*/
typedef struct {
- NW_IN NwU32T teid;
+ NW_IN uint32_t teid;
NW_IN NwGtpv1uUlpSessionHandleT hUlpSession;
NW_OUT NwGtpv1uStackSessionHandleT hStackSession;
} NwGtpv1uCreateTunnelEndPointT;
@@ -153,10 +153,10 @@ typedef struct {
typedef struct {
NW_IN NwGtpv1uUlpTrxnHandleT hUlpTrxn;
- NW_IN NwU32T peerIp;
- NW_IN NwU32T peerPort;
- NW_IN NwU8T flags;
- NW_IN NwU32T teid;
+ NW_IN uint32_t peerIp;
+ NW_IN uint32_t peerPort;
+ NW_IN uint8_t flags;
+ NW_IN uint32_t teid;
} NwGtpv1uInitialReqInfoT;
/**
@@ -166,11 +166,11 @@ typedef struct {
typedef struct {
NW_IN NwGtpv1uUlpTrxnHandleT hUlpTrxn;
- NW_IN NwU32T peerIp;
- NW_IN NwU32T peerPort;
- NW_IN NwU8T flags;
- NW_IN NwU32T teid;
- NW_IN NwU32T seqNum;
+ NW_IN uint32_t peerIp;
+ NW_IN uint32_t peerPort;
+ NW_IN uint8_t flags;
+ NW_IN uint32_t teid;
+ NW_IN uint32_t seqNum;
NW_IN NwGtpv1uMsgHandleT hMsg;
} NwGtpv1uTriggeredRspInfoT;
@@ -181,11 +181,11 @@ typedef struct {
typedef struct {
NW_IN NwGtpv1uUlpTrxnHandleT hUlpTrxn;
- NW_IN NwU32T peerIp;
- NW_IN NwU32T peerPort;
- NW_IN NwU8T flags;
- NW_IN NwU32T teid;
- NW_IN NwU32T seqNum;
+ NW_IN uint32_t peerIp;
+ NW_IN uint32_t peerPort;
+ NW_IN uint8_t flags;
+ NW_IN uint32_t teid;
+ NW_IN uint32_t seqNum;
NW_IN NwGtpv1uMsgHandleT hMsg;
} NwGtpv1uTriggeredReqInfoT;
@@ -196,9 +196,9 @@ typedef struct {
*/
typedef struct {
- NW_IN NwU32T teid;
- NW_IN NwU32T ipAddr;
- NW_IN NwU8T flags;
+ NW_IN uint32_t teid;
+ NW_IN uint32_t ipAddr;
+ NW_IN uint8_t flags;
NW_IN NwGtpv1uMsgHandleT hMsg;
} NwGtpv1uSendtoInfoT;
@@ -213,7 +213,7 @@ typedef struct {
NW_INOUT NwGtpv1uTrxnHandleT hTrxn;
NW_IN NwGtpv1uUlpTrxnHandleT hUlpTrxn;
NW_IN NwGtpv1uMsgTypeT msgType;
- NW_IN NwU8T flags;
+ NW_IN uint8_t flags;
NW_IN NwGtpv1uMsgHandleT hMsg;
} NwGtpv1uSendMsgInfoT;
@@ -225,10 +225,10 @@ typedef struct {
typedef struct {
NW_IN NwGtpv1uUlpSessionHandleT hUlpSession;
NW_IN NwGtpv1uUlpTrxnHandleT hUlpTrxn;
- NW_IN NwU32T teid;
- NW_IN NwU32T peerIp;
- NW_IN NwU32T peerPort;
- NW_IN NwU32T msgType; /**< Message type */
+ NW_IN uint32_t teid;
+ NW_IN uint32_t peerIp;
+ NW_IN uint32_t peerPort;
+ NW_IN uint32_t msgType; /**< Message type */
NW_IN NwGtpv1uMsgHandleT hMsg; /**< Gtp Message handle */
} NwGtpv1uRecvMsgInfoT;
@@ -297,11 +297,11 @@ typedef struct {
typedef struct {
NwGtpv1uUdpHandleT hUdp;
NwGtpv1uRcT (*udpDataReqCallback) ( NW_IN NwGtpv1uUdpHandleT udpHandle,
- NW_IN NwU8T* dataBuf,
- NW_IN NwU32T dataSize,
- NW_IN NwU32T dataOffset,
- NW_IN NwU32T peerIP,
- NW_IN NwU16T peerPort);
+ NW_IN uint8_t* dataBuf,
+ NW_IN uint32_t dataSize,
+ NW_IN uint32_t dataOffset,
+ NW_IN uint32_t peerIP,
+ NW_IN uint16_t peerPort);
} NwGtpv1uUdpEntityT;
/**
@@ -311,14 +311,14 @@ typedef struct {
typedef struct {
NwGtpv1uMemMgrHandleT hMemMgr;
void* (*memAlloc)( NW_IN NwGtpv1uMemMgrHandleT hMemMgr,
- NW_IN NwU32T memSize,
+ NW_IN uint32_t memSize,
NW_IN NwCharT* fileName,
- NW_IN NwU32T lineNumber);
+ NW_IN uint32_t lineNumber);
void (*memFree) ( NW_IN NwGtpv1uMemMgrHandleT hMemMgr,
NW_IN void* hMem,
NW_IN NwCharT* fileName,
- NW_IN NwU32T lineNumber);
+ NW_IN uint32_t lineNumber);
} NwGtpv1uMemMgrEntityT;
@@ -336,9 +336,9 @@ typedef struct {
typedef struct {
NwGtpv1uTimerMgrHandleT tmrMgrHandle;
NwGtpv1uRcT (*tmrStartCallback)( NW_IN NwGtpv1uTimerMgrHandleT tmrMgrHandle,
- NW_IN NwU32T timeoutSecs,
- NW_IN NwU32T timeoutUsec,
- NW_IN NwU32T tmrType,
+ NW_IN uint32_t timeoutSecs,
+ NW_IN uint32_t timeoutUsec,
+ NW_IN uint32_t tmrType,
NW_IN void* tmrArg,
NW_OUT NwGtpv1uTimerHandleT* tmrHandle);
@@ -358,9 +358,9 @@ typedef struct {
typedef struct {
NwGtpv1uLogMgrHandleT logMgrHandle;
NwGtpv1uRcT (*logReqCallback) (NW_IN NwGtpv1uLogMgrHandleT logMgrHandle,
- NW_IN NwU32T logLevel,
+ NW_IN uint32_t logLevel,
NW_IN NwCharT* file,
- NW_IN NwU32T line,
+ NW_IN uint32_t line,
NW_IN NwCharT* logStr);
} NwGtpv1uLogMgrEntityT;
@@ -385,7 +385,7 @@ extern "C" {
*/
NwGtpv1uRcT
-nwGtpv1uInitialize( NW_INOUT NwGtpv1uStackHandleT* phGtpv1uStackHandle, NwU32T stackType);
+nwGtpv1uInitialize( NW_INOUT NwGtpv1uStackHandleT* phGtpv1uStackHandle, uint32_t stackType);
/*---------------------------------------------------------------------------
* Destructor
@@ -493,7 +493,7 @@ nwGtpv1uSetLogMgrEntity( NW_IN NwGtpv1uStackHandleT hGtpv1uStackHandle,
NwGtpv1uRcT
nwGtpv1uSetLogLevel( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
- NW_IN NwU32T logLevel);
+ NW_IN uint32_t logLevel);
/*---------------------------------------------------------------------------
* Process Request from Udp Layer
*--------------------------------------------------------------------------*/
@@ -511,10 +511,10 @@ nwGtpv1uSetLogLevel( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
NwGtpv1uRcT
nwGtpv1uProcessUdpReq( NW_IN NwGtpv1uStackHandleT hGtpv1uStackHandle,
- NW_IN NwU8T* udpData,
- NW_IN NwU32T udpDataLen,
- NW_IN NwU16T peerPort,
- NW_IN NwU32T peerIP);
+ NW_IN uint8_t* udpData,
+ NW_IN uint32_t udpDataLen,
+ NW_IN uint16_t peerPort,
+ NW_IN uint32_t peerIP);
/*---------------------------------------------------------------------------
* Process Request from Upper Layer
diff --git a/openair-cn/GTPV1-U/nw-gtpv1u/shared/NwGtpv1uMsg.h b/openair-cn/GTPV1-U/nw-gtpv1u/shared/NwGtpv1uMsg.h
index a105736f58..f6bc0415f2 100644
--- a/openair-cn/GTPV1-U/nw-gtpv1u/shared/NwGtpv1uMsg.h
+++ b/openair-cn/GTPV1-U/nw-gtpv1u/shared/NwGtpv1uMsg.h
@@ -53,23 +53,23 @@ extern "C" {
#pragma pack(1)
typedef struct NwGtpv1uIeTv1 {
- NwU8T t;
- NwU8T v;
+ uint8_t t;
+ uint8_t v;
} NwGtpv1uIeTv1T;
typedef struct NwGtpv1uIeTv2 {
- NwU8T t;
- NwU8T v;
+ uint8_t t;
+ uint8_t v;
} NwGtpv1uIeTv2T;
typedef struct NwGtpv1uIeTv4 {
- NwU8T t;
- NwU32T v;
+ uint8_t t;
+ uint32_t v;
} NwGtpv1uIeTv4T;
typedef struct NwGtpv1uIeTlv {
- NwU8T t;
- NwU16T l;
+ uint8_t t;
+ uint16_t l;
} NwGtpv1uIeTlvT;
#pragma pack()
@@ -87,14 +87,14 @@ typedef struct NwGtpv1uIeTlv {
NwGtpv1uRcT
nwGtpv1uMsgNew( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
- NW_IN NwU8T seqNumFlag,
- NW_IN NwU8T npduNumFlag,
- NW_IN NwU8T extHdrFlag,
- NW_IN NwU8T msgType,
- NW_IN NwU8T teid,
- NW_IN NwU16T seqNum,
- NW_IN NwU8T npduNum,
- NW_IN NwU8T nextExtHeader,
+ NW_IN uint8_t seqNumFlag,
+ NW_IN uint8_t npduNumFlag,
+ NW_IN uint8_t extHdrFlag,
+ NW_IN uint8_t msgType,
+ NW_IN uint8_t teid,
+ NW_IN uint16_t seqNum,
+ NW_IN uint8_t npduNum,
+ NW_IN uint8_t nextExtHeader,
NW_OUT NwGtpv1uMsgHandleT *phMsg);
@@ -112,12 +112,12 @@ nwGtpv1uMsgNew( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
NwGtpv1uRcT
nwGtpv1uGpduMsgNew( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
- NW_IN NwU32T teid,
- NW_IN NwU8T seqNumFlag,
- NW_IN NwU16T seqNum,
- NW_IN NwU8T* tpdu,
- NW_IN NwU16T tpduLength,
- NW_IN NwU32T tpduOffset,
+ NW_IN uint32_t teid,
+ NW_IN uint8_t seqNumFlag,
+ NW_IN uint16_t seqNum,
+ NW_IN uint8_t* tpdu,
+ NW_IN uint16_t tpduLength,
+ NW_IN uint32_t tpduOffset,
NW_OUT NwGtpv1uMsgHandleT *phMsg);
/**
@@ -143,8 +143,8 @@ nwGtpv1uMsgFromMsgNew( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
NwGtpv1uRcT
nwGtpv1uMsgFromBufferNew( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
- NW_IN NwU8T* pBuf,
- NW_IN NwU32T bufLen,
+ NW_IN uint8_t* pBuf,
+ NW_IN uint32_t bufLen,
NW_OUT NwGtpv1uMsgHandleT *phMsg);
/**
@@ -166,7 +166,7 @@ nwGtpv1uMsgDelete( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
*/
NwGtpv1uRcT
-nwGtpv1uMsgSetTeid(NW_IN NwGtpv1uMsgHandleT hMsg, NwU32T teid);
+nwGtpv1uMsgSetTeid(NW_IN NwGtpv1uMsgHandleT hMsg, uint32_t teid);
/**
* Set TEID present flag for gtpv1u message.
@@ -186,7 +186,7 @@ nwGtpv1uMsgSetTeidPresent(NW_IN NwGtpv1uMsgHandleT hMsg, NwBoolT teidPresent);
*/
NwGtpv1uRcT
-nwGtpv1uMsgSetSeqNumber(NW_IN NwGtpv1uMsgHandleT hMsg, NwU32T seqNum);
+nwGtpv1uMsgSetSeqNumber(NW_IN NwGtpv1uMsgHandleT hMsg, uint32_t seqNum);
/**
* Get TEID present for gtpv1u message.
@@ -194,7 +194,7 @@ nwGtpv1uMsgSetSeqNumber(NW_IN NwGtpv1uMsgHandleT hMsg, NwU32T seqNum);
* @param[in] hMsg : Message handle.
*/
-NwU32T
+uint32_t
nwGtpv1uMsgGetTeid(NW_IN NwGtpv1uMsgHandleT hMsg);
/**
@@ -212,7 +212,7 @@ nwGtpv1uMsgGetTeidPresent(NW_IN NwGtpv1uMsgHandleT hMsg);
* @param[in] hMsg : Message handle.
*/
-NwU32T
+uint32_t
nwGtpv1uMsgGetSeqNumber(NW_IN NwGtpv1uMsgHandleT hMsg);
/**
@@ -223,13 +223,13 @@ nwGtpv1uMsgGetSeqNumber(NW_IN NwGtpv1uMsgHandleT hMsg);
* @param[out] hMsg : T-PDU length.
*/
-NwU32T
-nwGtpv1uMsgGetTpdu(NW_IN NwGtpv1uMsgHandleT hMsg, NwU8T* pTpduBuf, NwU32T* pTpduLength);
+uint32_t
+nwGtpv1uMsgGetTpdu(NW_IN NwGtpv1uMsgHandleT hMsg, uint8_t* pTpduBuf, uint32_t* pTpduLength);
-NwU8T*
+uint8_t*
nwGtpv1uMsgGetTpduHandle(NW_IN NwGtpv1uMsgHandleT hMsg);
-NwU32T
+uint32_t
nwGtpv1uMsgGetTpduLength(NW_IN NwGtpv1uMsgHandleT hMsg);
/**
@@ -242,8 +242,8 @@ nwGtpv1uMsgGetTpduLength(NW_IN NwGtpv1uMsgHandleT hMsg);
NwGtpv1uRcT
nwGtpv1uMsgAddIeTV1(NW_IN NwGtpv1uMsgHandleT hMsg,
- NW_IN NwU8T type,
- NW_IN NwU8T value);
+ NW_IN uint8_t type,
+ NW_IN uint8_t value);
/**
@@ -256,9 +256,9 @@ nwGtpv1uMsgAddIeTV1(NW_IN NwGtpv1uMsgHandleT hMsg,
NwGtpv1uRcT
nwGtpv1uMsgAddIeTV2(NW_IN NwGtpv1uMsgHandleT hMsg,
- NW_IN NwU8T type,
- NW_IN NwU16T length,
- NW_IN NwU16T value);
+ NW_IN uint8_t type,
+ NW_IN uint16_t length,
+ NW_IN uint16_t value);
/**
@@ -271,9 +271,9 @@ nwGtpv1uMsgAddIeTV2(NW_IN NwGtpv1uMsgHandleT hMsg,
NwGtpv1uRcT
nwGtpv1uMsgAddIeTV4(NW_IN NwGtpv1uMsgHandleT hMsg,
- NW_IN NwU8T type,
- NW_IN NwU16T length,
- NW_IN NwU32T value);
+ NW_IN uint8_t type,
+ NW_IN uint16_t length,
+ NW_IN uint32_t value);
/**
@@ -287,9 +287,9 @@ nwGtpv1uMsgAddIeTV4(NW_IN NwGtpv1uMsgHandleT hMsg,
NwGtpv1uRcT
nwGtpv1uMsgAddIe(NW_IN NwGtpv1uMsgHandleT hMsg,
- NW_IN NwU8T type,
- NW_IN NwU16T length,
- NW_IN NwU8T* pVal);
+ NW_IN uint8_t type,
+ NW_IN uint16_t length,
+ NW_IN uint8_t* pVal);
/**
* Dump the contents of gtpv1u mesasge.
@@ -301,7 +301,7 @@ nwGtpv1uMsgAddIe(NW_IN NwGtpv1uMsgHandleT hMsg,
NwGtpv1uRcT
nwGtpv1uMsgHexDump(NwGtpv1uMsgHandleT hMsg, FILE* fp);
-NwU32T
+uint32_t
nwGtpv1uMsgGetMsgType(NW_IN NwGtpv1uMsgHandleT hMsg);
#ifdef __cplusplus
diff --git a/openair-cn/GTPV1-U/nw-gtpv1u/shared/NwLog.h b/openair-cn/GTPV1-U/nw-gtpv1u/shared/NwLog.h
index 7c19d66bad..7215216e68 100644
--- a/openair-cn/GTPV1-U/nw-gtpv1u/shared/NwLog.h
+++ b/openair-cn/GTPV1-U/nw-gtpv1u/shared/NwLog.h
@@ -68,15 +68,15 @@ extern "C" {
* IPv4 logging macros
*--------------------------------------------------------------------------*/
#define NW_IPV4_ADDR "%u.%u.%u.%u"
-#define NW_IPV4_ADDR_FORMAT(__addr) (NwU8T)((__addr) & 0x000000ff), \
- (NwU8T)(((__addr) & 0x0000ff00) >> 8 ), \
- (NwU8T)(((__addr) & 0x00ff0000) >> 16), \
- (NwU8T)(((__addr) & 0xff000000) >> 24)
+#define NW_IPV4_ADDR_FORMAT(__addr) (uint8_t)((__addr) & 0x000000ff), \
+ (uint8_t)(((__addr) & 0x0000ff00) >> 8 ), \
+ (uint8_t)(((__addr) & 0x00ff0000) >> 16), \
+ (uint8_t)(((__addr) & 0xff000000) >> 24)
-#define NW_IPV4_ADDR_FORMATP(__paddr) (NwU8T)(*((NwU8T*)(__paddr)) & 0x000000ff), \
- (NwU8T)(*((NwU8T*)(__paddr + 1)) & 0x000000ff), \
- (NwU8T)(*((NwU8T*)(__paddr + 2)) & 0x000000ff), \
- (NwU8T)(*((NwU8T*)(__paddr + 3)) & 0x000000ff)
+#define NW_IPV4_ADDR_FORMATP(__paddr) (uint8_t)(*((uint8_t*)(__paddr)) & 0x000000ff), \
+ (uint8_t)(*((uint8_t*)(__paddr + 1)) & 0x000000ff), \
+ (uint8_t)(*((uint8_t*)(__paddr + 2)) & 0x000000ff), \
+ (uint8_t)(*((uint8_t*)(__paddr + 3)) & 0x000000ff)
#ifdef __cplusplus
diff --git a/openair-cn/GTPV1-U/nw-gtpv1u/shared/NwTypes.h b/openair-cn/GTPV1-U/nw-gtpv1u/shared/NwTypes.h
index c4cb2156fb..aae5c8a95b 100644
--- a/openair-cn/GTPV1-U/nw-gtpv1u/shared/NwTypes.h
+++ b/openair-cn/GTPV1-U/nw-gtpv1u/shared/NwTypes.h
@@ -54,11 +54,6 @@ extern "C" {
#define NW_TRUE (1) /**< Truth value */
#define NW_FALSE (0) /**< False value */
-typedef unsigned char NwU8T; /**< Unsigned 1 byte */
-typedef unsigned short NwU16T; /**< Unsigned 2 byte */
-typedef unsigned int NwU32T; /**< Unsigned 4 byte */
-typedef unsigned long long NwU64T; /**< Unsigned 8 byte */
-
typedef signed char NwS8T; /**< Signed 1 byte */
typedef signed short NwS16T; /**< Signed 2 byte */
typedef signed int NwS32T; /**< Signed 4 byte */
diff --git a/openair-cn/GTPV1-U/nw-gtpv1u/shared/NwUtils.h b/openair-cn/GTPV1-U/nw-gtpv1u/shared/NwUtils.h
index c29b0a550a..c197ab323e 100644
--- a/openair-cn/GTPV1-U/nw-gtpv1u/shared/NwUtils.h
+++ b/openair-cn/GTPV1-U/nw-gtpv1u/shared/NwUtils.h
@@ -52,10 +52,10 @@
( ( (x) & 0x0000ff00 ) << 8 ) | ( ( (x) & 0x000000ff) << 24 ) )
#define NW_HTONLL(x) ( \
- ( ( ((NwU64T)x) & 0xff00000000000000ULL ) >> 56 ) | ( ( ((NwU64T)x) & 0x00ff000000000000ULL ) >> 40 ) | \
- ( ( ((NwU64T)x) & 0x0000ff0000000000ULL ) >> 24 ) | ( ( ((NwU64T)x) & 0x000000ff00000000ULL ) >> 8 ) | \
- ( ( ((NwU64T)x) & 0x000000000000ff00ULL ) << 40 ) | ( ( ((NwU64T)x) & 0x00000000000000ffULL ) << 56 ) | \
- ( ( ((NwU64T)x) & 0x0000000000ff0000ULL ) << 24 ) | ( ( ((NwU64T)x) & 0x00000000ff000000ULL ) << 8 ) \
+ ( ( ((uint64_t)x) & 0xff00000000000000ULL ) >> 56 ) | ( ( ((uint64_t)x) & 0x00ff000000000000ULL ) >> 40 ) | \
+ ( ( ((uint64_t)x) & 0x0000ff0000000000ULL ) >> 24 ) | ( ( ((uint64_t)x) & 0x000000ff00000000ULL ) >> 8 ) | \
+ ( ( ((uint64_t)x) & 0x000000000000ff00ULL ) << 40 ) | ( ( ((uint64_t)x) & 0x00000000000000ffULL ) << 56 ) | \
+ ( ( ((uint64_t)x) & 0x0000000000ff0000ULL ) << 24 ) | ( ( ((uint64_t)x) & 0x00000000ff000000ULL ) << 8 ) \
)
#define NW_NTOHS NW_HTONS
diff --git a/openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1u.c b/openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1u.c
index 30008207b3..5308c0c86c 100644
--- a/openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1u.c
+++ b/openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1u.c
@@ -196,11 +196,11 @@ nwGtpv1uCompareSeqNum(struct NwGtpv1uTrxn *a, struct NwGtpv1uTrxn *b)
*/
static NwGtpv1uRcT
-nwGtpv1uCreateAndSendMsg( NwGtpv1uStackT *thiz, NwU32T peerIp, NwU16T peerPort,
+nwGtpv1uCreateAndSendMsg( NwGtpv1uStackT *thiz, uint32_t peerIp, uint16_t peerPort,
NwGtpv1uMsgT *pMsg)
{
NwGtpv1uRcT rc = NW_GTPV1U_FAILURE;
- NwU8T *msgHdr;
+ uint8_t *msgHdr;
NW_ASSERT(thiz);
NW_ASSERT(pMsg);
@@ -219,10 +219,10 @@ nwGtpv1uCreateAndSendMsg( NwGtpv1uStackT *thiz, NwU32T peerIp, NwU16T peerPort,
(pMsg->npduNumFlag);
*(msgHdr++) = (pMsg->msgType);
- *((NwU16T *) msgHdr) = htons(pMsg->msgLen);
+ *((uint16_t *) msgHdr) = htons(pMsg->msgLen);
msgHdr += 2;
- *((NwU32T *) msgHdr) = htonl(pMsg->teid);
+ *((uint32_t *) msgHdr) = htonl(pMsg->teid);
msgHdr += 4;
#if defined(LOG_GTPU) && LOG_GTPU > 0
GTPU_DEBUG("nwGtpv1uCreateAndSendMsg to teid %u length %d offset %d\n",
@@ -232,13 +232,13 @@ nwGtpv1uCreateAndSendMsg( NwGtpv1uStackT *thiz, NwU32T peerIp, NwU16T peerPort,
#endif
if(pMsg->seqNumFlag || pMsg->extHdrFlag || pMsg->npduNumFlag) {
- *((NwU16T *) msgHdr) = (pMsg->seqNumFlag ? htons(pMsg->seqNum) : 0x0000);
+ *((uint16_t *) msgHdr) = (pMsg->seqNumFlag ? htons(pMsg->seqNum) : 0x0000);
msgHdr += 2;
- *((NwU8T *) msgHdr) = (pMsg->npduNumFlag ? htons(pMsg->npduNum) : 0x00);
+ *((uint8_t *) msgHdr) = (pMsg->npduNumFlag ? htons(pMsg->npduNum) : 0x00);
msgHdr++;
- *((NwU8T *) msgHdr) = (pMsg->extHdrFlag ? htons(pMsg->nextExtHdrType) : 0x00);
+ *((uint8_t *) msgHdr) = (pMsg->extHdrFlag ? htons(pMsg->nextExtHdrType) : 0x00);
msgHdr++;
}
@@ -264,13 +264,13 @@ nwGtpv1uCreateAndSendMsg( NwGtpv1uStackT *thiz, NwU32T peerIp, NwU16T peerPort,
static NwGtpv1uRcT
nwGtpv1uSendUlpMessageIndication( NW_IN NwGtpv1uStackT *thiz,
- NW_IN NwU32T hUlpTrxn,
- NW_IN NwU32T apiType,
- NW_IN NwU32T msgType,
- NW_IN NwU32T peerIp,
- NW_IN NwU16T peerPort,
- NW_IN NwU8T *pMsgBuf,
- NW_IN NwU16T msgLength)
+ NW_IN uint32_t hUlpTrxn,
+ NW_IN uint32_t apiType,
+ NW_IN uint32_t msgType,
+ NW_IN uint32_t peerIp,
+ NW_IN uint16_t peerPort,
+ NW_IN uint8_t *pMsgBuf,
+ NW_IN uint16_t msgLength)
{
NwGtpv1uRcT rc = NW_GTPV1U_FAILURE;
NwGtpv1uUlpApiT ulpApi;
@@ -344,7 +344,7 @@ nwGtpv1uPeerRspTimeout(void *arg)
static NwGtpv1uRcT
NwGtpv1uCreateTunnelEndPoint( NW_IN NwGtpv1uStackT *thiz,
- NW_IN NwU32T teid,
+ NW_IN uint32_t teid,
NW_IN NwGtpv1uUlpSessionHandleT hUlpSession,
NW_OUT NwGtpv1uStackSessionHandleT *phStackSession )
{
@@ -515,16 +515,16 @@ nwGtpv1uSendto( NwGtpv1uStackT *thiz, NW_IN NwGtpv1uUlpApiT *pUlpReq)
static NwGtpv1uRcT
nwGtpv1uProcessGpdu( NwGtpv1uStackT *thiz,
- NW_IN NwU8T *gpdu,
- NW_IN NwU32T gpduLen,
- NW_IN NwU32T peerIp)
+ NW_IN uint8_t *gpdu,
+ NW_IN uint32_t gpduLen,
+ NW_IN uint32_t peerIp)
{
NwGtpv1uRcT rc = NW_GTPV1U_FAILURE;
NwGtpv1uMsgHeaderT *msgHdr = NULL;
NwGtpv1uTunnelEndPointT *pTunnelEndPoint = NULL;
NwGtpv1uTunnelEndPointT tunnelEndPointKey;
- // NwU16T hdr_len = 0;
+ // uint16_t hdr_len = 0;
#if defined(LOG_GTPU) && LOG_GTPU > 0
NW_ENTER(thiz);
@@ -542,14 +542,14 @@ nwGtpv1uProcessGpdu( NwGtpv1uStackT *thiz,
NwGtpv1uMsgHandleT hMsg;
rc = nwGtpv1uMsgFromBufferNew( (NwGtpv1uStackHandleT)thiz,
- (NwU8T *)gpdu,
+ (uint8_t *)gpdu,
gpduLen,
&hMsg);
/*
- NwU8T* msgBuf;
- NwU32T msgBufLen;
- NwU32T msgBufOffset;
+ uint8_t* msgBuf;
+ uint32_t msgBufLen;
+ uint32_t msgBufOffset;
*/
if(NW_GTPV1U_OK == rc) {
NwGtpv1uMsgT *pMsg = (NwGtpv1uMsgT *) hMsg;
@@ -596,17 +596,17 @@ nwGtpv1uProcessGpdu( NwGtpv1uStackT *thiz,
static NwGtpv1uRcT
nwGtpv1uHandleEchoReq(NW_IN NwGtpv1uStackT *thiz,
- NW_IN NwU8T *msgBuf,
- NW_IN NwU32T msgBufLen,
- NW_IN NwU16T peerPort,
- NW_IN NwU32T peerIp)
+ NW_IN uint8_t *msgBuf,
+ NW_IN uint32_t msgBufLen,
+ NW_IN uint16_t peerPort,
+ NW_IN uint32_t peerIp)
{
NwGtpv1uRcT rc = NW_GTPV1U_FAILURE;
- NwU16T seqNum = 0;
+ uint16_t seqNum = 0;
NwGtpv1uMsgHandleT hMsg = 0;
int bufLen = 0;
- seqNum = ntohs(*(NwU16T *) (msgBuf + (((*msgBuf) & 0x02) ? 8 : 4)));
+ seqNum = ntohs(*(uint16_t *) (msgBuf + (((*msgBuf) & 0x02) ? 8 : 4)));
MSC_LOG_RX_MESSAGE(
(thiz->stackType == GTPU_STACK_ENB) ? MSC_GTPU_ENB:MSC_GTPU_SGW,
@@ -630,10 +630,15 @@ nwGtpv1uHandleEchoReq(NW_IN NwGtpv1uStackT *thiz,
bufLen = sizeof(NwGtpv1uIeTv1T)+ ((NwGtpv1uMsgT*)hMsg)->msgLen;
+#warning CROUX DIRTY +16, TO BE FIXED!!!
+ /* the +16 is there because by analyzing memory allocation with some external
+ * tool, I saw that there were 6 bytes accessed after bufLen in nwGtpv1uCreateAndSendMsg
+ * the value "16" has been chosen arbitrarily, just bigger than 6
+ */
((NwGtpv1uMsgT*)hMsg)->msgBuf = itti_malloc(
TASK_GTPV1_U,
TASK_UDP,
- bufLen);
+ bufLen + 16 /* CROUX - dirty +16, to be fixed! */);
((NwGtpv1uMsgT*)hMsg)->msgBufLen = bufLen;
NW_ASSERT(NW_GTPV1U_OK == rc);
@@ -678,7 +683,7 @@ nwGtpv1uHandleEchoReq(NW_IN NwGtpv1uStackT *thiz,
*--------------------------------------------------------------------------*/
NwGtpv1uRcT
-nwGtpv1uInitialize( NW_INOUT NwGtpv1uStackHandleT *hGtpuStackHandle, NwU32T stackType)
+nwGtpv1uInitialize( NW_INOUT NwGtpv1uStackHandleT *hGtpuStackHandle, uint32_t stackType)
{
NwGtpv1uRcT rc = NW_GTPV1U_FAILURE;
NwGtpv1uStackT *thiz;
@@ -689,7 +694,7 @@ nwGtpv1uInitialize( NW_INOUT NwGtpv1uStackHandleT *hGtpuStackHandle, NwU32T stac
if(thiz) {
thiz->id = (NwPtrT)thiz;
thiz->stackType = stackType;
- thiz->seq = (NwU16T) ((NwU32T)thiz) ; // FIXME interesting casts... don't know what this is good for...
+ thiz->seq = (uint16_t) ((uint32_t)thiz) ; // FIXME interesting casts... don't know what this is good for...
RB_INIT(&(thiz->outstandingTxSeqNumMap));
RB_INIT(&(thiz->outstandingRxSeqNumMap));
RB_INIT(&(thiz->sessionMap));
@@ -824,7 +829,7 @@ nwGtpv1uSetLogMgrEntity( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
NwGtpv1uRcT
nwGtpv1uSetLogLevel( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
- NW_IN NwU32T logLevel)
+ NW_IN uint32_t logLevel)
{
NwGtpv1uStackT *thiz = (NwGtpv1uStackT *) hGtpuStackHandle;
thiz->logLevel = logLevel;
@@ -837,14 +842,14 @@ nwGtpv1uSetLogLevel( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
NwGtpv1uRcT
nwGtpv1uProcessUdpReq( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
- NW_IN NwU8T *udpData,
- NW_IN NwU32T udpDataLen,
- NW_IN NwU16T peerPort,
- NW_IN NwU32T peerIp)
+ NW_IN uint8_t *udpData,
+ NW_IN uint32_t udpDataLen,
+ NW_IN uint16_t peerPort,
+ NW_IN uint32_t peerIp)
{
NwGtpv1uRcT ret = NW_GTPV1U_FAILURE;
NwGtpv1uStackT *thiz;
- NwU16T msgType;
+ uint16_t msgType;
#if defined(ENB_MODE)
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GTPV1U_PROCESS_UDP_REQ, VCD_FUNCTION_IN);
@@ -853,7 +858,7 @@ nwGtpv1uProcessUdpReq( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
NW_ASSERT(thiz);
- msgType = *((NwU8T *)(udpData + 1));
+ msgType = *((uint8_t *)(udpData + 1));
switch(msgType) {
case NW_GTP_ECHO_REQ:
diff --git a/openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1uMsg.c b/openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1uMsg.c
index ce3a8ae1ba..fe1c509fef 100644
--- a/openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1uMsg.c
+++ b/openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1uMsg.c
@@ -60,14 +60,14 @@ static NwGtpv1uMsgT *gpGtpv1uMsgPool = NULL;
NwGtpv1uRcT
nwGtpv1uMsgNew( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
- NW_IN NwU8T seqNumFlag,
- NW_IN NwU8T npduNumFlag,
- NW_IN NwU8T extHdrFlag,
- NW_IN NwU8T msgType,
- NW_IN NwU8T teid,
- NW_IN NwU16T seqNum,
- NW_IN NwU8T npduNum,
- NW_IN NwU8T nextExtHeader,
+ NW_IN uint8_t seqNumFlag,
+ NW_IN uint8_t npduNumFlag,
+ NW_IN uint8_t extHdrFlag,
+ NW_IN uint8_t msgType,
+ NW_IN uint8_t teid,
+ NW_IN uint16_t seqNum,
+ NW_IN uint8_t npduNum,
+ NW_IN uint8_t nextExtHeader,
NW_OUT NwGtpv1uMsgHandleT *phMsg)
{
NwGtpv1uStackT *pStack = (NwGtpv1uStackT *) hGtpuStackHandle;
@@ -118,18 +118,18 @@ nwGtpv1uMsgNew( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
NwGtpv1uRcT
nwGtpv1uGpduMsgNew( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
- NW_IN NwU32T teid,
- NW_IN NwU8T seqNumFlag,
- NW_IN NwU16T seqNum,
- NW_IN NwU8T *tpdu,
- NW_IN NwU16T tpduLength,
- NW_IN NwU32T tpduOffset,
+ NW_IN uint32_t teid,
+ NW_IN uint8_t seqNumFlag,
+ NW_IN uint16_t seqNum,
+ NW_IN uint8_t *tpdu,
+ NW_IN uint16_t tpduLength,
+ NW_IN uint32_t tpduOffset,
NW_OUT NwGtpv1uMsgHandleT *phMsg)
{
NwGtpv1uStackT *pStack = (NwGtpv1uStackT *) hGtpuStackHandle;
NwGtpv1uMsgT *pMsg;
- //NwU32T header_len = 0;
- NwU32T msgExtraLen = 0;
+ //uint32_t header_len = 0;
+ uint32_t msgExtraLen = 0;
if(gpGtpv1uMsgPool) {
pMsg = gpGtpv1uMsgPool;
@@ -237,8 +237,8 @@ nwGtpv1uMsgFromMsgNew( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
NwGtpv1uRcT
nwGtpv1uMsgFromBufferNew( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
- NW_IN NwU8T *pBuf,
- NW_IN NwU32T bufLen,
+ NW_IN uint8_t *pBuf,
+ NW_IN uint32_t bufLen,
NW_OUT NwGtpv1uMsgHandleT *phMsg)
{
NwGtpv1uStackT *pStack = (NwGtpv1uStackT *) hGtpuStackHandle;
@@ -267,17 +267,17 @@ nwGtpv1uMsgFromBufferNew( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
pBuf += 2;
- pMsg->teid = ntohl(*((NwU32T *)pBuf));
+ pMsg->teid = ntohl(*((uint32_t *)pBuf));
pBuf += 4;
if(pMsg->extHdrFlag || pMsg->seqNumFlag || pMsg->npduNumFlag) {
- pMsg->seqNum = ntohs(*(((NwU16T *)pBuf)));
+ pMsg->seqNum = ntohs(*(((uint16_t *)pBuf)));
pBuf += 2;
pMsg->npduNum = *(pBuf++);
pMsg->nextExtHdrType = *(pBuf++);
}
- pMsg->msgBufOffset = (NwU32T)(pBuf - pMsg->msgBuf);
+ pMsg->msgBufOffset = (uint32_t)(pBuf - pMsg->msgBuf);
pMsg->msgBufLen = bufLen - pMsg->msgBufOffset;
pMsg->msgLen = bufLen;
#if defined(LOG_GTPU) && LOG_GTPU > 0
@@ -308,7 +308,7 @@ nwGtpv1uMsgDelete( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
*/
NwGtpv1uRcT
-nwGtpv1uMsgSetTeid(NW_IN NwGtpv1uMsgHandleT hMsg, NwU32T teid)
+nwGtpv1uMsgSetTeid(NW_IN NwGtpv1uMsgHandleT hMsg, uint32_t teid)
{
NwGtpv1uMsgT *thiz = (NwGtpv1uMsgT *) hMsg;
thiz->teid = teid;
@@ -326,7 +326,7 @@ nwGtpv1uMsgSetTeid(NW_IN NwGtpv1uMsgHandleT hMsg, NwU32T teid)
*/
NwGtpv1uRcT
-nwGtpv1uMsgSetSeqNumber(NW_IN NwGtpv1uMsgHandleT hMsg, NwU32T seqNum)
+nwGtpv1uMsgSetSeqNumber(NW_IN NwGtpv1uMsgHandleT hMsg, uint32_t seqNum)
{
NwGtpv1uMsgT *thiz = (NwGtpv1uMsgT *) hMsg;
thiz->seqNum = seqNum;
@@ -339,7 +339,7 @@ nwGtpv1uMsgSetSeqNumber(NW_IN NwGtpv1uMsgHandleT hMsg, NwU32T seqNum)
* @param[in] hMsg : Message handle.
*/
-NwU32T
+uint32_t
nwGtpv1uMsgGetTeid(NW_IN NwGtpv1uMsgHandleT hMsg)
{
NwGtpv1uMsgT *thiz = (NwGtpv1uMsgT *) hMsg;
@@ -353,7 +353,7 @@ nwGtpv1uMsgGetTeid(NW_IN NwGtpv1uMsgHandleT hMsg)
* @param[in] hMsg : Message handle.
*/
-NwU32T
+uint32_t
nwGtpv1uMsgGetSeqNumber(NW_IN NwGtpv1uMsgHandleT hMsg)
{
NwGtpv1uMsgT *thiz = (NwGtpv1uMsgT *) hMsg;
@@ -366,7 +366,7 @@ nwGtpv1uMsgGetSeqNumber(NW_IN NwGtpv1uMsgHandleT hMsg)
* @param[in] hMsg : Message handle.
*/
-NwU32T
+uint32_t
nwGtpv1uMsgGetMsgType(NW_IN NwGtpv1uMsgHandleT hMsg)
{
NwGtpv1uMsgT *thiz = (NwGtpv1uMsgT *) hMsg;
@@ -380,11 +380,11 @@ nwGtpv1uMsgGetMsgType(NW_IN NwGtpv1uMsgHandleT hMsg)
*/
NwGtpv1uRcT
-nwGtpv1uMsgGetTpdu(NW_IN NwGtpv1uMsgHandleT hMsg, NwU8T *pTpduBuf,
- NwU32T *pTpduLength)
+nwGtpv1uMsgGetTpdu(NW_IN NwGtpv1uMsgHandleT hMsg, uint8_t *pTpduBuf,
+ uint32_t *pTpduLength)
{
NwGtpv1uMsgT *thiz = (NwGtpv1uMsgT *) hMsg;
- NwU8T headerLength = ((thiz->seqNumFlag || thiz->extHdrFlag
+ uint8_t headerLength = ((thiz->seqNumFlag || thiz->extHdrFlag
|| thiz->npduNumFlag) ? 12 : 8);
*pTpduLength = thiz->msgLen - headerLength;
@@ -392,7 +392,7 @@ nwGtpv1uMsgGetTpdu(NW_IN NwGtpv1uMsgHandleT hMsg, NwU8T *pTpduBuf,
return NW_GTPV1U_OK;
}
-NwU8T *
+uint8_t *
nwGtpv1uMsgGetTpduHandle(NW_IN NwGtpv1uMsgHandleT hMsg)
{
NwGtpv1uMsgT *thiz = (NwGtpv1uMsgT *) hMsg;
@@ -400,7 +400,7 @@ nwGtpv1uMsgGetTpduHandle(NW_IN NwGtpv1uMsgHandleT hMsg)
|| thiz->npduNumFlag) ? 12 : 8));
}
-NwU32T
+uint32_t
nwGtpv1uMsgGetTpduLength(NW_IN NwGtpv1uMsgHandleT hMsg)
{
NwGtpv1uMsgT *thiz = (NwGtpv1uMsgT *) hMsg;
@@ -410,8 +410,8 @@ nwGtpv1uMsgGetTpduLength(NW_IN NwGtpv1uMsgHandleT hMsg)
NwGtpv1uRcT
nwGtpv1uMsgAddIeTV1(NW_IN NwGtpv1uMsgHandleT hMsg,
- NW_IN NwU8T type,
- NW_IN NwU8T value)
+ NW_IN uint8_t type,
+ NW_IN uint8_t value)
{
NwGtpv1uMsgT *pMsg = (NwGtpv1uMsgT *) hMsg;
NwGtpv1uIeTv1T *pIe;
@@ -428,9 +428,9 @@ nwGtpv1uMsgAddIeTV1(NW_IN NwGtpv1uMsgHandleT hMsg,
NwGtpv1uRcT
nwGtpv1uMsgAddIeTV2(NW_IN NwGtpv1uMsgHandleT hMsg,
- NW_IN NwU8T type,
- NW_IN NwU16T length,
- NW_IN NwU16T value)
+ NW_IN uint8_t type,
+ NW_IN uint16_t length,
+ NW_IN uint16_t value)
{
NwGtpv1uMsgT *pMsg = (NwGtpv1uMsgT *) hMsg;
NwGtpv1uIeTv2T *pIe;
@@ -447,9 +447,9 @@ nwGtpv1uMsgAddIeTV2(NW_IN NwGtpv1uMsgHandleT hMsg,
NwGtpv1uRcT
nwGtpv1uMsgAddIeTV4(NW_IN NwGtpv1uMsgHandleT hMsg,
- NW_IN NwU8T type,
- NW_IN NwU16T length,
- NW_IN NwU32T value)
+ NW_IN uint8_t type,
+ NW_IN uint16_t length,
+ NW_IN uint32_t value)
{
NwGtpv1uMsgT *pMsg = (NwGtpv1uMsgT *) hMsg;
NwGtpv1uIeTv4T *pIe;
@@ -466,9 +466,9 @@ nwGtpv1uMsgAddIeTV4(NW_IN NwGtpv1uMsgHandleT hMsg,
NwGtpv1uRcT
nwGtpv1uMsgAddIe(NW_IN NwGtpv1uMsgHandleT hMsg,
- NW_IN NwU8T type,
- NW_IN NwU16T length,
- NW_IN NwU8T *pVal)
+ NW_IN uint8_t type,
+ NW_IN uint16_t length,
+ NW_IN uint8_t *pVal)
{
NwGtpv1uMsgT *pMsg = (NwGtpv1uMsgT *) hMsg;
NwGtpv1uIeTlvT *pIe;
@@ -489,8 +489,8 @@ nwGtpv1uMsgHexDump(NwGtpv1uMsgHandleT hMsg, FILE *fp)
{
NwGtpv1uMsgT *pMsg = (NwGtpv1uMsgT *) hMsg;
- NwU8T *data = pMsg->msgBuf;
- NwU32T size = pMsg->msgLen;
+ uint8_t *data = pMsg->msgBuf;
+ uint32_t size = pMsg->msgLen;
unsigned char *p = (unsigned char *)data;
unsigned char c;
diff --git a/openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1uTrxn.c b/openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1uTrxn.c
index 63db205e0c..27cb59050f 100644
--- a/openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1uTrxn.c
+++ b/openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1uTrxn.c
@@ -232,7 +232,7 @@ nwGtpv1uTrxnNew( NW_IN NwGtpv1uStackT *thiz,
*/
NwGtpv1uRcT
nwGtpv1uTrxnWithSeqNew( NW_IN NwGtpv1uStackT *thiz,
- NW_IN NwU32T seqNum,
+ NW_IN uint32_t seqNum,
NW_OUT NwGtpv1uTrxnT **ppTrxn)
{
NwGtpv1uRcT rc = NW_GTPV1U_OK;
@@ -313,12 +313,12 @@ nwGtpv1uTrxnDelete( NW_INOUT NwGtpv1uTrxnT **pthiz)
NwGtpv1uRcT
nwGtpv1uTrxnCreateAndSendMsg( NW_IN NwGtpv1uStackT *thiz,
NW_IN NwGtpv1uTrxnT *pTrxn,
- NW_IN NwU32T peerIp,
- NW_IN NwU32T peerPort,
+ NW_IN uint32_t peerIp,
+ NW_IN uint32_t peerPort,
NW_IN NwGtpv1uMsgT *pMsg)
{
NwGtpv1uRcT rc;
- NwU8T *msgHdr;
+ uint8_t *msgHdr;
NW_ASSERT(thiz);
NW_ASSERT(pMsg);
@@ -334,33 +334,33 @@ nwGtpv1uTrxnCreateAndSendMsg( NW_IN NwGtpv1uStackT *thiz,
(pMsg->npduNumFlag);
*(msgHdr++) = (pMsg->msgType);
- *((NwU16T *) msgHdr) = htons(pMsg->msgLen);
+ *((uint16_t *) msgHdr) = htons(pMsg->msgLen);
msgHdr += 2;
- *((NwU32T *) msgHdr) = htonl(pMsg->teid);
+ *((uint32_t *) msgHdr) = htonl(pMsg->teid);
msgHdr += 4;
if(pMsg->seqNumFlag | pMsg->extHdrFlag | pMsg->npduNumFlag) {
if(pMsg->seqNumFlag) {
- *((NwU16T *) msgHdr) = htons((pTrxn ? pTrxn->seqNum : pMsg->seqNum));
+ *((uint16_t *) msgHdr) = htons((pTrxn ? pTrxn->seqNum : pMsg->seqNum));
} else {
- *((NwU16T *) msgHdr) = 0x0000;
+ *((uint16_t *) msgHdr) = 0x0000;
}
msgHdr += 2;
if(pMsg->npduNumFlag) {
- *((NwU8T *) msgHdr) = pMsg->npduNumFlag;
+ *((uint8_t *) msgHdr) = pMsg->npduNumFlag;
} else {
- *((NwU8T *) msgHdr) = 0x00;
+ *((uint8_t *) msgHdr) = 0x00;
}
msgHdr++;
if(pMsg->extHdrFlag) {
- *((NwU8T *) msgHdr) = pMsg->extHdrFlag;
+ *((uint8_t *) msgHdr) = pMsg->extHdrFlag;
} else {
- *((NwU8T *) msgHdr) = 0x00;
+ *((uint8_t *) msgHdr) = 0x00;
}
msgHdr++;
diff --git a/openair-cn/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniLogMgrEntity.c b/openair-cn/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniLogMgrEntity.c
index 86c059a1bb..c50e6a17db 100644
--- a/openair-cn/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniLogMgrEntity.c
+++ b/openair-cn/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniLogMgrEntity.c
@@ -23,27 +23,27 @@
extern "C" {
#endif
-NwU32T g_log_level = NW_LOG_LEVEL_INFO;
+uint32_t g_log_level = NW_LOG_LEVEL_INFO;
/*---------------------------------------------------------------------------
* Public functions
*--------------------------------------------------------------------------*/
-NwGtpv1uRcT nwMiniLogMgrInit(NwMiniLogMgrT *thiz, NwU32T logLevel )
+NwGtpv1uRcT nwMiniLogMgrInit(NwMiniLogMgrT *thiz, uint32_t logLevel )
{
thiz->logLevel = logLevel;
return NW_GTPV1U_OK;
}
-NwGtpv1uRcT nwMiniLogMgrSetLogLevel(NwMiniLogMgrT *thiz, NwU32T logLevel)
+NwGtpv1uRcT nwMiniLogMgrSetLogLevel(NwMiniLogMgrT *thiz, uint32_t logLevel)
{
thiz->logLevel = logLevel;
}
NwGtpv1uRcT nwMiniLogMgrLogRequest (NwGtpv1uLogMgrHandleT hLogMgr,
- NwU32T logLevel,
+ uint32_t logLevel,
NwCharT *file,
- NwU32T line,
+ uint32_t line,
NwCharT *logStr)
{
NwMiniLogMgrT *thiz = (NwMiniLogMgrT *) hLogMgr;
diff --git a/openair-cn/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniLogMgrEntity.h b/openair-cn/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniLogMgrEntity.h
index cff5649b09..ffa9c0c85e 100644
--- a/openair-cn/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniLogMgrEntity.h
+++ b/openair-cn/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniLogMgrEntity.h
@@ -23,7 +23,7 @@
#ifndef __NW_MINI_LOG_MGR_H__
#define __NW_MINI_LOG_MGR_H__
-extern NwU32T g_log_level;
+extern uint32_t g_log_level;
#define NW_LOG( _logLevel, ...) \
@@ -37,7 +37,7 @@ extern NwU32T g_log_level;
} while(0)
typedef struct {
- NwU8T logLevel;
+ uint8_t logLevel;
} NwMiniLogMgrT;
#ifdef __cplusplus
@@ -45,9 +45,9 @@ extern "C" {
#endif
NwGtpv1uRcT nwMiniLogMgrLogRequest (NwGtpv1uLogMgrHandleT logMgrHandle,
- NwU32T logLevel,
+ uint32_t logLevel,
NwCharT* file,
- NwU32T line,
+ uint32_t line,
NwCharT* logStr);
#ifdef __cplusplus
diff --git a/openair-cn/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniTmrMgrEntity.c b/openair-cn/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniTmrMgrEntity.c
index 67112b7d30..f6102d5250 100644
--- a/openair-cn/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniTmrMgrEntity.c
+++ b/openair-cn/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniTmrMgrEntity.c
@@ -53,9 +53,9 @@ NW_TMR_CALLBACK(nwMiniTmrMgrHandleTimeout)
*--------------------------------------------------------------------------*/
NwGtpv1uRcT nwTimerStart( NwGtpv1uTimerMgrHandleT tmrMgrHandle,
- NwU32T timeoutSec,
- NwU32T timeoutUsec,
- NwU32T tmrType,
+ uint32_t timeoutSec,
+ uint32_t timeoutUsec,
+ uint32_t tmrType,
void *timeoutArg,
NwGtpv1uTimerHandleT *hTmr)
{
diff --git a/openair-cn/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniTmrMgrEntity.h b/openair-cn/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniTmrMgrEntity.h
index 34ba9a944d..b17228c9cf 100644
--- a/openair-cn/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniTmrMgrEntity.h
+++ b/openair-cn/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniTmrMgrEntity.h
@@ -35,9 +35,9 @@ extern "C" {
#endif
NwGtpv1uRcT nwTimerStart( NwGtpv1uTimerMgrHandleT tmrMgrHandle,
- NwU32T timeoutSec,
- NwU32T timeoutUsec,
- NwU32T tmrType,
+ uint32_t timeoutSec,
+ uint32_t timeoutUsec,
+ uint32_t tmrType,
void* timeoutArg,
NwGtpv1uTimerHandleT* hTmr);
diff --git a/openair-cn/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniUdpEntity.c b/openair-cn/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniUdpEntity.c
index 224138dc52..a63b02985c 100644
--- a/openair-cn/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniUdpEntity.c
+++ b/openair-cn/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniUdpEntity.c
@@ -44,9 +44,9 @@ static
void NW_TMR_CALLBACK(nwUdpDataIndicationCallbackData)
{
NwGtpv1uRcT rc;
- NwU8T udpBuf[MAX_UDP_PAYLOAD_LEN];
+ uint8_t udpBuf[MAX_UDP_PAYLOAD_LEN];
NwS32T bytesRead;
- NwU32T peerLen;
+ uint32_t peerLen;
struct sockaddr_in peer;
NwMiniUdpEntityT *thiz = (NwMiniUdpEntityT *) arg;
@@ -71,7 +71,7 @@ void NW_TMR_CALLBACK(nwUdpDataIndicationCallbackData)
*--------------------------------------------------------------------------*/
NwGtpv1uRcT nwMiniUdpInit(NwMiniUdpEntityT *thiz,
- NwGtpv1uStackHandleT hGtpv1uStack, NwU8T *ipAddr)
+ NwGtpv1uStackHandleT hGtpv1uStack, uint8_t *ipAddr)
{
int sd;
struct sockaddr_in addr;
@@ -109,10 +109,10 @@ NwGtpv1uRcT nwMiniUdpDestroy(NwMiniUdpEntityT *thiz)
}
NwGtpv1uRcT nwMiniUdpDataReq(NwGtpv1uUdpHandleT udpHandle,
- NwU8T *dataBuf,
- NwU32T dataSize,
- NwU32T peerIpAddr,
- NwU32T peerPort)
+ uint8_t *dataBuf,
+ uint32_t dataSize,
+ uint32_t peerIpAddr,
+ uint32_t peerPort)
{
struct sockaddr_in peerAddr;
NwS32T bytesSent;
diff --git a/openair-cn/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniUdpEntity.h b/openair-cn/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniUdpEntity.h
index 018175a25c..2e19ebbb8e 100644
--- a/openair-cn/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniUdpEntity.h
+++ b/openair-cn/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniUdpEntity.h
@@ -25,7 +25,7 @@
#define __NW_MINI_UDP_ENTITY_H__
typedef struct {
- NwU32T hSocket;
+ uint32_t hSocket;
NwEventT ev;
NwGtpv1uStackHandleT hGtpv1uStack;
} NwMiniUdpEntityT;
@@ -34,15 +34,15 @@ typedef struct {
extern "C" {
#endif
-NwGtpv1uRcT nwMiniUdpInit(NwMiniUdpEntityT* thiz, NwGtpv1uStackHandleT hGtpv1uStack, NwU8T* ipAddr);
+NwGtpv1uRcT nwMiniUdpInit(NwMiniUdpEntityT* thiz, NwGtpv1uStackHandleT hGtpv1uStack, uint8_t* ipAddr);
NwGtpv1uRcT nwMiniUdpDestroy(NwMiniUdpEntityT* thiz);
NwGtpv1uRcT nwMiniUdpDataReq(NwGtpv1uUdpHandleT udpHandle,
- NwU8T* dataBuf,
- NwU32T dataSize,
- NwU32T peerAddr,
- NwU32T peerPort);
+ uint8_t* dataBuf,
+ uint32_t dataSize,
+ uint32_t peerAddr,
+ uint32_t peerPort);
#ifdef __cplusplus
}
diff --git a/openair-cn/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniUlpEntity.c b/openair-cn/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniUlpEntity.c
index 8f05c794c2..e2f505b4eb 100644
--- a/openair-cn/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniUlpEntity.c
+++ b/openair-cn/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniUlpEntity.c
@@ -36,7 +36,7 @@ extern "C" {
#define MAX_UDP_PAYLOAD_LEN (4096)
NwGtpv1uRcT
-nwMiniUlpSendEchoRequestToPeer(NwMiniUlpEntityT *thiz, NwU32T peerIp)
+nwMiniUlpSendEchoRequestToPeer(NwMiniUlpEntityT *thiz, uint32_t peerIp)
{
NwGtpv1uRcT rc;
NwGtpv1uUlpApiT ulpReq;
@@ -82,9 +82,9 @@ void NW_EVT_CALLBACK(nwMiniUlpDataIndicationCallbackData)
{
NwMiniUlpEntityT *thiz = (NwMiniUlpEntityT *) arg;
NwGtpv1uRcT rc;
- NwU8T udpBuf[MAX_UDP_PAYLOAD_LEN];
+ uint8_t udpBuf[MAX_UDP_PAYLOAD_LEN];
NwS32T bytesRead;
- NwU32T peerLen;
+ uint32_t peerLen;
struct sockaddr_in peer;
peerLen = sizeof(peer);
@@ -123,7 +123,7 @@ nwMiniUlpDestroy(NwMiniUlpEntityT *thiz)
}
NwGtpv1uRcT
-nwMiniUlpCreateConn(NwMiniUlpEntityT *thiz, char *localIpStr, NwU16T localport,
+nwMiniUlpCreateConn(NwMiniUlpEntityT *thiz, char *localIpStr, uint16_t localport,
char *peerIpStr)
{
NwGtpv1uRcT rc;
@@ -214,8 +214,8 @@ nwMiniUlpDestroyConn(NwMiniUlpEntityT *thiz)
NwGtpv1uRcT
-nwMiniUlpTpduSend(NwMiniUlpEntityT *thiz, NwU8T *tpduBuf, NwU32T tpduLen ,
- NwU16T fromPort)
+nwMiniUlpTpduSend(NwMiniUlpEntityT *thiz, uint8_t *tpduBuf, uint32_t tpduLen ,
+ uint16_t fromPort)
{
NwGtpv1uRcT rc;
NwGtpv1uUlpApiT ulpReq;
@@ -260,9 +260,9 @@ nwMiniUlpProcessStackReqCallback (NwGtpv1uUlpHandleT hUlp,
case NW_GTPV1U_ULP_API_RECV_TPDU: {
struct sockaddr_in peerAddr;
NwS32T bytesSent;
- NwU8T dataBuf[4096];
- NwU32T dataSize;
- NwU32T peerIpAddr = (inet_addr(thiz->peerIpStr));
+ uint8_t dataBuf[4096];
+ uint32_t dataSize;
+ uint32_t peerIpAddr = (inet_addr(thiz->peerIpStr));
NW_ASSERT( NW_GTPV1U_OK == nwGtpv1uMsgGetTpdu(pUlpApi->apiInfo.recvMsgInfo.hMsg,
dataBuf, &dataSize) );
diff --git a/openair-cn/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniUlpEntity.h b/openair-cn/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniUlpEntity.h
index f50fa84ab6..dd55e8ed7c 100644
--- a/openair-cn/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniUlpEntity.h
+++ b/openair-cn/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniUlpEntity.h
@@ -21,11 +21,11 @@
typedef struct {
int hSocket;
- NwU16T seqNum;
- NwU8T restartCounter;
- NwU8T localIpStr[16];
- NwU8T peerIpStr[16];
- NwU32T localPort[1025];
+ uint16_t seqNum;
+ uint8_t restartCounter;
+ uint8_t localIpStr[16];
+ uint8_t peerIpStr[16];
+ uint32_t localPort[1025];
NwEventT ev[1025];
NwGtpv1uStackHandleT hGtpv1uStack;
NwGtpv1uStackSessionHandleT hGtpv1uConn;
@@ -42,7 +42,7 @@ NwGtpv1uRcT
nwMiniUlpDestroy(NwMiniUlpEntityT* thiz);
NwGtpv1uRcT
-nwMiniUlpCreateConn(NwMiniUlpEntityT* thiz, char* localIpStr, NwU16T localPort, char* peerIpStr);
+nwMiniUlpCreateConn(NwMiniUlpEntityT* thiz, char* localIpStr, uint16_t localPort, char* peerIpStr);
NwGtpv1uRcT
nwMiniUlpDestroyConn(NwMiniUlpEntityT* thiz);
@@ -51,7 +51,7 @@ NwGtpv1uRcT
nwMiniUlpSendMsg(NwMiniUlpEntityT* thiz);
NwGtpv1uRcT
-nwMiniUlpTpduSend(NwMiniUlpEntityT* thiz, NwU8T* tpduBuf, NwU32T tpduLen , NwU16T fromPort);
+nwMiniUlpTpduSend(NwMiniUlpEntityT* thiz, uint8_t* tpduBuf, uint32_t tpduLen , uint16_t fromPort);
NwGtpv1uRcT
nwMiniUlpProcessStackReqCallback (NwGtpv1uUlpHandleT hUlp,
diff --git a/openair-cn/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/helloworld.c b/openair-cn/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/helloworld.c
index faf490a743..2f618ad642 100644
--- a/openair-cn/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/helloworld.c
+++ b/openair-cn/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/helloworld.c
@@ -37,8 +37,8 @@ int main(int argc, char *argv[])
{
NwGtpv1uRcT rc;
char *logLevelStr;
- NwU32T logLevel;
- NwU32T num_of_connections;
+ uint32_t logLevel;
+ uint32_t num_of_connections;
NwGtpv1uStackHandleT hGtpv1uStack = 0;
NwMiniUlpEntityT ulpObj;
diff --git a/openair-cn/GTPV2-C/nwgtpv2c-0.11/include/NwGtpv2cMsgIeParseInfo.h b/openair-cn/GTPV2-C/nwgtpv2c-0.11/include/NwGtpv2cMsgIeParseInfo.h
index bcedf5e4bc..38a37a5d4a 100644
--- a/openair-cn/GTPV2-C/nwgtpv2c-0.11/include/NwGtpv2cMsgIeParseInfo.h
+++ b/openair-cn/GTPV2-C/nwgtpv2c-0.11/include/NwGtpv2cMsgIeParseInfo.h
@@ -43,25 +43,25 @@
*/
typedef struct {
- NwU8T groupedIeType;
- NwU16T mandatoryIeCount;
+ uint8_t groupedIeType;
+ uint16_t mandatoryIeCount;
NwGtpv2cStackHandleT hStack;
struct {
- NwU8T ieMinLength;
- NwU8T iePresence;
+ uint8_t ieMinLength;
+ uint8_t iePresence;
} ieParseInfo[NW_GTPV2C_IE_TYPE_MAXIMUM][NW_GTPV2C_IE_INSTANCE_MAXIMUM];
} NwGtpv2cGroupedIeParseInfoT;
typedef struct {
- NwU16T msgType;
- NwU16T mandatoryIeCount;
+ uint16_t msgType;
+ uint16_t mandatoryIeCount;
NwGtpv2cStackHandleT hStack;
struct {
- NwU8T ieMinLength;
- NwU8T iePresence;
+ uint8_t ieMinLength;
+ uint8_t iePresence;
NwGtpv2cGroupedIeParseInfoT* pGroupedIeInfo;
} ieParseInfo[NW_GTPV2C_IE_TYPE_MAXIMUM][NW_GTPV2C_IE_INSTANCE_MAXIMUM];
@@ -72,7 +72,7 @@ extern "C" {
#endif
NwGtpv2cMsgIeParseInfoT*
-nwGtpv2cMsgIeParseInfoNew(NwGtpv2cStackHandleT hStack, NwU8T msgType);
+nwGtpv2cMsgIeParseInfoNew(NwGtpv2cStackHandleT hStack, uint8_t msgType);
NwRcT
nwGtpv2cMsgIeParseInfoDelete(NwGtpv2cMsgIeParseInfoT* thiz);
diff --git a/openair-cn/GTPV2-C/nwgtpv2c-0.11/include/NwGtpv2cPrivate.h b/openair-cn/GTPV2-C/nwgtpv2c-0.11/include/NwGtpv2cPrivate.h
index d52d136eba..29be2c3f29 100644
--- a/openair-cn/GTPV2-C/nwgtpv2c-0.11/include/NwGtpv2cPrivate.h
+++ b/openair-cn/GTPV2-C/nwgtpv2c-0.11/include/NwGtpv2cPrivate.h
@@ -90,16 +90,16 @@ extern "C" {
*/
typedef struct NwGtpv2cStack {
- NwU32T id;
+ uint32_t id;
NwGtpv2cUlpEntityT ulp;
NwGtpv2cUdpEntityT udp;
NwGtpv2cMemMgrEntityT memMgr;
NwGtpv2cTimerMgrEntityT tmrMgr;
NwGtpv2cLogMgrEntityT logMgr;
- NwU32T seqNum;
- NwU32T logLevel;
- NwU32T restartCounter;
+ uint32_t seqNum;
+ uint32_t logLevel;
+ uint32_t restartCounter;
NwGtpv2cMsgIeParseInfoT *pGtpv2cMsgIeParseInfo[NW_GTP_MSG_END];
struct NwGtpv2cTimeoutInfo *activeTimerInfo;
@@ -123,12 +123,12 @@ typedef struct NwGtpv2cStack {
typedef struct NwGtpv2cTimeoutInfo {
NwGtpv2cStackHandleT hStack;
struct timeval tvTimeout;
- NwU32T tmrType;
+ uint32_t tmrType;
void* timeoutArg;
NwRcT (*timeoutCallbackFunc)(void*);
NwGtpv2cTimerHandleT hTimer;
RB_ENTRY (NwGtpv2cTimeoutInfo) activeTimerListRbtNode; /**< RB Tree Data Structure Node */
- NwU32T timerMinHeapIndex;
+ uint32_t timerMinHeapIndex;
struct NwGtpv2cTimeoutInfo *next;
} NwGtpv2cTimeoutInfoT;
@@ -143,23 +143,23 @@ typedef struct NwGtpv2cTimeoutInfo {
* NwGtpv2cMsgT holds gtpv2c messages to/from the peer.
*/
typedef struct NwGtpv2cMsgS {
- NwU8T version;
- NwU8T teidPresent;
- NwU8T msgType;
- NwU16T msgLen;
- NwU32T teid;
- NwU32T seqNum;
- NwU8T* pMsgStart;
+ uint8_t version;
+ uint8_t teidPresent;
+ uint8_t msgType;
+ uint16_t msgLen;
+ uint32_t teid;
+ uint32_t seqNum;
+ uint8_t* pMsgStart;
#define NW_GTPV2C_MAX_GROUPED_IE_DEPTH (2)
struct {
NwGtpv2cIeTlvT *pIe[NW_GTPV2C_MAX_GROUPED_IE_DEPTH];
- NwU8T top;
+ uint8_t top;
} groupedIeEncodeStack;
NwBoolT isIeValid[NW_GTPV2C_IE_TYPE_MAXIMUM][NW_GTPV2C_IE_INSTANCE_MAXIMUM];
- NwU8T *pIe[NW_GTPV2C_IE_TYPE_MAXIMUM][NW_GTPV2C_IE_INSTANCE_MAXIMUM];
- NwU8T msgBuf[NW_GTPV2C_MAX_MSG_LEN];
+ uint8_t *pIe[NW_GTPV2C_IE_TYPE_MAXIMUM][NW_GTPV2C_IE_INSTANCE_MAXIMUM];
+ uint8_t msgBuf[NW_GTPV2C_MAX_MSG_LEN];
NwGtpv2cStackHandleT hStack;
struct NwGtpv2cMsgS* next;
} NwGtpv2cMsgT;
@@ -169,11 +169,11 @@ typedef struct NwGtpv2cMsgS {
*/
typedef struct NwGtpv2cTrxn {
- NwU32T seqNum;
- NwU32T peerIp;
- NwU32T peerPort;
- NwU8T t3Timer;
- NwU8T maxRetries;
+ uint32_t seqNum;
+ uint32_t peerIp;
+ uint32_t peerPort;
+ uint8_t t3Timer;
+ uint8_t maxRetries;
NwGtpv2cMsgT* pMsg;
NwGtpv2cStackT* pStack;
NwGtpv2cTimerHandleT hRspTmr; /**< Handle to reponse timer */
@@ -189,11 +189,11 @@ typedef struct NwGtpv2cTrxn {
*/
typedef struct NwGtpv2cPathS {
- NwU32T hUlpPath; /**< Handle to ULP path contect */
- NwU32T ipv4Address;
- NwU32T restartCounter;
- NwU16T t3ResponseTimout;
- NwU16T n3RequestCount;
+ uint32_t hUlpPath; /**< Handle to ULP path contect */
+ uint32_t ipv4Address;
+ uint32_t restartCounter;
+ uint16_t t3ResponseTimout;
+ uint16_t n3RequestCount;
NwGtpv2cTimerHandleT hKeepAliveTmr; /**< Handle to path keep alive echo timer */
RB_ENTRY (NwGtpv2cPathS) pathMapRbtNode;
} NwGtpv2cPathT;
@@ -210,9 +210,9 @@ RB_PROTOTYPE(NwGtpv2cActiveTimerList, NwGtpv2cTimeoutInfo, activeTimerListRbtNod
NwRcT
nwGtpv2cStartTimer(NwGtpv2cStackT* thiz,
- NwU32T timeoutSec,
- NwU32T timeoutUsec,
- NwU32T tmrType,
+ uint32_t timeoutSec,
+ uint32_t timeoutUsec,
+ uint32_t tmrType,
NwRcT (*timeoutCallbackFunc)(void*),
void* timeoutCallbackArg,
NwGtpv2cTimerHandleT *phTimer);
diff --git a/openair-cn/GTPV2-C/nwgtpv2c-0.11/include/NwGtpv2cTrxn.h b/openair-cn/GTPV2-C/nwgtpv2c-0.11/include/NwGtpv2cTrxn.h
index ebf727583c..26ae1875c3 100644
--- a/openair-cn/GTPV2-C/nwgtpv2c-0.11/include/NwGtpv2cTrxn.h
+++ b/openair-cn/GTPV2-C/nwgtpv2c-0.11/include/NwGtpv2cTrxn.h
@@ -60,7 +60,7 @@ nwGtpv2cTrxnNew( NW_IN NwGtpv2cStackT* pStack);
*/
NwGtpv2cTrxnT*
nwGtpv2cTrxnWithSeqNumNew( NW_IN NwGtpv2cStackT* pStack,
- NW_IN NwU32T seqNum);
+ NW_IN uint32_t seqNum);
/**
* Another overloaded constructor. Create transaction as outstanding
@@ -76,10 +76,10 @@ nwGtpv2cTrxnWithSeqNumNew( NW_IN NwGtpv2cStackT* pStack,
NwGtpv2cTrxnT*
nwGtpv2cTrxnOutstandingRxNew( NW_IN NwGtpv2cStackT* pStack,
- NW_IN NwU32T teidLocal,
- NW_IN NwU32T peerIp,
- NW_IN NwU32T peerPort,
- NW_IN NwU32T seqNum);
+ NW_IN uint32_t teidLocal,
+ NW_IN uint32_t peerIp,
+ NW_IN uint32_t peerPort,
+ NW_IN uint32_t seqNum);
NwRcT
nwGtpv2cTrxnDelete( NW_INOUT NwGtpv2cTrxnT **ppTrxn);
diff --git a/openair-cn/GTPV2-C/nwgtpv2c-0.11/include/NwGtpv2cTunnel.h b/openair-cn/GTPV2-C/nwgtpv2c-0.11/include/NwGtpv2cTunnel.h
index 0f0d3c00c4..33c437ada7 100644
--- a/openair-cn/GTPV2-C/nwgtpv2c-0.11/include/NwGtpv2cTunnel.h
+++ b/openair-cn/GTPV2-C/nwgtpv2c-0.11/include/NwGtpv2cTunnel.h
@@ -51,15 +51,15 @@ extern "C" {
struct NwGtpv2cStack;
typedef struct NwGtpv2cTunnel {
- NwU32T teid;
- NwU32T ipv4AddrRemote;
+ uint32_t teid;
+ uint32_t ipv4AddrRemote;
NwGtpv2cUlpTunnelHandleT hUlpTunnel;
RB_ENTRY (NwGtpv2cTunnel) tunnelMapRbtNode; /**< RB Tree Data Structure Node */
struct NwGtpv2cTunnel* next;
} NwGtpv2cTunnelT;
NwGtpv2cTunnelT*
-nwGtpv2cTunnelNew(struct NwGtpv2cStack *hStack, NwU32T teid, NwU32T peerIpv4Addr, NwGtpv2cUlpTunnelHandleT hUlpTunnel);
+nwGtpv2cTunnelNew(struct NwGtpv2cStack *hStack, uint32_t teid, uint32_t peerIpv4Addr, NwGtpv2cUlpTunnelHandleT hUlpTunnel);
NwRcT
nwGtpv2cTunnelDelete(struct NwGtpv2cStack *pStack, NwGtpv2cTunnelT* thiz);
diff --git a/openair-cn/GTPV2-C/nwgtpv2c-0.11/shared/NwGtpv2c.h b/openair-cn/GTPV2-C/nwgtpv2c-0.11/shared/NwGtpv2c.h
index 7b4039fb12..e3178fb11b 100644
--- a/openair-cn/GTPV2-C/nwgtpv2c-0.11/shared/NwGtpv2c.h
+++ b/openair-cn/GTPV2-C/nwgtpv2c-0.11/shared/NwGtpv2c.h
@@ -120,10 +120,10 @@ typedef NwPtrT NwGtpv2cTunnelHandleT; /**< Gtpv2c Ulp
typedef NwPtrT NwGtpv2cUlpTrxnHandleT; /**< Gtpv2c Ulp Transaction Handle */
typedef NwPtrT NwGtpv2cUlpTunnelHandleT; /**< Gtpv2c Ulp Tunnel Handle */
-typedef NwU8T NwGtpv2cMsgTypeT; /**< Gtpv2c Msg Type */
+typedef uint8_t NwGtpv2cMsgTypeT; /**< Gtpv2c Msg Type */
typedef struct NwGtpv2cStackConfigS {
- NwU16T __tbd;
+ uint16_t __tbd;
} NwGtpv2cStackConfigT;
/*--------------------------------------------------------------------------*
@@ -172,11 +172,11 @@ typedef enum {
*/
typedef struct NwGtpv2cErrorS {
- NW_IN NwU8T cause;
- NW_IN NwU8T flags;
+ NW_IN uint8_t cause;
+ NW_IN uint8_t flags;
struct {
- NW_IN NwU8T type;
- NW_IN NwU8T instance;
+ NW_IN uint8_t type;
+ NW_IN uint8_t instance;
} offendingIe;
} NwGtpv2cErrorT;
@@ -187,12 +187,12 @@ typedef struct NwGtpv2cErrorS {
typedef struct {
NW_INOUT NwGtpv2cTunnelHandleT hTunnel; /**< Tunnel handle over which the mesasge is to be sent.*/
- NW_IN NwU16T t3Timer;
- NW_IN NwU16T maxRetries;
+ NW_IN uint16_t t3Timer;
+ NW_IN uint16_t maxRetries;
NW_IN NwGtpv2cUlpTrxnHandleT hUlpTrxn; /**< Optional handle to be returned in rsp of this msg. */
- NW_IN NwU32T peerIp; /**< Required only in case when hTunnel == 0 */
- NW_IN NwU32T teidLocal; /**< Required only in case when hTunnel == 0 */
+ NW_IN uint32_t peerIp; /**< Required only in case when hTunnel == 0 */
+ NW_IN uint32_t teidLocal; /**< Required only in case when hTunnel == 0 */
NW_IN NwGtpv2cUlpTunnelHandleT hUlpTunnel; /**< Required only in case when hTunnel == 0 */
} NwGtpv2cInitialReqInfoT;
@@ -204,11 +204,11 @@ typedef struct {
typedef struct {
NW_IN NwGtpv2cTunnelHandleT hTunnel; /**< Tunnel handle over which the mesasge is to be sent */
NW_IN NwGtpv2cTrxnHandleT hTrxn; /**< Request Trxn handle which to which triggered req is being sent */
- NW_IN NwU16T t3Timer;
- NW_IN NwU16T maxRetries;
+ NW_IN uint16_t t3Timer;
+ NW_IN uint16_t maxRetries;
NW_IN NwGtpv2cUlpTrxnHandleT hUlpTrxn; /**< Optional handle to be returned in rsp of this msg. */
- NW_IN NwU32T peerIp; /**< Required only in case when hTunnel == 0 */
- NW_IN NwU32T teidLocal; /**< Required only in case when hTunnel == 0 */
+ NW_IN uint32_t peerIp; /**< Required only in case when hTunnel == 0 */
+ NW_IN uint32_t teidLocal; /**< Required only in case when hTunnel == 0 */
NW_IN NwGtpv2cUlpTunnelHandleT hUlpTunnel; /**< Required only in case when hTunnel == 0 */
} NwGtpv2cTriggeredReqInfoT;
@@ -220,7 +220,7 @@ typedef struct {
typedef struct {
NW_IN NwGtpv2cTrxnHandleT hTrxn; /**< Request Trxn handle which to which triggered rsp is being sent */
- NW_IN NwU32T teidLocal; /**< Required only if NW_GTPV2C_ULP_API_FLAG_CREATE_LOCAL_TUNNEL is set to flags. */
+ NW_IN uint32_t teidLocal; /**< Required only if NW_GTPV2C_ULP_API_FLAG_CREATE_LOCAL_TUNNEL is set to flags. */
NW_IN NwGtpv2cUlpTunnelHandleT hUlpTunnel; /**< Required only if NW_GTPV2C_ULP_API_FLAG_CREATE_LOCAL_TUNNEL is set to flags. */
NW_OUT NwGtpv2cTunnelHandleT hTunnel; /**< Returned only in case flags is set to
@@ -237,8 +237,8 @@ typedef struct {
NW_IN NwGtpv2cTrxnHandleT hTrxn;
NW_IN NwGtpv2cUlpTrxnHandleT hUlpTrxn;
NW_IN NwGtpv2cMsgTypeT msgType;
- NW_IN NwU32T peerIp;
- NW_IN NwU32T peerPort;
+ NW_IN uint32_t peerIp;
+ NW_IN uint32_t peerPort;
NW_IN NwGtpv2cUlpTunnelHandleT hUlpTunnel;
NW_INOUT NwGtpv2cTunnelHandleT hTunnel;
} NwGtpv2cInitialReqIndInfoT;
@@ -253,9 +253,9 @@ typedef struct {
NW_IN NwGtpv2cTrxnHandleT hTrxn;
NW_IN NwGtpv2cUlpTrxnHandleT hUlpTrxn;
NW_IN NwGtpv2cMsgTypeT msgType;
- NW_IN NwU32T seqNum;
- NW_IN NwU32T teidLocal;
- NW_IN NwU32T teidRemote;
+ NW_IN uint32_t seqNum;
+ NW_IN uint32_t teidLocal;
+ NW_IN uint32_t teidRemote;
NW_IN NwGtpv2cUlpTunnelHandleT hUlpTunnel;
} NwGtpv2cTriggeredReqIndInfoT;
@@ -289,8 +289,8 @@ typedef struct {
typedef struct {
NW_OUT NwGtpv2cTunnelHandleT hTunnel;
NW_IN NwGtpv2cUlpTunnelHandleT hUlpTunnel;
- NW_IN NwU32T teidLocal;
- NW_IN NwU32T peerIp;
+ NW_IN uint32_t teidLocal;
+ NW_IN uint32_t peerIp;
} NwGtpv2cCreateLocalTunnelInfoT;
@@ -347,10 +347,10 @@ typedef struct {
typedef struct {
NwGtpv2cUdpHandleT hUdp;
NwRcT (*udpDataReqCallback) ( NW_IN NwGtpv2cUdpHandleT udpHandle,
- NW_IN NwU8T* dataBuf,
- NW_IN NwU32T dataSize,
- NW_IN NwU32T peerIp,
- NW_IN NwU32T peerPort);
+ NW_IN uint8_t* dataBuf,
+ NW_IN uint32_t dataSize,
+ NW_IN uint32_t peerIp,
+ NW_IN uint32_t peerPort);
} NwGtpv2cUdpEntityT;
/**
@@ -360,14 +360,14 @@ typedef struct {
typedef struct {
NwGtpv2cMemMgrHandleT hMemMgr;
void* (*memAlloc)( NW_IN NwGtpv2cMemMgrHandleT hMemMgr,
- NW_IN NwU32T memSize,
+ NW_IN uint32_t memSize,
NW_IN NwCharT* fileName,
- NW_IN NwU32T lineNumber);
+ NW_IN uint32_t lineNumber);
void (*memFree) ( NW_IN NwGtpv2cMemMgrHandleT hMemMgr,
NW_IN void* hMem,
NW_IN NwCharT* fileName,
- NW_IN NwU32T lineNumber);
+ NW_IN uint32_t lineNumber);
} NwGtpv2cMemMgrEntityT;
@@ -380,9 +380,9 @@ typedef struct {
typedef struct {
NwGtpv2cTimerMgrHandleT tmrMgrHandle;
NwRcT (*tmrStartCallback)( NW_IN NwGtpv2cTimerMgrHandleT tmrMgrHandle,
- NW_IN NwU32T timeoutSec,
- NW_IN NwU32T timeoutUsec,
- NW_IN NwU32T tmrType,
+ NW_IN uint32_t timeoutSec,
+ NW_IN uint32_t timeoutUsec,
+ NW_IN uint32_t tmrType,
NW_IN void* tmrArg,
NW_OUT NwGtpv2cTimerHandleT* tmrHandle);
@@ -397,9 +397,9 @@ typedef struct {
typedef struct {
NwGtpv2cLogMgrHandleT logMgrHandle;
NwRcT (*logReqCallback) (NW_IN NwGtpv2cLogMgrHandleT logMgrHandle,
- NW_IN NwU32T logLevel,
+ NW_IN uint32_t logLevel,
NW_IN NwCharT* filename,
- NW_IN NwU32T line,
+ NW_IN uint32_t line,
NW_IN NwCharT* logStr);
} NwGtpv2cLogMgrEntityT;
@@ -519,7 +519,7 @@ nwGtpv2cSetLogMgrEntity( NW_IN NwGtpv2cStackHandleT hGtpcStackHandle,
NwRcT
nwGtpv2cSetLogLevel( NW_IN NwGtpv2cStackHandleT hGtpcStackHandle,
- NW_IN NwU32T logLevel);
+ NW_IN uint32_t logLevel);
/**
@@ -535,10 +535,10 @@ nwGtpv2cSetLogLevel( NW_IN NwGtpv2cStackHandleT hGtpcStackHandle,
NwRcT
nwGtpv2cProcessUdpReq( NW_IN NwGtpv2cStackHandleT hGtpcStackHandle,
- NW_IN NwU8T* udpData,
- NW_IN NwU32T udpDataLen,
- NW_IN NwU16T peerPort,
- NW_IN NwU32T peerIP);
+ NW_IN uint8_t* udpData,
+ NW_IN uint32_t udpDataLen,
+ NW_IN uint16_t peerPort,
+ NW_IN uint32_t peerIP);
/**
Process Request from ULP entity.
diff --git a/openair-cn/GTPV2-C/nwgtpv2c-0.11/shared/NwGtpv2cMsg.h b/openair-cn/GTPV2-C/nwgtpv2c-0.11/shared/NwGtpv2cMsg.h
index 30e12debfa..7c7476383b 100644
--- a/openair-cn/GTPV2-C/nwgtpv2c-0.11/shared/NwGtpv2cMsg.h
+++ b/openair-cn/GTPV2-C/nwgtpv2c-0.11/shared/NwGtpv2cMsg.h
@@ -186,37 +186,37 @@ extern "C" {
#pragma pack(1)
typedef struct NwGtpv2cIeTv1 {
- NwU8T t;
- NwU16T l;
- NwU8T i;
- NwU8T v;
+ uint8_t t;
+ uint16_t l;
+ uint8_t i;
+ uint8_t v;
} NwGtpv2cIeTv1T;
typedef struct NwGtpv2cIeTv2 {
- NwU8T t;
- NwU16T l;
- NwU8T i;
- NwU16T v;
+ uint8_t t;
+ uint16_t l;
+ uint8_t i;
+ uint16_t v;
} NwGtpv2cIeTv2T;
typedef struct NwGtpv2cIeTv4 {
- NwU8T t;
- NwU16T l;
- NwU8T i;
- NwU32T v;
+ uint8_t t;
+ uint16_t l;
+ uint8_t i;
+ uint32_t v;
} NwGtpv2cIeTv4T;
typedef struct NwGtpv2cIeTv8 {
- NwU8T t;
- NwU16T l;
- NwU8T i;
- NwU64T v;
+ uint8_t t;
+ uint16_t l;
+ uint8_t i;
+ uint64_t v;
} NwGtpv2cIeTv8T;
typedef struct NwGtpv2cIeTlv {
- NwU8T t;
- NwU16T l;
- NwU8T i;
+ uint8_t t;
+ uint16_t l;
+ uint8_t i;
} NwGtpv2cIeTlvT;
#pragma pack()
@@ -235,10 +235,10 @@ typedef struct NwGtpv2cIeTlv {
NwRcT
nwGtpv2cMsgNew( NW_IN NwGtpv2cStackHandleT hGtpcStackHandle,
- NW_IN NwU8T teidPresent,
- NW_IN NwU8T msgType,
- NW_IN NwU32T teid,
- NW_IN NwU32T seqNum,
+ NW_IN uint8_t teidPresent,
+ NW_IN uint8_t msgType,
+ NW_IN uint32_t teid,
+ NW_IN uint32_t seqNum,
NW_OUT NwGtpv2cMsgHandleT *phMsg);
@@ -253,8 +253,8 @@ nwGtpv2cMsgNew( NW_IN NwGtpv2cStackHandleT hGtpcStackHandle,
NwRcT
nwGtpv2cMsgFromBufferNew( NW_IN NwGtpv2cStackHandleT hGtpcStackHandle,
- NW_IN NwU8T* pBuf,
- NW_IN NwU32T bufLen,
+ NW_IN uint8_t* pBuf,
+ NW_IN uint32_t bufLen,
NW_OUT NwGtpv2cMsgHandleT *phMsg);
/**
@@ -276,7 +276,7 @@ nwGtpv2cMsgDelete( NW_IN NwGtpv2cStackHandleT hGtpcStackHandle,
*/
NwRcT
-nwGtpv2cMsgSetTeid(NW_IN NwGtpv2cMsgHandleT hMsg, NwU32T teid);
+nwGtpv2cMsgSetTeid(NW_IN NwGtpv2cMsgHandleT hMsg, uint32_t teid);
/**
* Set TEID present flag for gtpv2c message.
@@ -296,7 +296,7 @@ nwGtpv2cMsgSetTeidPresent(NW_IN NwGtpv2cMsgHandleT hMsg, NwBoolT teidPresent);
*/
NwRcT
-nwGtpv2cMsgSetSeqNumber(NW_IN NwGtpv2cMsgHandleT hMsg, NwU32T seqNum);
+nwGtpv2cMsgSetSeqNumber(NW_IN NwGtpv2cMsgHandleT hMsg, uint32_t seqNum);
/**
* Get TEID present for gtpv2c message.
@@ -304,7 +304,7 @@ nwGtpv2cMsgSetSeqNumber(NW_IN NwGtpv2cMsgHandleT hMsg, NwU32T seqNum);
* @param[in] hMsg : Message handle.
*/
-NwU32T
+uint32_t
nwGtpv2cMsgGetTeid(NW_IN NwGtpv2cMsgHandleT hMsg);
/**
@@ -322,7 +322,7 @@ nwGtpv2cMsgGetTeidPresent(NW_IN NwGtpv2cMsgHandleT hMsg);
* @param[in] hMsg : Message handle.
*/
-NwU32T
+uint32_t
nwGtpv2cMsgGetSeqNumber(NW_IN NwGtpv2cMsgHandleT hMsg);
/**
@@ -331,7 +331,7 @@ nwGtpv2cMsgGetSeqNumber(NW_IN NwGtpv2cMsgHandleT hMsg);
* @param[in] hMsg : Message handle.
*/
-NwU32T
+uint32_t
nwGtpv2cMsgGetLength(NW_IN NwGtpv2cMsgHandleT hMsg);
/**
@@ -345,9 +345,9 @@ nwGtpv2cMsgGetLength(NW_IN NwGtpv2cMsgHandleT hMsg);
NwRcT
nwGtpv2cMsgAddIeTV1(NW_IN NwGtpv2cMsgHandleT hMsg,
- NW_IN NwU8T type,
- NW_IN NwU8T instance,
- NW_IN NwU8T value);
+ NW_IN uint8_t type,
+ NW_IN uint8_t instance,
+ NW_IN uint8_t value);
/**
@@ -361,9 +361,9 @@ nwGtpv2cMsgAddIeTV1(NW_IN NwGtpv2cMsgHandleT hMsg,
NwRcT
nwGtpv2cMsgAddIeTV2(NW_IN NwGtpv2cMsgHandleT hMsg,
- NW_IN NwU8T type,
- NW_IN NwU8T instance,
- NW_IN NwU16T value);
+ NW_IN uint8_t type,
+ NW_IN uint8_t instance,
+ NW_IN uint16_t value);
/**
@@ -377,9 +377,9 @@ nwGtpv2cMsgAddIeTV2(NW_IN NwGtpv2cMsgHandleT hMsg,
NwRcT
nwGtpv2cMsgAddIeTV4(NW_IN NwGtpv2cMsgHandleT hMsg,
- NW_IN NwU8T type,
- NW_IN NwU8T instance,
- NW_IN NwU32T value);
+ NW_IN uint8_t type,
+ NW_IN uint8_t instance,
+ NW_IN uint32_t value);
/**
@@ -394,10 +394,10 @@ nwGtpv2cMsgAddIeTV4(NW_IN NwGtpv2cMsgHandleT hMsg,
NwRcT
nwGtpv2cMsgAddIe(NW_IN NwGtpv2cMsgHandleT hMsg,
- NW_IN NwU8T type,
- NW_IN NwU16T length,
- NW_IN NwU8T instance,
- NW_IN NwU8T* pVal);
+ NW_IN uint8_t type,
+ NW_IN uint16_t length,
+ NW_IN uint8_t instance,
+ NW_IN uint8_t* pVal);
/**
* Add CAUSE information element to gtpv2c message.
@@ -412,11 +412,11 @@ nwGtpv2cMsgAddIe(NW_IN NwGtpv2cMsgHandleT hMsg,
NwRcT
nwGtpv2cMsgAddIeCause(NW_IN NwGtpv2cMsgHandleT hMsg,
- NW_IN NwU8T instance,
- NW_IN NwU8T causeValue,
- NW_IN NwU8T bitFlags,
- NW_IN NwU8T offendingIeType,
- NW_IN NwU8T offendingIeInstance);
+ NW_IN uint8_t instance,
+ NW_IN uint8_t causeValue,
+ NW_IN uint8_t bitFlags,
+ NW_IN uint8_t offendingIeType,
+ NW_IN uint8_t offendingIeInstance);
/**
* Add F-TEID information element to gtpv2c message.
@@ -431,16 +431,16 @@ nwGtpv2cMsgAddIeCause(NW_IN NwGtpv2cMsgHandleT hMsg,
NwRcT
nwGtpv2cMsgAddIeFteid(NW_IN NwGtpv2cMsgHandleT hMsg,
- NW_IN NwU8T instance,
- NW_IN NwU8T ifType,
- NW_IN NwU32T teidOrGreKey,
- NW_IN NwU32T ipv4Addr,
- NW_IN NwU8T* pIpv6Addr);
+ NW_IN uint8_t instance,
+ NW_IN uint8_t ifType,
+ NW_IN uint32_t teidOrGreKey,
+ NW_IN uint32_t ipv4Addr,
+ NW_IN uint8_t* pIpv6Addr);
NwRcT
nwGtpv2cMsgGroupedIeStart(NW_IN NwGtpv2cMsgHandleT hMsg,
- NW_IN NwU8T type,
- NW_IN NwU8T instance);
+ NW_IN uint8_t type,
+ NW_IN uint8_t instance);
NwRcT
nwGtpv2cMsgGroupedIeEnd(NW_IN NwGtpv2cMsgHandleT hMsg);
@@ -458,11 +458,11 @@ nwGtpv2cMsgGroupedIeEnd(NW_IN NwGtpv2cMsgHandleT hMsg);
NwBoolT
nwGtpv2cMsgIsIePresent(NW_IN NwGtpv2cMsgHandleT hMsg,
- NW_IN NwU8T type,
- NW_IN NwU8T instance);
+ NW_IN uint8_t type,
+ NW_IN uint8_t instance);
/**
- * Get an information element of type 'NwU8T' from gtpv2c message.
+ * Get an information element of type 'uint8_t' from gtpv2c message.
*
* @param[in] hMsg : Handle to gtpv2c message.
* @param[in] type : IE Type.
@@ -473,12 +473,12 @@ nwGtpv2cMsgIsIePresent(NW_IN NwGtpv2cMsgHandleT hMsg,
NwRcT
nwGtpv2cMsgGetIeTV1(NW_IN NwGtpv2cMsgHandleT hMsg,
- NW_IN NwU8T type,
- NW_IN NwU8T instance,
- NW_OUT NwU8T* pVal);
+ NW_IN uint8_t type,
+ NW_IN uint8_t instance,
+ NW_OUT uint8_t* pVal);
/**
- * Get an information element of type 'NwU16T' from gtpv2c message.
+ * Get an information element of type 'uint16_t' from gtpv2c message.
*
* @param[in] hMsg : Handle to gtpv2c message.
* @param[in] tyep : IE Type.
@@ -490,12 +490,12 @@ nwGtpv2cMsgGetIeTV1(NW_IN NwGtpv2cMsgHandleT hMsg,
NwRcT
nwGtpv2cMsgGetIeTV2(NW_IN NwGtpv2cMsgHandleT hMsg,
- NW_IN NwU8T type,
- NW_IN NwU8T instance,
- NW_OUT NwU16T* pVal);
+ NW_IN uint8_t type,
+ NW_IN uint8_t instance,
+ NW_OUT uint16_t* pVal);
/**
- * Get an information element of type 'NwU32T' from gtpv2c message.
+ * Get an information element of type 'uint32_t' from gtpv2c message.
*
* @param[in] hMsg : Handle to gtpv2c message.
* @param[in] tyep : IE Type.
@@ -507,12 +507,12 @@ nwGtpv2cMsgGetIeTV2(NW_IN NwGtpv2cMsgHandleT hMsg,
NwRcT
nwGtpv2cMsgGetIeTV4(NW_IN NwGtpv2cMsgHandleT hMsg,
- NW_IN NwU8T type,
- NW_IN NwU8T instance,
- NW_OUT NwU32T* pVal);
+ NW_IN uint8_t type,
+ NW_IN uint8_t instance,
+ NW_OUT uint32_t* pVal);
/**
- * Get an information element of type 'NwU64T' from gtpv2c message.
+ * Get an information element of type 'uint64_t' from gtpv2c message.
*
* @param[in] hMsg : Handle to gtpv2c message.
* @param[in] tyep : IE Type.
@@ -524,9 +524,9 @@ nwGtpv2cMsgGetIeTV4(NW_IN NwGtpv2cMsgHandleT hMsg,
NwRcT
nwGtpv2cMsgGetIeTV8(NW_IN NwGtpv2cMsgHandleT hMsg,
- NW_IN NwU8T type,
- NW_IN NwU8T instance,
- NW_OUT NwU64T* pVal);
+ NW_IN uint8_t type,
+ NW_IN uint8_t instance,
+ NW_OUT uint64_t* pVal);
/**
* Get an information element of variable length from gtpv2c message.
@@ -542,11 +542,11 @@ nwGtpv2cMsgGetIeTV8(NW_IN NwGtpv2cMsgHandleT hMsg,
NwRcT
nwGtpv2cMsgGetIeTlv(NW_IN NwGtpv2cMsgHandleT hMsg,
- NW_IN NwU8T type,
- NW_IN NwU8T instance,
- NW_IN NwU16T maxLen,
- NW_OUT NwU8T* pVal,
- NW_OUT NwU16T* pLen);
+ NW_IN uint8_t type,
+ NW_IN uint8_t instance,
+ NW_IN uint16_t maxLen,
+ NW_OUT uint8_t* pVal,
+ NW_OUT uint16_t* pLen);
/**
* Get an information element of variable length from gtpv2c message.
@@ -561,10 +561,10 @@ nwGtpv2cMsgGetIeTlv(NW_IN NwGtpv2cMsgHandleT hMsg,
NwRcT
nwGtpv2cMsgGetIeTlvP(NW_IN NwGtpv2cMsgHandleT hMsg,
- NW_IN NwU8T type,
- NW_IN NwU8T instance,
- NW_OUT NwU8T** ppVal,
- NW_OUT NwU16T* pLen);
+ NW_IN uint8_t type,
+ NW_IN uint8_t instance,
+ NW_OUT uint8_t** ppVal,
+ NW_OUT uint16_t* pLen);
/**
@@ -580,19 +580,19 @@ nwGtpv2cMsgGetIeTlvP(NW_IN NwGtpv2cMsgHandleT hMsg,
NwRcT
nwGtpv2cMsgGetIeFteid(NW_IN NwGtpv2cMsgHandleT hMsg,
- NW_IN NwU8T instance,
- NW_OUT NwU8T* ifType,
- NW_OUT NwU32T* teidOrGreKey,
- NW_OUT NwU32T* ipv4Addr,
- NW_OUT NwU8T* pIpv6Addr);
+ NW_IN uint8_t instance,
+ NW_OUT uint8_t* ifType,
+ NW_OUT uint32_t* teidOrGreKey,
+ NW_OUT uint32_t* ipv4Addr,
+ NW_OUT uint8_t* pIpv6Addr);
NwRcT
nwGtpv2cMsgGetIeCause(NW_IN NwGtpv2cMsgHandleT hMsg,
- NW_IN NwU8T instance,
- NW_OUT NwU8T* causeValue,
- NW_OUT NwU8T* flags,
- NW_OUT NwU8T* offendingIeType,
- NW_OUT NwU8T* offendingIeInstance);
+ NW_IN uint8_t instance,
+ NW_OUT uint8_t* causeValue,
+ NW_OUT uint8_t* flags,
+ NW_OUT uint8_t* offendingIeType,
+ NW_OUT uint8_t* offendingIeInstance);
/**
* Get msg type for gtpv2c message.
@@ -600,7 +600,7 @@ nwGtpv2cMsgGetIeCause(NW_IN NwGtpv2cMsgHandleT hMsg,
* @param[in] hMsg : Message handle.
*/
-NwU32T
+uint32_t
nwGtpv2cMsgGetMsgType(NW_IN NwGtpv2cMsgHandleT hMsg);
/**
diff --git a/openair-cn/GTPV2-C/nwgtpv2c-0.11/shared/NwGtpv2cMsgParser.h b/openair-cn/GTPV2-C/nwgtpv2c-0.11/shared/NwGtpv2cMsgParser.h
index 968fbacaab..a16bf4800a 100644
--- a/openair-cn/GTPV2-C/nwgtpv2c-0.11/shared/NwGtpv2cMsgParser.h
+++ b/openair-cn/GTPV2-C/nwgtpv2c-0.11/shared/NwGtpv2cMsgParser.h
@@ -45,19 +45,19 @@
*/
typedef struct {
- NwU16T msgType;
- NwU16T mandatoryIeCount;
+ uint16_t msgType;
+ uint16_t mandatoryIeCount;
NwGtpv2cStackHandleT hStack;
- NwRcT (*ieReadCallback) (NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T* ieValue, void* ieReadCallbackArg);
+ NwRcT (*ieReadCallback) (uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t* ieValue, void* ieReadCallbackArg);
void* ieReadCallbackArg;
struct {
- NwU8T iePresence;
- NwRcT (*ieReadCallback) (NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T* ieValue, void* ieReadCallbackArg);
+ uint8_t iePresence;
+ NwRcT (*ieReadCallback) (uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t* ieValue, void* ieReadCallbackArg);
void* ieReadCallbackArg;
} ieParseInfo[NW_GTPV2C_IE_TYPE_MAXIMUM][NW_GTPV2C_IE_INSTANCE_MAXIMUM];
- NwU8T *pIe[NW_GTPV2C_IE_TYPE_MAXIMUM][NW_GTPV2C_IE_INSTANCE_MAXIMUM];
+ uint8_t *pIe[NW_GTPV2C_IE_TYPE_MAXIMUM][NW_GTPV2C_IE_INSTANCE_MAXIMUM];
} NwGtpv2cMsgParserT;
#ifdef __cplusplus
@@ -74,11 +74,11 @@ extern "C" {
NwRcT
nwGtpv2cMsgParserNew( NW_IN NwGtpv2cStackHandleT hGtpcStackHandle,
- NW_IN NwU8T msgType,
- NW_IN NwRcT (*ieReadCallback) (NwU8T ieType,
- NwU8T ieLength,
- NwU8T ieInstance,
- NwU8T* ieValue,
+ NW_IN uint8_t msgType,
+ NW_IN NwRcT (*ieReadCallback) (uint8_t ieType,
+ uint8_t ieLength,
+ uint8_t ieInstance,
+ uint8_t* ieValue,
void* ieReadCallbackArg),
NW_IN void* ieReadCallbackArg,
NW_IN NwGtpv2cMsgParserT **pthiz);
@@ -97,23 +97,23 @@ nwGtpv2cMsgParserDelete( NW_IN NwGtpv2cStackHandleT hGtpcStackHandle,
NwRcT
nwGtpv2cMsgParserUpdateIe( NW_IN NwGtpv2cMsgParserT* thiz,
- NW_IN NwU8T ieType,
- NW_IN NwU8T ieInstance,
- NW_IN NwU8T iePresence,
- NW_IN NwRcT (*ieReadCallback) (NwU8T ieType,
- NwU8T ieLength,
- NwU8T ieInstance,
- NwU8T* ieValue,
+ NW_IN uint8_t ieType,
+ NW_IN uint8_t ieInstance,
+ NW_IN uint8_t iePresence,
+ NW_IN NwRcT (*ieReadCallback) (uint8_t ieType,
+ uint8_t ieLength,
+ uint8_t ieInstance,
+ uint8_t* ieValue,
void* ieReadCallbackArg),
NW_IN void* ieReadCallbackArg);
NwRcT
nwGtpv2cMsgParserUpdateIeReadCallback( NW_IN NwGtpv2cMsgParserT* thiz,
- NW_IN NwRcT (*ieReadCallback) (NwU8T ieType,
- NwU8T ieLength,
- NwU8T ieInstance,
- NwU8T* ieValue,
+ NW_IN NwRcT (*ieReadCallback) (uint8_t ieType,
+ uint8_t ieLength,
+ uint8_t ieInstance,
+ uint8_t* ieValue,
void* ieReadCallbackArg));
@@ -123,22 +123,22 @@ nwGtpv2cMsgParserUpdateIeReadCallbackArg( NW_IN NwGtpv2cMsgParserT* thiz,
NwRcT
nwGtpv2cMsgParserAddIe( NW_IN NwGtpv2cMsgParserT* thiz,
- NW_IN NwU8T ieType,
- NW_IN NwU8T ieInstance,
- NW_IN NwU8T iePresence,
- NW_IN NwRcT (*ieReadCallback) (NwU8T ieType,
- NwU8T ieLength,
- NwU8T ieInstance,
- NwU8T* ieValue,
+ NW_IN uint8_t ieType,
+ NW_IN uint8_t ieInstance,
+ NW_IN uint8_t iePresence,
+ NW_IN NwRcT (*ieReadCallback) (uint8_t ieType,
+ uint8_t ieLength,
+ uint8_t ieInstance,
+ uint8_t* ieValue,
void* ieReadCallbackArg),
NW_IN void* ieReadCallbackArg);
NwRcT
nwGtpv2cMsgParserRun( NW_IN NwGtpv2cMsgParserT *thiz,
NW_IN NwGtpv2cMsgHandleT hMsg,
- NW_OUT NwU8T *pOffendingIeType,
- NW_OUT NwU8T *pOffendingIeInstance,
- NW_OUT NwU16T *pOffendingIeLength);
+ NW_OUT uint8_t *pOffendingIeType,
+ NW_OUT uint8_t *pOffendingIeInstance,
+ NW_OUT uint16_t *pOffendingIeLength);
#ifdef __cplusplus
}
diff --git a/openair-cn/GTPV2-C/nwgtpv2c-0.11/shared/NwLog.h b/openair-cn/GTPV2-C/nwgtpv2c-0.11/shared/NwLog.h
index 9456540d0c..a941a31905 100644
--- a/openair-cn/GTPV2-C/nwgtpv2c-0.11/shared/NwLog.h
+++ b/openair-cn/GTPV2-C/nwgtpv2c-0.11/shared/NwLog.h
@@ -66,15 +66,15 @@ extern "C" {
*--------------------------------------------------------------------------*/
#define NW_IPV4_ADDR "%u.%u.%u.%u"
-#define NW_IPV4_ADDR_FORMAT(__addr) (NwU8T)((__addr) & 0x000000ff), \
- (NwU8T)(((__addr) & 0x0000ff00) >> 8 ), \
- (NwU8T)(((__addr) & 0x00ff0000) >> 16), \
- (NwU8T)(((__addr) & 0xff000000) >> 24)
+#define NW_IPV4_ADDR_FORMAT(__addr) (uint8_t)((__addr) & 0x000000ff), \
+ (uint8_t)(((__addr) & 0x0000ff00) >> 8 ), \
+ (uint8_t)(((__addr) & 0x00ff0000) >> 16), \
+ (uint8_t)(((__addr) & 0xff000000) >> 24)
-#define NW_IPV4_ADDR_FORMATP(__paddr) (NwU8T)(*((NwU8T*)(__paddr)) & 0x000000ff), \
- (NwU8T)(*((NwU8T*)(__paddr + 1)) & 0x000000ff), \
- (NwU8T)(*((NwU8T*)(__paddr + 2)) & 0x000000ff), \
- (NwU8T)(*((NwU8T*)(__paddr + 3)) & 0x000000ff)
+#define NW_IPV4_ADDR_FORMATP(__paddr) (uint8_t)(*((uint8_t*)(__paddr)) & 0x000000ff), \
+ (uint8_t)(*((uint8_t*)(__paddr + 1)) & 0x000000ff), \
+ (uint8_t)(*((uint8_t*)(__paddr + 2)) & 0x000000ff), \
+ (uint8_t)(*((uint8_t*)(__paddr + 3)) & 0x000000ff)
#ifdef __cplusplus
}
diff --git a/openair-cn/GTPV2-C/nwgtpv2c-0.11/shared/NwTypes.h b/openair-cn/GTPV2-C/nwgtpv2c-0.11/shared/NwTypes.h
index 949d528e74..78be53a5d0 100644
--- a/openair-cn/GTPV2-C/nwgtpv2c-0.11/shared/NwTypes.h
+++ b/openair-cn/GTPV2-C/nwgtpv2c-0.11/shared/NwTypes.h
@@ -54,10 +54,10 @@ extern "C" {
#define NW_TRUE (1) /**< Truth value */
#define NW_FALSE (0) /**< False value */
-typedef unsigned char NwU8T; /**< Unsigned 1 byte */
-typedef unsigned short NwU16T; /**< Unsigned 2 byte */
-typedef unsigned int NwU32T; /**< Unsigned 4 byte */
-typedef unsigned long long NwU64T; /**< Unsigned 8 byte */
+typedef unsigned char uint8_t; /**< Unsigned 1 byte */
+typedef unsigned short uint16_t; /**< Unsigned 2 byte */
+typedef unsigned int uint32_t; /**< Unsigned 4 byte */
+typedef unsigned long long uint64_t; /**< Unsigned 8 byte */
typedef signed char NwS8T; /**< Signed 1 byte */
typedef signed short NwS16T; /**< Signed 2 byte */
diff --git a/openair-cn/GTPV2-C/nwgtpv2c-0.11/shared/NwUtils.h b/openair-cn/GTPV2-C/nwgtpv2c-0.11/shared/NwUtils.h
index 7d57f63139..a51437bce8 100644
--- a/openair-cn/GTPV2-C/nwgtpv2c-0.11/shared/NwUtils.h
+++ b/openair-cn/GTPV2-C/nwgtpv2c-0.11/shared/NwUtils.h
@@ -52,10 +52,10 @@
( ( (x) & 0x0000ff00 ) << 8 ) | ( ( (x) & 0x000000ff) << 24 ) )
#define NW_HTONLL(x) ( \
- ( ( ((NwU64T)x) & 0xff00000000000000ULL ) >> 56 ) | ( ( ((NwU64T)x) & 0x00ff000000000000ULL ) >> 40 ) | \
- ( ( ((NwU64T)x) & 0x0000ff0000000000ULL ) >> 24 ) | ( ( ((NwU64T)x) & 0x000000ff00000000ULL ) >> 8 ) | \
- ( ( ((NwU64T)x) & 0x000000000000ff00ULL ) << 40 ) | ( ( ((NwU64T)x) & 0x00000000000000ffULL ) << 56 ) | \
- ( ( ((NwU64T)x) & 0x0000000000ff0000ULL ) << 24 ) | ( ( ((NwU64T)x) & 0x00000000ff000000ULL ) << 8 ) \
+ ( ( ((uint64_t)x) & 0xff00000000000000ULL ) >> 56 ) | ( ( ((uint64_t)x) & 0x00ff000000000000ULL ) >> 40 ) | \
+ ( ( ((uint64_t)x) & 0x0000ff0000000000ULL ) >> 24 ) | ( ( ((uint64_t)x) & 0x000000ff00000000ULL ) >> 8 ) | \
+ ( ( ((uint64_t)x) & 0x000000000000ff00ULL ) << 40 ) | ( ( ((uint64_t)x) & 0x00000000000000ffULL ) << 56 ) | \
+ ( ( ((uint64_t)x) & 0x0000000000ff0000ULL ) << 24 ) | ( ( ((uint64_t)x) & 0x00000000ff000000ULL ) << 8 ) \
)
diff --git a/openair-cn/GTPV2-C/nwgtpv2c-0.11/src/NwGtpv2c.c b/openair-cn/GTPV2-C/nwgtpv2c-0.11/src/NwGtpv2c.c
index cd50e81738..123fe0932a 100644
--- a/openair-cn/GTPV2-C/nwgtpv2c-0.11/src/NwGtpv2c.c
+++ b/openair-cn/GTPV2-C/nwgtpv2c-0.11/src/NwGtpv2c.c
@@ -393,13 +393,13 @@ RB_GENERATE(NwGtpv2cActiveTimerList, NwGtpv2cTimeoutInfo, activeTimerListRbtNode
*/
static NwRcT
nwGtpv2cCreateAndSendMsg(NW_IN NwGtpv2cStackT* thiz,
- NW_IN NwU32T seqNum,
- NW_IN NwU32T peerIp,
- NW_IN NwU32T peerPort,
+ NW_IN uint32_t seqNum,
+ NW_IN uint32_t peerIp,
+ NW_IN uint32_t peerPort,
NW_IN NwGtpv2cMsgT *pMsg)
{
NwRcT rc;
- NwU8T* msgHdr;
+ uint8_t* msgHdr;
NW_ASSERT(thiz);
NW_ASSERT(pMsg);
@@ -413,17 +413,17 @@ nwGtpv2cCreateAndSendMsg(NW_IN NwGtpv2cStackT* thiz,
*(msgHdr++) = (pMsg->msgType);
/* Set msg length in header*/
- *((NwU16T*) msgHdr) = htons(pMsg->msgLen - 4 );
+ *((uint16_t*) msgHdr) = htons(pMsg->msgLen - 4 );
msgHdr += 2;
/* Set TEID, if present in header */
if(pMsg->teidPresent) {
- *((NwU32T*) msgHdr) = htonl(pMsg->teid);
+ *((uint32_t*) msgHdr) = htonl(pMsg->teid);
msgHdr += 4;
}
/* Set seq num in header */
- *((NwU32T*) msgHdr) = htonl(seqNum << 8);
+ *((uint32_t*) msgHdr) = htonl(seqNum << 8);
/* Call UDP data request callback */
NW_ASSERT(thiz->udp.udpDataReqCallback != NULL);
@@ -446,9 +446,9 @@ nwGtpv2cCreateAndSendMsg(NW_IN NwGtpv2cStackT* thiz,
static NwRcT
nwGtpv2cSendVersionNotSupportedInd( NW_IN NwGtpv2cStackT* thiz,
- NW_IN NwU32T peerIp,
- NW_IN NwU32T peerPort,
- NW_IN NwU32T seqNum)
+ NW_IN uint32_t peerIp,
+ NW_IN uint32_t peerPort,
+ NW_IN uint32_t seqNum)
{
NwRcT rc;
NwGtpv2cMsgHandleT hMsg = 0;
@@ -485,8 +485,8 @@ nwGtpv2cSendVersionNotSupportedInd( NW_IN NwGtpv2cStackT* thiz,
static NwRcT
nwGtpv2cCreateLocalTunnel( NW_IN NwGtpv2cStackT* thiz,
- NW_IN NwU32T teid,
- NW_IN NwU32T ipv4Remote,
+ NW_IN uint32_t teid,
+ NW_IN uint32_t ipv4Remote,
NW_IN NwGtpv2cUlpTunnelHandleT hUlpTunnel,
NW_OUT NwGtpv2cTunnelHandleT *phTunnel)
{
@@ -798,10 +798,10 @@ static NwRcT
nwGtpv2cSendInitialReqIndToUlp( NW_IN NwGtpv2cStackT *thiz,
NW_IN NwGtpv2cErrorT *pError,
NW_IN NwGtpv2cTrxnT *pTrxn,
- NW_IN NwU32T hUlpTunnel,
- NW_IN NwU32T msgType,
- NW_IN NwU32T peerIp,
- NW_IN NwU16T peerPort,
+ NW_IN uint32_t hUlpTunnel,
+ NW_IN uint32_t msgType,
+ NW_IN uint32_t peerIp,
+ NW_IN uint16_t peerPort,
NW_IN NwGtpv2cMsgHandleT hMsg)
{
NwRcT rc;
@@ -836,9 +836,9 @@ nwGtpv2cSendInitialReqIndToUlp( NW_IN NwGtpv2cStackT *thiz,
static NwRcT
nwGtpv2cSendTriggeredRspIndToUlp( NW_IN NwGtpv2cStackT* thiz,
NW_IN NwGtpv2cErrorT *pError,
- NW_IN NwU32T hUlpTrxn,
- NW_IN NwU32T hUlpTunnel,
- NW_IN NwU32T msgType,
+ NW_IN uint32_t hUlpTrxn,
+ NW_IN uint32_t hUlpTunnel,
+ NW_IN uint32_t msgType,
NW_IN NwGtpv2cMsgHandleT hMsg)
{
NwRcT rc;
@@ -870,17 +870,17 @@ nwGtpv2cSendTriggeredRspIndToUlp( NW_IN NwGtpv2cStackT* thiz,
static NwRcT
nwGtpv2cHandleEchoReq(NW_IN NwGtpv2cStackT *thiz,
- NW_IN NwU32T msgType,
- NW_IN NwU8T* msgBuf,
- NW_IN NwU32T msgBufLen,
- NW_IN NwU16T peerPort,
- NW_IN NwU32T peerIp)
+ NW_IN uint32_t msgType,
+ NW_IN uint8_t* msgBuf,
+ NW_IN uint32_t msgBufLen,
+ NW_IN uint16_t peerPort,
+ NW_IN uint32_t peerIp)
{
NwRcT rc;
- NwU32T seqNum = 0;
+ uint32_t seqNum = 0;
NwGtpv2cMsgHandleT hMsg = 0;
- seqNum = ntohl(*((NwU32T*)(msgBuf + (((*msgBuf) & 0x08) ? 8 : 4)))) >> 8;
+ seqNum = ntohl(*((uint32_t*)(msgBuf + (((*msgBuf) & 0x08) ? 8 : 4)))) >> 8;
/* Send Echo Response */
@@ -918,22 +918,22 @@ nwGtpv2cHandleEchoReq(NW_IN NwGtpv2cStackT *thiz,
static NwRcT
nwGtpv2cHandleInitialReq(NW_IN NwGtpv2cStackT *thiz,
- NW_IN NwU32T msgType,
- NW_IN NwU8T* msgBuf,
- NW_IN NwU32T msgBufLen,
- NW_IN NwU16T peerPort,
- NW_IN NwU32T peerIp)
+ NW_IN uint32_t msgType,
+ NW_IN uint8_t* msgBuf,
+ NW_IN uint32_t msgBufLen,
+ NW_IN uint16_t peerPort,
+ NW_IN uint32_t peerIp)
{
NwRcT rc;
- NwU32T seqNum = 0;
- NwU32T teidLocal = 0;
+ uint32_t seqNum = 0;
+ uint32_t teidLocal = 0;
NwGtpv2cTrxnT *pTrxn;
NwGtpv2cTunnelT *pLocalTunnel, keyTunnel;
NwGtpv2cMsgHandleT hMsg = 0;
NwGtpv2cUlpTunnelHandleT hUlpTunnel;
NwGtpv2cErrorT error;
- teidLocal = *((NwU32T*)(msgBuf + 4));
+ teidLocal = *((uint32_t*)(msgBuf + 4));
if(teidLocal) {
keyTunnel.teid = ntohl(teidLocal);
@@ -950,7 +950,7 @@ nwGtpv2cHandleInitialReq(NW_IN NwGtpv2cStackT *thiz,
hUlpTunnel = 0;
}
- seqNum = ntohl(*((NwU32T*)(msgBuf + (((*msgBuf) & 0x08) ? 8 : 4)))) >> 8;
+ seqNum = ntohl(*((uint32_t*)(msgBuf + (((*msgBuf) & 0x08) ? 8 : 4)))) >> 8;
pTrxn = nwGtpv2cTrxnOutstandingRxNew(thiz, ntohl(teidLocal), peerIp, peerPort, (seqNum));
if(pTrxn) {
@@ -987,25 +987,25 @@ nwGtpv2cHandleInitialReq(NW_IN NwGtpv2cStackT *thiz,
static NwRcT
nwGtpv2cHandleTriggeredRsp(NW_IN NwGtpv2cStackT *thiz,
- NW_IN NwU32T msgType,
- NW_IN NwU8T* msgBuf,
- NW_IN NwU32T msgBufLen,
- NW_IN NwU16T peerPort,
- NW_IN NwU32T peerIp)
+ NW_IN uint32_t msgType,
+ NW_IN uint8_t* msgBuf,
+ NW_IN uint32_t msgBufLen,
+ NW_IN uint16_t peerPort,
+ NW_IN uint32_t peerIp)
{
NwRcT rc;
NwGtpv2cTrxnT *pTrxn, keyTrxn;
NwGtpv2cMsgHandleT hMsg = 0;
NwGtpv2cErrorT error;
- keyTrxn.seqNum = ntohl(*((NwU32T*)(msgBuf + (((*msgBuf) & 0x08) ? 8 : 4)))) >> 8;;
+ keyTrxn.seqNum = ntohl(*((uint32_t*)(msgBuf + (((*msgBuf) & 0x08) ? 8 : 4)))) >> 8;;
keyTrxn.peerIp = peerIp;
pTrxn = RB_FIND(NwGtpv2cOutstandingTxSeqNumTrxnMap, &(thiz->outstandingTxSeqNumMap), &keyTrxn);
if(pTrxn) {
- NwU32T hUlpTrxn;
- NwU32T hUlpTunnel;
+ uint32_t hUlpTrxn;
+ uint32_t hUlpTunnel;
hUlpTrxn = pTrxn->hUlpTrxn;
hUlpTunnel = (pTrxn->hTunnel ? ((NwGtpv2cTunnelT*)(pTrxn->hTunnel))->hUlpTunnel : 0);
@@ -1021,7 +1021,7 @@ nwGtpv2cHandleTriggeredRsp(NW_IN NwGtpv2cStackT *thiz,
rc = nwGtpv2cMsgIeParse(thiz->pGtpv2cMsgIeParseInfo[msgType], hMsg, &error);
if(rc != NW_OK) {
- NW_LOG(thiz, NW_LOG_LEVEL_WARN, "Malformed message received on TEID %u from peer 0x%x. Notifying ULP.", ntohl((*((NwU32T*)(msgBuf + 4)))), htonl(peerIp));
+ NW_LOG(thiz, NW_LOG_LEVEL_WARN, "Malformed message received on TEID %u from peer 0x%x. Notifying ULP.", ntohl((*((uint32_t*)(msgBuf + 4)))), htonl(peerIp));
}
rc = nwGtpv2cSendTriggeredRspIndToUlp( thiz,
@@ -1057,8 +1057,8 @@ nwGtpv2cInitialize( NW_INOUT NwGtpv2cStackHandleT* hGtpcStackHandle)
memset(thiz, 0, sizeof(NwGtpv2cStackT));
if(thiz) {
- thiz->id = (NwU32T) thiz;
- thiz->seqNum = ((NwU32T) thiz) & 0x0000FFFF;
+ thiz->id = (uint32_t) thiz;
+ thiz->seqNum = ((uint32_t) thiz) & 0x0000FFFF;
RB_INIT(&(thiz->tunnelMap));
RB_INIT(&(thiz->outstandingTxSeqNumMap));
@@ -1205,7 +1205,7 @@ nwGtpv2cSetLogMgrEntity( NW_IN NwGtpv2cStackHandleT hGtpcStackHandle,
NwRcT
nwGtpv2cSetLogLevel( NW_IN NwGtpv2cStackHandleT hGtpcStackHandle,
- NW_IN NwU32T logLevel)
+ NW_IN uint32_t logLevel)
{
NwGtpv2cStackT* thiz = (NwGtpv2cStackT*) hGtpcStackHandle;
thiz->logLevel = logLevel;
@@ -1218,14 +1218,14 @@ nwGtpv2cSetLogLevel( NW_IN NwGtpv2cStackHandleT hGtpcStackHandle,
NwRcT
nwGtpv2cProcessUdpReq( NW_IN NwGtpv2cStackHandleT hGtpcStackHandle,
- NW_IN NwU8T* udpData,
- NW_IN NwU32T udpDataLen,
- NW_IN NwU16T peerPort,
- NW_IN NwU32T peerIp)
+ NW_IN uint8_t* udpData,
+ NW_IN uint32_t udpDataLen,
+ NW_IN uint16_t peerPort,
+ NW_IN uint32_t peerIp)
{
NwRcT rc;
NwGtpv2cStackT* thiz;
- NwU16T msgType;
+ uint16_t msgType;
thiz = (NwGtpv2cStackT*) hGtpcStackHandle;
NW_ASSERT(thiz);
@@ -1243,26 +1243,26 @@ nwGtpv2cProcessUdpReq( NW_IN NwGtpv2cStackHandleT hGtpcStackHandle,
return NW_OK;
}
- if( (ntohs(*((NwU16T*)((NwU8T*)udpData + 2))) /* Length */
- + ((*((NwU8T*)(udpData)) & 0x08) ? 4 : 0) /* Extra Header length if TEID present */) > udpDataLen) {
+ if( (ntohs(*((uint16_t*)((uint8_t*)udpData + 2))) /* Length */
+ + ((*((uint8_t*)(udpData)) & 0x08) ? 4 : 0) /* Extra Header length if TEID present */) > udpDataLen) {
NW_LOG(thiz, NW_LOG_LEVEL_WARN, "Received message with errneous length of %u against expected length of %u! Discarding", udpDataLen,
- ntohs(*((NwU16T*)((NwU8T*)udpData + 2))) + ((*((NwU8T*)(udpData)) & 0x08) ? 4 : 0));
+ ntohs(*((uint16_t*)((uint8_t*)udpData + 2))) + ((*((uint8_t*)(udpData)) & 0x08) ? 4 : 0));
return NW_OK;
}
- if(((*((NwU8T*)(udpData)) & 0xE0) >> 5) != NW_GTP_VERSION) {
- NW_LOG(thiz, NW_LOG_LEVEL_WARN, "Received unsupported GTP version '%u' message! Discarding.", ((*((NwU8T*)(udpData)) & 0xE0) >> 5));
+ if(((*((uint8_t*)(udpData)) & 0xE0) >> 5) != NW_GTP_VERSION) {
+ NW_LOG(thiz, NW_LOG_LEVEL_WARN, "Received unsupported GTP version '%u' message! Discarding.", ((*((uint8_t*)(udpData)) & 0xE0) >> 5));
/* Send Version Not Supported Message to peer */
rc = nwGtpv2cSendVersionNotSupportedInd(
thiz,
peerIp,
peerPort,
- *((NwU32T*)(udpData + ((*((NwU8T*)(udpData)) & 0x08) ? 8 : 4))) /* Seq Num */);
+ *((uint32_t*)(udpData + ((*((uint8_t*)(udpData)) & 0x08) ? 8 : 4))) /* Seq Num */);
return NW_OK;
}
- msgType = *((NwU8T*)(udpData + 1));
+ msgType = *((uint8_t*)(udpData + 1));
switch(msgType) {
case NW_GTP_ECHO_REQ: {
@@ -1520,9 +1520,9 @@ nwGtpv2cProcessTimeout(void* arg)
NwRcT
nwGtpv2cStartTimer(NwGtpv2cStackT* thiz,
- NwU32T timeoutSec,
- NwU32T timeoutUsec,
- NwU32T tmrType,
+ uint32_t timeoutSec,
+ uint32_t timeoutUsec,
+ uint32_t tmrType,
NwRcT (*timeoutCallbackFunc)(void*),
void* timeoutCallbackArg,
NwGtpv2cTimerHandleT *phTimer)
@@ -1610,9 +1610,9 @@ nwGtpv2cStartTimer(NwGtpv2cStackT* thiz,
NwRcT
nwGtpv2cStartTimerOld(NwGtpv2cStackT* thiz,
- NwU32T timeoutSec,
- NwU32T timeoutUsec,
- NwU32T tmrType,
+ uint32_t timeoutSec,
+ uint32_t timeoutUsec,
+ uint32_t tmrType,
NwRcT (*timeoutCallbackFunc)(void*),
void* timeoutCallbackArg,
NwGtpv2cTimerHandleT *phTimer)
diff --git a/openair-cn/GTPV2-C/nwgtpv2c-0.11/src/NwGtpv2cMsg.c b/openair-cn/GTPV2-C/nwgtpv2c-0.11/src/NwGtpv2cMsg.c
index 044b5f7b06..e566a08594 100644
--- a/openair-cn/GTPV2-C/nwgtpv2c-0.11/src/NwGtpv2cMsg.c
+++ b/openair-cn/GTPV2-C/nwgtpv2c-0.11/src/NwGtpv2cMsg.c
@@ -62,10 +62,10 @@ static NwGtpv2cMsgT* gpGtpv2cMsgPool = NULL;
NwRcT
nwGtpv2cMsgNew( NW_IN NwGtpv2cStackHandleT hGtpcStackHandle,
- NW_IN NwU8T teidPresent,
- NW_IN NwU8T msgType,
- NW_IN NwU32T teid,
- NW_IN NwU32T seqNum,
+ NW_IN uint8_t teidPresent,
+ NW_IN uint8_t msgType,
+ NW_IN uint32_t teid,
+ NW_IN uint32_t seqNum,
NW_OUT NwGtpv2cMsgHandleT *phMsg)
{
NwGtpv2cStackT* pStack = (NwGtpv2cStackT*) hGtpcStackHandle;
@@ -101,8 +101,8 @@ nwGtpv2cMsgNew( NW_IN NwGtpv2cStackHandleT hGtpcStackHandle,
NwRcT
nwGtpv2cMsgFromBufferNew( NW_IN NwGtpv2cStackHandleT hGtpcStackHandle,
- NW_IN NwU8T* pBuf,
- NW_IN NwU32T bufLen,
+ NW_IN uint8_t* pBuf,
+ NW_IN uint32_t bufLen,
NW_OUT NwGtpv2cMsgHandleT *phMsg)
{
NwGtpv2cStackT* pStack = (NwGtpv2cStackT*) hGtpcStackHandle;
@@ -130,11 +130,11 @@ nwGtpv2cMsgFromBufferNew( NW_IN NwGtpv2cStackHandleT hGtpcStackHandle,
pBuf += 3;
if(pMsg->teidPresent) {
- pMsg->teid = ntohl(*((NwU32T*)(pBuf)));
+ pMsg->teid = ntohl(*((uint32_t*)(pBuf)));
pBuf += 4;
}
- memcpy(((NwU8T*)&pMsg->seqNum) + 1, pBuf, 3);
+ memcpy(((uint8_t*)&pMsg->seqNum) + 1, pBuf, 3);
pMsg->seqNum = ntohl(pMsg->seqNum);
pMsg->hStack = hGtpcStackHandle;
@@ -166,7 +166,7 @@ nwGtpv2cMsgDelete( NW_IN NwGtpv2cStackHandleT hGtpcStackHandle,
*/
NwRcT
-nwGtpv2cMsgSetTeid(NW_IN NwGtpv2cMsgHandleT hMsg, NwU32T teid)
+nwGtpv2cMsgSetTeid(NW_IN NwGtpv2cMsgHandleT hMsg, uint32_t teid)
{
NwGtpv2cMsgT *thiz = (NwGtpv2cMsgT*) hMsg;
thiz->teid = teid;
@@ -196,7 +196,7 @@ nwGtpv2cMsgSetTeidPresent(NW_IN NwGtpv2cMsgHandleT hMsg, NwBoolT teidPresent)
*/
NwRcT
-nwGtpv2cMsgSetSeqNumber(NW_IN NwGtpv2cMsgHandleT hMsg, NwU32T seqNum)
+nwGtpv2cMsgSetSeqNumber(NW_IN NwGtpv2cMsgHandleT hMsg, uint32_t seqNum)
{
NwGtpv2cMsgT *thiz = (NwGtpv2cMsgT*) hMsg;
thiz->seqNum = seqNum;
@@ -209,7 +209,7 @@ nwGtpv2cMsgSetSeqNumber(NW_IN NwGtpv2cMsgHandleT hMsg, NwU32T seqNum)
* @param[in] hMsg : Message handle.
*/
-NwU32T
+uint32_t
nwGtpv2cMsgGetTeid(NW_IN NwGtpv2cMsgHandleT hMsg)
{
NwGtpv2cMsgT *thiz = (NwGtpv2cMsgT*) hMsg;
@@ -235,7 +235,7 @@ nwGtpv2cMsgGetTeidPresent(NW_IN NwGtpv2cMsgHandleT hMsg)
* @param[in] hMsg : Message handle.
*/
-NwU32T
+uint32_t
nwGtpv2cMsgGetSeqNumber(NW_IN NwGtpv2cMsgHandleT hMsg)
{
NwGtpv2cMsgT *thiz = (NwGtpv2cMsgT*) hMsg;
@@ -248,7 +248,7 @@ nwGtpv2cMsgGetSeqNumber(NW_IN NwGtpv2cMsgHandleT hMsg)
* @param[in] hMsg : Message handle.
*/
-NwU32T
+uint32_t
nwGtpv2cMsgGetMsgType(NW_IN NwGtpv2cMsgHandleT hMsg)
{
NwGtpv2cMsgT *thiz = (NwGtpv2cMsgT*) hMsg;
@@ -261,7 +261,7 @@ nwGtpv2cMsgGetMsgType(NW_IN NwGtpv2cMsgHandleT hMsg)
* @param[in] hMsg : Message handle.
*/
-NwU32T
+uint32_t
nwGtpv2cMsgGetLength(NW_IN NwGtpv2cMsgHandleT hMsg)
{
NwGtpv2cMsgT *thiz = (NwGtpv2cMsgT*) hMsg;
@@ -271,9 +271,9 @@ nwGtpv2cMsgGetLength(NW_IN NwGtpv2cMsgHandleT hMsg)
NwRcT
nwGtpv2cMsgAddIeTV1(NW_IN NwGtpv2cMsgHandleT hMsg,
- NW_IN NwU8T type,
- NW_IN NwU8T instance,
- NW_IN NwU8T value)
+ NW_IN uint8_t type,
+ NW_IN uint8_t instance,
+ NW_IN uint8_t value)
{
NwGtpv2cMsgT *pMsg = (NwGtpv2cMsgT*) hMsg;
NwGtpv2cIeTv1T *pIe;
@@ -292,9 +292,9 @@ nwGtpv2cMsgAddIeTV1(NW_IN NwGtpv2cMsgHandleT hMsg,
NwRcT
nwGtpv2cMsgAddIeTV2(NW_IN NwGtpv2cMsgHandleT hMsg,
- NW_IN NwU8T type,
- NW_IN NwU8T instance,
- NW_IN NwU16T value)
+ NW_IN uint8_t type,
+ NW_IN uint8_t instance,
+ NW_IN uint16_t value)
{
NwGtpv2cMsgT *pMsg = (NwGtpv2cMsgT*) hMsg;
NwGtpv2cIeTv2T *pIe;
@@ -313,9 +313,9 @@ nwGtpv2cMsgAddIeTV2(NW_IN NwGtpv2cMsgHandleT hMsg,
NwRcT
nwGtpv2cMsgAddIeTV4(NW_IN NwGtpv2cMsgHandleT hMsg,
- NW_IN NwU8T type,
- NW_IN NwU8T instance,
- NW_IN NwU32T value)
+ NW_IN uint8_t type,
+ NW_IN uint8_t instance,
+ NW_IN uint32_t value)
{
NwGtpv2cMsgT *pMsg = (NwGtpv2cMsgT*) hMsg;
NwGtpv2cIeTv4T *pIe;
@@ -334,10 +334,10 @@ nwGtpv2cMsgAddIeTV4(NW_IN NwGtpv2cMsgHandleT hMsg,
NwRcT
nwGtpv2cMsgAddIe(NW_IN NwGtpv2cMsgHandleT hMsg,
- NW_IN NwU8T type,
- NW_IN NwU16T length,
- NW_IN NwU8T instance,
- NW_IN NwU8T* pVal)
+ NW_IN uint8_t type,
+ NW_IN uint16_t length,
+ NW_IN uint8_t instance,
+ NW_IN uint8_t* pVal)
{
NwGtpv2cMsgT *pMsg = (NwGtpv2cMsgT*) hMsg;
NwGtpv2cIeTlvT *pIe;
@@ -348,7 +348,7 @@ nwGtpv2cMsgAddIe(NW_IN NwGtpv2cMsgHandleT hMsg,
pIe->l = htons(length);
pIe->i = instance & 0x00ff;
- memcpy(((NwU8T*)pIe) + 4, pVal, length);
+ memcpy(((uint8_t*)pIe) + 4, pVal, length);
pMsg->msgLen += (4 + length);
return NW_OK;
@@ -356,8 +356,8 @@ nwGtpv2cMsgAddIe(NW_IN NwGtpv2cMsgHandleT hMsg,
NwRcT
nwGtpv2cMsgGroupedIeStart(NW_IN NwGtpv2cMsgHandleT hMsg,
- NW_IN NwU8T type,
- NW_IN NwU8T instance)
+ NW_IN uint8_t type,
+ NW_IN uint8_t instance)
{
NwGtpv2cMsgT *pMsg = (NwGtpv2cMsgT*) hMsg;
NwGtpv2cIeTlvT *pIe;
@@ -395,13 +395,13 @@ nwGtpv2cMsgGroupedIeEnd(NW_IN NwGtpv2cMsgHandleT hMsg)
NwRcT
nwGtpv2cMsgAddIeCause(NW_IN NwGtpv2cMsgHandleT hMsg,
- NW_IN NwU8T instance,
- NW_IN NwU8T causeValue,
- NW_IN NwU8T bitFlags,
- NW_IN NwU8T offendingIeType,
- NW_IN NwU8T offendingIeInstance)
+ NW_IN uint8_t instance,
+ NW_IN uint8_t causeValue,
+ NW_IN uint8_t bitFlags,
+ NW_IN uint8_t offendingIeType,
+ NW_IN uint8_t offendingIeInstance)
{
- NwU8T causeBuf[8];
+ uint8_t causeBuf[8];
causeBuf[0] = causeValue;
causeBuf[1] = bitFlags;
@@ -418,25 +418,25 @@ nwGtpv2cMsgAddIeCause(NW_IN NwGtpv2cMsgHandleT hMsg,
NwRcT
nwGtpv2cMsgAddIeFteid(NW_IN NwGtpv2cMsgHandleT hMsg,
- NW_IN NwU8T instance,
- NW_IN NwU8T ifType,
- NW_IN NwU32T teidOrGreKey,
- NW_IN NwU32T ipv4Addr,
- NW_IN NwU8T* pIpv6Addr)
+ NW_IN uint8_t instance,
+ NW_IN uint8_t ifType,
+ NW_IN uint32_t teidOrGreKey,
+ NW_IN uint32_t ipv4Addr,
+ NW_IN uint8_t* pIpv6Addr)
{
- NwU8T fteidBuf[32];
- NwU8T *pFteidBuf = fteidBuf;
+ uint8_t fteidBuf[32];
+ uint8_t *pFteidBuf = fteidBuf;
fteidBuf[0] = (ifType & 0x1F);
pFteidBuf++;
- *((NwU32T*)(pFteidBuf)) = htonl((teidOrGreKey));
+ *((uint32_t*)(pFteidBuf)) = htonl((teidOrGreKey));
pFteidBuf += 4;
if(ipv4Addr) {
fteidBuf[0] |= (0x01 << 7);
- *((NwU32T*)(pFteidBuf)) = htonl(ipv4Addr);
+ *((uint32_t*)(pFteidBuf)) = htonl(ipv4Addr);
pFteidBuf += 4;
}
@@ -452,8 +452,8 @@ nwGtpv2cMsgAddIeFteid(NW_IN NwGtpv2cMsgHandleT hMsg,
NwBoolT
nwGtpv2cMsgIsIePresent(NW_IN NwGtpv2cMsgHandleT hMsg,
- NW_IN NwU8T type,
- NW_IN NwU8T instance)
+ NW_IN uint8_t type,
+ NW_IN uint8_t instance)
{
NwGtpv2cMsgT *thiz = (NwGtpv2cMsgT*) hMsg;
@@ -465,9 +465,9 @@ nwGtpv2cMsgIsIePresent(NW_IN NwGtpv2cMsgHandleT hMsg,
NwRcT
nwGtpv2cMsgGetIeTV1(NW_IN NwGtpv2cMsgHandleT hMsg,
- NW_IN NwU8T type,
- NW_IN NwU8T instance,
- NW_OUT NwU8T* pVal)
+ NW_IN uint8_t type,
+ NW_IN uint8_t instance,
+ NW_OUT uint8_t* pVal)
{
NwGtpv2cMsgT *thiz = (NwGtpv2cMsgT*) hMsg;
NwGtpv2cIeTv1T *pIe;
@@ -489,9 +489,9 @@ nwGtpv2cMsgGetIeTV1(NW_IN NwGtpv2cMsgHandleT hMsg,
NwRcT
nwGtpv2cMsgGetIeTV2( NW_IN NwGtpv2cMsgHandleT hMsg,
- NW_IN NwU8T type,
- NW_IN NwU8T instance,
- NW_OUT NwU16T* pVal)
+ NW_IN uint8_t type,
+ NW_IN uint8_t instance,
+ NW_OUT uint16_t* pVal)
{
NwGtpv2cMsgT *thiz = (NwGtpv2cMsgT*) hMsg;
NwGtpv2cIeTv2T *pIe;
@@ -513,9 +513,9 @@ nwGtpv2cMsgGetIeTV2( NW_IN NwGtpv2cMsgHandleT hMsg,
NwRcT
nwGtpv2cMsgGetIeTV4( NW_IN NwGtpv2cMsgHandleT hMsg,
- NW_IN NwU8T type,
- NW_IN NwU8T instance,
- NW_OUT NwU32T* pVal)
+ NW_IN uint8_t type,
+ NW_IN uint8_t instance,
+ NW_OUT uint32_t* pVal)
{
NwGtpv2cMsgT *thiz = (NwGtpv2cMsgT*) hMsg;
NwGtpv2cIeTv4T *pIe;
@@ -537,9 +537,9 @@ nwGtpv2cMsgGetIeTV4( NW_IN NwGtpv2cMsgHandleT hMsg,
NwRcT
nwGtpv2cMsgGetIeTV8( NW_IN NwGtpv2cMsgHandleT hMsg,
- NW_IN NwU8T type,
- NW_IN NwU8T instance,
- NW_OUT NwU64T* pVal)
+ NW_IN uint8_t type,
+ NW_IN uint8_t instance,
+ NW_OUT uint64_t* pVal)
{
NwGtpv2cMsgT *thiz = (NwGtpv2cMsgT*) hMsg;
NwGtpv2cIeTv8T *pIe;
@@ -562,11 +562,11 @@ nwGtpv2cMsgGetIeTV8( NW_IN NwGtpv2cMsgHandleT hMsg,
NwRcT
nwGtpv2cMsgGetIeTlv( NW_IN NwGtpv2cMsgHandleT hMsg,
- NW_IN NwU8T type,
- NW_IN NwU8T instance,
- NW_IN NwU16T maxLen,
- NW_OUT NwU8T* pVal,
- NW_OUT NwU16T* pLen)
+ NW_IN uint8_t type,
+ NW_IN uint8_t instance,
+ NW_IN uint16_t maxLen,
+ NW_OUT uint8_t* pVal,
+ NW_OUT uint16_t* pLen)
{
NwGtpv2cMsgT *thiz = (NwGtpv2cMsgT*) hMsg;
NwGtpv2cIeTlvT *pIe;
@@ -576,7 +576,7 @@ nwGtpv2cMsgGetIeTlv( NW_IN NwGtpv2cMsgHandleT hMsg,
pIe = (NwGtpv2cIeTlvT*) thiz->pIe[type][instance];
if(ntohs(pIe->l) <= maxLen) {
- if(pVal) memcpy(pVal, ((NwU8T*) pIe) + 4, ntohs(pIe->l));
+ if(pVal) memcpy(pVal, ((uint8_t*) pIe) + 4, ntohs(pIe->l));
if(pLen) *pLen = ntohs(pIe->l);
@@ -589,10 +589,10 @@ nwGtpv2cMsgGetIeTlv( NW_IN NwGtpv2cMsgHandleT hMsg,
NwRcT
nwGtpv2cMsgGetIeTlvP( NW_IN NwGtpv2cMsgHandleT hMsg,
- NW_IN NwU8T type,
- NW_IN NwU8T instance,
- NW_OUT NwU8T** ppVal,
- NW_OUT NwU16T* pLen)
+ NW_IN uint8_t type,
+ NW_IN uint8_t instance,
+ NW_OUT uint8_t** ppVal,
+ NW_OUT uint16_t* pLen)
{
NwGtpv2cMsgT *thiz = (NwGtpv2cMsgT*) hMsg;
NwGtpv2cIeTlvT *pIe;
@@ -601,7 +601,7 @@ nwGtpv2cMsgGetIeTlvP( NW_IN NwGtpv2cMsgHandleT hMsg,
if(thiz->isIeValid[type][instance]) {
pIe = (NwGtpv2cIeTlvT*) thiz->pIe[type][instance];
- if(ppVal) *ppVal = ((NwU8T*) pIe) + 4;
+ if(ppVal) *ppVal = ((uint8_t*) pIe) + 4;
if(pLen) *pLen = ntohs(pIe->l);
@@ -613,11 +613,11 @@ nwGtpv2cMsgGetIeTlvP( NW_IN NwGtpv2cMsgHandleT hMsg,
NwRcT
nwGtpv2cMsgGetIeCause(NW_IN NwGtpv2cMsgHandleT hMsg,
- NW_IN NwU8T instance,
- NW_OUT NwU8T* causeValue,
- NW_OUT NwU8T* flags,
- NW_OUT NwU8T* offendingIeType,
- NW_OUT NwU8T* offendingIeInstance)
+ NW_IN uint8_t instance,
+ NW_OUT uint8_t* causeValue,
+ NW_OUT uint8_t* flags,
+ NW_OUT uint8_t* offendingIeType,
+ NW_OUT uint8_t* offendingIeInstance)
{
NwGtpv2cMsgT *thiz = (NwGtpv2cMsgT*) hMsg;
NwGtpv2cIeTlvT *pIe;
@@ -626,12 +626,12 @@ nwGtpv2cMsgGetIeCause(NW_IN NwGtpv2cMsgHandleT hMsg,
if(thiz->isIeValid[NW_GTPV2C_IE_CAUSE][instance]) {
pIe = (NwGtpv2cIeTlvT*) thiz->pIe[NW_GTPV2C_IE_CAUSE][instance];
- *causeValue = *((NwU8T*)(((NwU8T*)pIe) + 4));
- *flags = *((NwU8T*)(((NwU8T*)pIe) + 5));
+ *causeValue = *((uint8_t*)(((uint8_t*)pIe) + 4));
+ *flags = *((uint8_t*)(((uint8_t*)pIe) + 5));
if(pIe->l == 6) {
- *offendingIeType = *((NwU8T*)(((NwU8T*)pIe) + 6));
- *offendingIeType = *((NwU8T*)(((NwU8T*)pIe) + 8));
+ *offendingIeType = *((uint8_t*)(((uint8_t*)pIe) + 6));
+ *offendingIeType = *((uint8_t*)(((uint8_t*)pIe) + 8));
}
return NW_OK;
@@ -642,11 +642,11 @@ nwGtpv2cMsgGetIeCause(NW_IN NwGtpv2cMsgHandleT hMsg,
NwRcT
nwGtpv2cMsgGetIeFteid(NW_IN NwGtpv2cMsgHandleT hMsg,
- NW_IN NwU8T instance,
- NW_OUT NwU8T* ifType,
- NW_OUT NwU32T* teidOrGreKey,
- NW_OUT NwU32T* ipv4Addr,
- NW_OUT NwU8T* pIpv6Addr)
+ NW_IN uint8_t instance,
+ NW_OUT uint8_t* ifType,
+ NW_OUT uint32_t* teidOrGreKey,
+ NW_OUT uint32_t* ipv4Addr,
+ NW_OUT uint8_t* pIpv6Addr)
{
NwGtpv2cMsgT *thiz = (NwGtpv2cMsgT*) hMsg;
NwGtpv2cIeTlvT *pIe;
@@ -655,17 +655,17 @@ nwGtpv2cMsgGetIeFteid(NW_IN NwGtpv2cMsgHandleT hMsg,
if(thiz->isIeValid[NW_GTPV2C_IE_FTEID][instance]) {
pIe = (NwGtpv2cIeTlvT*) thiz->pIe[NW_GTPV2C_IE_FTEID][instance];
- NwU8T flags;
- NwU8T* pIeValue = ((NwU8T*) pIe) + 4;
+ uint8_t flags;
+ uint8_t* pIeValue = ((uint8_t*) pIe) + 4;
flags = (*pIeValue) & 0xE0;
*ifType = (*pIeValue) & 0x1F;
pIeValue += 1;
- *teidOrGreKey = ntohl(*((NwU32T*)(pIeValue)));
+ *teidOrGreKey = ntohl(*((uint32_t*)(pIeValue)));
pIeValue += 4;
if(flags & 0x80) {
- *ipv4Addr = ntohl(*((NwU32T*)(pIeValue)));
+ *ipv4Addr = ntohl(*((uint32_t*)(pIeValue)));
pIeValue += 4;
}
@@ -680,8 +680,8 @@ nwGtpv2cMsgHexDump(NwGtpv2cMsgHandleT hMsg, FILE* fp)
{
NwGtpv2cMsgT* pMsg = (NwGtpv2cMsgT*) hMsg;
- NwU8T* data = pMsg->msgBuf;
- NwU32T size = pMsg->msgLen;
+ uint8_t* data = pMsg->msgBuf;
+ uint32_t size = pMsg->msgLen;
unsigned char *p = (unsigned char*)data;
unsigned char c;
diff --git a/openair-cn/GTPV2-C/nwgtpv2c-0.11/src/NwGtpv2cMsgIeParseInfo.c b/openair-cn/GTPV2-C/nwgtpv2c-0.11/src/NwGtpv2cMsgIeParseInfo.c
index d71d93c0a0..22607df8aa 100644
--- a/openair-cn/GTPV2-C/nwgtpv2c-0.11/src/NwGtpv2cMsgIeParseInfo.c
+++ b/openair-cn/GTPV2-C/nwgtpv2c-0.11/src/NwGtpv2cMsgIeParseInfo.c
@@ -50,10 +50,10 @@ extern "C" {
typedef struct NwGtpv2cMsgIeInfo {
- NwU8T ieType;
- NwU8T ieMinLength;
- NwU8T ieInstance;
- NwU8T iePresence;
+ uint8_t ieType;
+ uint8_t ieMinLength;
+ uint8_t ieInstance;
+ uint8_t iePresence;
struct NwGtpv2cMsgIeInfo *pGroupedIeInfo;
} NwGtpv2cMsgIeInfoT;
@@ -351,10 +351,10 @@ NwGtpv2cMsgIeInfoT forwardRelocationCompleteAckIeInfoTbl[] = {
* P R I V A T E F U N C T I O N S *
*----------------------------------------------------------------------------*/
-static NwU32T
+static uint32_t
nwGtpv2cMsgGroupedIeCount(NwGtpv2cMsgIeInfoT *pMsgIeInfo)
{
- NwU32T count = 0;
+ uint32_t count = 0;
NwGtpv2cMsgIeInfoT *pGroupedIeInfo = pMsgIeInfo;
while (pGroupedIeInfo++) {
@@ -372,7 +372,7 @@ static NwRcT
nwGtpv2cMsgIeParseInfoUpdate(NwGtpv2cMsgIeParseInfoT *thiz,
NwGtpv2cMsgIeInfoT *pMsgIeInfo)
{
- NwU32T i, j;
+ uint32_t i, j;
for (i = 0; pMsgIeInfo[i].ieType; i++) {
if (pMsgIeInfo[i].pGroupedIeInfo) {
@@ -411,10 +411,10 @@ nwGtpv2cMsgIeParseInfoUpdate(NwGtpv2cMsgIeParseInfoT *thiz,
static NwRcT
nwGtpv2cMsgGroupedIeParse(NW_IN NwGtpv2cGroupedIeParseInfoT* thiz,
- NW_IN NwU8T ieType,
- NW_IN NwU16T ieLength,
- NW_IN NwU8T ieInstance,
- NW_IN NwU8T *pIeValue)
+ NW_IN uint8_t ieType,
+ NW_IN uint16_t ieLength,
+ NW_IN uint8_t ieInstance,
+ NW_IN uint8_t *pIeValue)
{
NW_ASSERT(thiz);
@@ -434,7 +434,7 @@ nwGtpv2cMsgGroupedIeParse(NW_IN NwGtpv2cGroupedIeParseInfoT* thiz,
*/
NwGtpv2cMsgIeParseInfoT*
-nwGtpv2cMsgIeParseInfoNew(NwGtpv2cStackHandleT hStack, NwU8T msgType)
+nwGtpv2cMsgIeParseInfoNew(NwGtpv2cStackHandleT hStack, uint8_t msgType)
{
NwRcT rc;
NwGtpv2cMsgIeParseInfoT *thiz;
@@ -578,21 +578,21 @@ nwGtpv2cMsgIeParse(NW_IN NwGtpv2cMsgIeParseInfoT* thiz,
NW_INOUT NwGtpv2cErrorT *pError)
{
NwRcT rc = NW_OK;
- NwU16T mandatoryIeCount =0;
- NwU8T *pIeBufStart;
- NwU8T *pIeBufEnd;
- NwU16T ieType;
- NwU16T ieLength;
- NwU16T ieInstance;
+ uint16_t mandatoryIeCount =0;
+ uint8_t *pIeBufStart;
+ uint8_t *pIeBufEnd;
+ uint16_t ieType;
+ uint16_t ieLength;
+ uint16_t ieInstance;
NwGtpv2cIeTlvT *pIe;
NwGtpv2cMsgT *pMsg = (NwGtpv2cMsgT*) hMsg;
- NwU8T flags = *((NwU8T*)(pMsg->msgBuf));
+ uint8_t flags = *((uint8_t*)(pMsg->msgBuf));
- pIeBufStart = (NwU8T *) (pMsg->msgBuf + (flags & 0x08 ? 12: 8));
- pIeBufEnd = (NwU8T *) (pMsg->msgBuf + pMsg->msgLen);
+ pIeBufStart = (uint8_t *) (pMsg->msgBuf + (flags & 0x08 ? 12: 8));
+ pIeBufEnd = (uint8_t *) (pMsg->msgBuf + pMsg->msgLen);
- //memset(pMsg->pIe, 0, sizeof(NwU8T*) * (NW_GTPV2C_IE_TYPE_MAXIMUM) * (NW_GTPV2C_IE_INSTANCE_MAXIMUM));
- memset(pMsg->isIeValid, (NW_FALSE), sizeof(NwU8T) * (NW_GTPV2C_IE_TYPE_MAXIMUM) * (NW_GTPV2C_IE_INSTANCE_MAXIMUM));
+ //memset(pMsg->pIe, 0, sizeof(uint8_t*) * (NW_GTPV2C_IE_TYPE_MAXIMUM) * (NW_GTPV2C_IE_INSTANCE_MAXIMUM));
+ memset(pMsg->isIeValid, (NW_FALSE), sizeof(uint8_t) * (NW_GTPV2C_IE_TYPE_MAXIMUM) * (NW_GTPV2C_IE_INSTANCE_MAXIMUM));
while (pIeBufStart < pIeBufEnd) {
pIe = (NwGtpv2cIeTlvT*) pIeBufStart;
@@ -640,12 +640,12 @@ nwGtpv2cMsgIeParse(NW_IN NwGtpv2cMsgIeParseInfoT* thiz,
continue;
}
- pMsg->pIe[ieType][ieInstance] = (NwU8T*) pIeBufStart;
+ pMsg->pIe[ieType][ieInstance] = (uint8_t*) pIeBufStart;
pMsg->isIeValid[ieType][ieInstance] = NW_TRUE;
if(thiz->ieParseInfo[ieType][ieInstance].pGroupedIeInfo) {
/* Parse the grouped IE */
- rc = nwGtpv2cMsgGroupedIeParse(thiz->ieParseInfo[ieType][ieInstance].pGroupedIeInfo, ieType, ieLength, ieInstance, ((NwU8T*) pIe) + 4);
+ rc = nwGtpv2cMsgGroupedIeParse(thiz->ieParseInfo[ieType][ieInstance].pGroupedIeInfo, ieType, ieLength, ieInstance, ((uint8_t*) pIe) + 4);
if (rc != NW_OK) {
pError->cause = NW_GTPV2C_CAUSE_MANDATORY_IE_INCORRECT;
diff --git a/openair-cn/GTPV2-C/nwgtpv2c-0.11/src/NwGtpv2cMsgParser.c b/openair-cn/GTPV2-C/nwgtpv2c-0.11/src/NwGtpv2cMsgParser.c
index 42a8aad023..a19ddc1bcc 100644
--- a/openair-cn/GTPV2-C/nwgtpv2c-0.11/src/NwGtpv2cMsgParser.c
+++ b/openair-cn/GTPV2-C/nwgtpv2c-0.11/src/NwGtpv2cMsgParser.c
@@ -54,11 +54,11 @@ extern "C" {
NwRcT
nwGtpv2cMsgParserNew( NW_IN NwGtpv2cStackHandleT hGtpcStackHandle,
- NW_IN NwU8T msgType,
- NW_IN NwRcT (*ieReadCallback) (NwU8T ieType,
- NwU8T ieLength,
- NwU8T ieInstance,
- NwU8T* ieValue,
+ NW_IN uint8_t msgType,
+ NW_IN NwRcT (*ieReadCallback) (uint8_t ieType,
+ uint8_t ieLength,
+ uint8_t ieInstance,
+ uint8_t* ieValue,
void* ieReadCallbackArg),
NW_IN void* ieReadCallbackArg,
NW_IN NwGtpv2cMsgParserT **pthiz)
@@ -97,10 +97,10 @@ nwGtpv2cMsgParserDelete( NW_IN NwGtpv2cStackHandleT hGtpcStackHandle,
NwRcT
nwGtpv2cMsgParserUpdateIeReadCallback( NW_IN NwGtpv2cMsgParserT* thiz,
- NW_IN NwRcT (*ieReadCallback) (NwU8T ieType,
- NwU8T ieLength,
- NwU8T ieInstance,
- NwU8T* ieValue,
+ NW_IN NwRcT (*ieReadCallback) (uint8_t ieType,
+ uint8_t ieLength,
+ uint8_t ieInstance,
+ uint8_t* ieValue,
void* ieReadCallbackArg))
{
if(thiz) {
@@ -125,13 +125,13 @@ nwGtpv2cMsgParserUpdateIeReadCallbackArg( NW_IN NwGtpv2cMsgParserT* thiz,
NwRcT
nwGtpv2cMsgParserAddIe( NW_IN NwGtpv2cMsgParserT* thiz,
- NW_IN NwU8T ieType,
- NW_IN NwU8T ieInstance,
- NW_IN NwU8T iePresence,
- NW_IN NwRcT (*ieReadCallback) (NwU8T ieType,
- NwU8T ieLength,
- NwU8T ieInstance,
- NwU8T* ieValue,
+ NW_IN uint8_t ieType,
+ NW_IN uint8_t ieInstance,
+ NW_IN uint8_t iePresence,
+ NW_IN NwRcT (*ieReadCallback) (uint8_t ieType,
+ uint8_t ieLength,
+ uint8_t ieInstance,
+ uint8_t* ieValue,
void* ieReadCallbackArg),
NW_IN void* ieReadCallbackArg)
{
@@ -156,13 +156,13 @@ nwGtpv2cMsgParserAddIe( NW_IN NwGtpv2cMsgParserT* thiz,
NwRcT
nwGtpv2cMsgParserUpdateIe( NW_IN NwGtpv2cMsgParserT* thiz,
- NW_IN NwU8T ieType,
- NW_IN NwU8T ieInstance,
- NW_IN NwU8T iePresence,
- NW_IN NwRcT (*ieReadCallback) (NwU8T ieType,
- NwU8T ieLength,
- NwU8T ieInstance,
- NwU8T* ieValue,
+ NW_IN uint8_t ieType,
+ NW_IN uint8_t ieInstance,
+ NW_IN uint8_t iePresence,
+ NW_IN NwRcT (*ieReadCallback) (uint8_t ieType,
+ uint8_t ieLength,
+ uint8_t ieInstance,
+ uint8_t* ieValue,
void* ieReadCallbackArg),
NW_IN void* ieReadCallbackArg)
{
@@ -186,26 +186,26 @@ nwGtpv2cMsgParserUpdateIe( NW_IN NwGtpv2cMsgParserT* thiz,
NwRcT
nwGtpv2cMsgParserRun( NW_IN NwGtpv2cMsgParserT *thiz,
NW_IN NwGtpv2cMsgHandleT hMsg,
- NW_OUT NwU8T *pOffendingIeType,
- NW_OUT NwU8T *pOffendingIeInstance,
- NW_OUT NwU16T *pOffendingIeLength)
+ NW_OUT uint8_t *pOffendingIeType,
+ NW_OUT uint8_t *pOffendingIeInstance,
+ NW_OUT uint16_t *pOffendingIeLength)
{
NwRcT rc = NW_OK;
- NwU8T flags;
- NwU16T mandatoryIeCount =0;
+ uint8_t flags;
+ uint16_t mandatoryIeCount =0;
NwGtpv2cIeTlvT *pIe;
- NwU8T *pIeStart;
- NwU8T *pIeEnd;
- NwU16T ieLength;
+ uint8_t *pIeStart;
+ uint8_t *pIeEnd;
+ uint16_t ieLength;
NwGtpv2cMsgT *pMsg = (NwGtpv2cMsgT*) hMsg;
NW_ASSERT(pMsg);
- flags = *((NwU8T*)(pMsg->msgBuf));
- pIeStart = (NwU8T *) (pMsg->msgBuf + (flags & 0x08 ? 12: 8));
- pIeEnd = (NwU8T *) (pMsg->msgBuf + pMsg->msgLen);
+ flags = *((uint8_t*)(pMsg->msgBuf));
+ pIeStart = (uint8_t *) (pMsg->msgBuf + (flags & 0x08 ? 12: 8));
+ pIeEnd = (uint8_t *) (pMsg->msgBuf + pMsg->msgLen);
- memset(thiz->pIe, 0, sizeof(NwU8T*) * (NW_GTPV2C_IE_TYPE_MAXIMUM) * (NW_GTPV2C_IE_INSTANCE_MAXIMUM));
- memset(pMsg->pIe, 0, sizeof(NwU8T*) * (NW_GTPV2C_IE_TYPE_MAXIMUM) * (NW_GTPV2C_IE_INSTANCE_MAXIMUM));
+ memset(thiz->pIe, 0, sizeof(uint8_t*) * (NW_GTPV2C_IE_TYPE_MAXIMUM) * (NW_GTPV2C_IE_INSTANCE_MAXIMUM));
+ memset(pMsg->pIe, 0, sizeof(uint8_t*) * (NW_GTPV2C_IE_TYPE_MAXIMUM) * (NW_GTPV2C_IE_INSTANCE_MAXIMUM));
while (pIeStart < pIeEnd) {
pIe = (NwGtpv2cIeTlvT*) pIeStart;
@@ -219,8 +219,8 @@ nwGtpv2cMsgParserRun( NW_IN NwGtpv2cMsgParserT *thiz,
}
if((thiz->ieParseInfo[pIe->t][pIe->i].iePresence)) {
- thiz->pIe[pIe->t][pIe->i] = (NwU8T*) pIeStart;
- pMsg->pIe[pIe->t][pIe->i] = (NwU8T*) pIeStart;
+ thiz->pIe[pIe->t][pIe->i] = (uint8_t*) pIeStart;
+ pMsg->pIe[pIe->t][pIe->i] = (uint8_t*) pIeStart;
NW_LOG(thiz->hStack, NW_LOG_LEVEL_DEBG, "Received IE %u of length %u!", pIe->t, ieLength);
@@ -258,7 +258,7 @@ nwGtpv2cMsgParserRun( NW_IN NwGtpv2cMsgParserT *thiz,
}
if((NW_OK == rc) && (mandatoryIeCount != thiz->mandatoryIeCount)) {
- NwU16T t, i;
+ uint16_t t, i;
*pOffendingIeType = 0;
*pOffendingIeInstance = 0;
*pOffendingIeLength = 0;
diff --git a/openair-cn/GTPV2-C/nwgtpv2c-0.11/src/NwGtpv2cTrxn.c b/openair-cn/GTPV2-C/nwgtpv2c-0.11/src/NwGtpv2cTrxn.c
index 9a67386085..4d052d05f1 100644
--- a/openair-cn/GTPV2-C/nwgtpv2c-0.11/src/NwGtpv2cTrxn.c
+++ b/openair-cn/GTPV2-C/nwgtpv2c-0.11/src/NwGtpv2cTrxn.c
@@ -253,7 +253,7 @@ nwGtpv2cTrxnNew( NW_IN NwGtpv2cStackT* thiz)
*/
NwGtpv2cTrxnT*
nwGtpv2cTrxnWithSeqNumNew( NW_IN NwGtpv2cStackT* thiz,
- NW_IN NwU32T seqNum)
+ NW_IN uint32_t seqNum)
{
NwGtpv2cTrxnT *pTrxn;
@@ -292,10 +292,10 @@ nwGtpv2cTrxnWithSeqNumNew( NW_IN NwGtpv2cStackT* thiz,
NwGtpv2cTrxnT*
nwGtpv2cTrxnOutstandingRxNew( NW_IN NwGtpv2cStackT* thiz,
- NW_IN NwU32T teidLocal,
- NW_IN NwU32T peerIp,
- NW_IN NwU32T peerPort,
- NW_IN NwU32T seqNum)
+ NW_IN uint32_t teidLocal,
+ NW_IN uint32_t peerIp,
+ NW_IN uint32_t peerPort,
+ NW_IN uint32_t seqNum)
{
NwRcT rc;
NwGtpv2cTrxnT *pTrxn, *pCollision;
@@ -321,7 +321,7 @@ nwGtpv2cTrxnOutstandingRxNew( NW_IN NwGtpv2cStackT* thiz,
if(pCollision) {
NW_LOG(thiz, NW_LOG_LEVEL_WARN, "Duplicate request message received for seq num 0x%x!",
- (NwU32T) seqNum);
+ (uint32_t) seqNum);
/* Case of duplicate request message from peer. Retransmit response. */
if(pCollision->pMsg) {
diff --git a/openair-cn/GTPV2-C/nwgtpv2c-0.11/src/NwGtpv2cTunnel.c b/openair-cn/GTPV2-C/nwgtpv2c-0.11/src/NwGtpv2cTunnel.c
index ab82e4f5df..865d2c155a 100644
--- a/openair-cn/GTPV2-C/nwgtpv2c-0.11/src/NwGtpv2cTunnel.c
+++ b/openair-cn/GTPV2-C/nwgtpv2c-0.11/src/NwGtpv2cTunnel.c
@@ -48,7 +48,7 @@ extern "C" {
static NwGtpv2cTunnelT* gpGtpv2cTunnelPool = NULL;
NwGtpv2cTunnelT*
-nwGtpv2cTunnelNew(struct NwGtpv2cStack *pStack, NwU32T teid, NwU32T ipv4AddrRemote, NwGtpv2cUlpTunnelHandleT hUlpTunnel)
+nwGtpv2cTunnelNew(struct NwGtpv2cStack *pStack, uint32_t teid, uint32_t ipv4AddrRemote, NwGtpv2cUlpTunnelHandleT hUlpTunnel)
{
NwGtpv2cTunnelT* thiz;
diff --git a/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-egtping/NwEgtPingMain.c b/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-egtping/NwEgtPingMain.c
index 6681461c38..a346ab1faf 100644
--- a/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-egtping/NwEgtPingMain.c
+++ b/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-egtping/NwEgtPingMain.c
@@ -30,10 +30,10 @@ NwCharT* gLogLevelStr[] = {"EMER", "ALER", "CRIT", "ERRO", "WARN", "NOTI", "INF
typedef struct NwEgtPingS {
- NwU8T localIpStr[20];
- NwU8T targetIpStr[20];
- NwU32T pingInterval;
- NwU32T pingCount;
+ uint8_t localIpStr[20];
+ uint8_t targetIpStr[20];
+ uint32_t pingInterval;
+ uint32_t pingCount;
NwGtpv2cNodeUlpT ulpObj;
NwGtpv2cNodeUdpT udpObj;
} NwEgtPingT;
@@ -136,8 +136,8 @@ nwEgtPingParseCmdLineOpts(int argc, char* argv[])
int main(int argc, char* argv[])
{
NwRcT rc;
- NwU32T logLevel;
- NwU8T* logLevelStr;
+ uint32_t logLevel;
+ uint8_t* logLevelStr;
NwGtpv2cStackHandleT hGtpv2cStack = 0;
diff --git a/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-egtping/NwMiniLogMgrEntity.c b/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-egtping/NwMiniLogMgrEntity.c
index a1f2c32dc2..585f7fa7c7 100644
--- a/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-egtping/NwMiniLogMgrEntity.c
+++ b/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-egtping/NwMiniLogMgrEntity.c
@@ -40,21 +40,21 @@ NwMiniLogMgrT* nwMiniLogMgrGetInstance()
return &(__gLogMgr);
}
-NwRcT nwMiniLogMgrInit(NwMiniLogMgrT* thiz, NwU32T logLevel )
+NwRcT nwMiniLogMgrInit(NwMiniLogMgrT* thiz, uint32_t logLevel )
{
thiz->logLevel = logLevel;
return NW_OK;
}
-NwRcT nwMiniLogMgrSetLogLevel(NwMiniLogMgrT* thiz, NwU32T logLevel)
+NwRcT nwMiniLogMgrSetLogLevel(NwMiniLogMgrT* thiz, uint32_t logLevel)
{
thiz->logLevel = logLevel;
}
NwRcT nwMiniLogMgrLogRequest (NwGtpv2cLogMgrHandleT hLogMgr,
- NwU32T logLevel,
+ uint32_t logLevel,
NwCharT* file,
- NwU32T line,
+ uint32_t line,
NwCharT* logStr)
{
NwMiniLogMgrT* thiz = (NwMiniLogMgrT*) hLogMgr;
diff --git a/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-egtping/NwMiniLogMgrEntity.h b/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-egtping/NwMiniLogMgrEntity.h
index ac209efb21..3f37dec409 100644
--- a/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-egtping/NwMiniLogMgrEntity.h
+++ b/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-egtping/NwMiniLogMgrEntity.h
@@ -37,7 +37,7 @@
* MiniLogMgr Class Definition
*/
typedef struct NwMiniLogMgr {
- NwU8T logLevel; /*< Log level */
+ uint8_t logLevel; /*< Log level */
} NwMiniLogMgrT;
@@ -59,14 +59,14 @@ NwMiniLogMgrT* nwMiniLogMgrGetInstance();
* @param thiz : Pointer to global singleton MiniLogMgr instance
* @param logLevel : Log Level
*/
-NwRcT nwMiniLogMgrInit(NwMiniLogMgrT* thiz, NwU32T logLevel );
+NwRcT nwMiniLogMgrInit(NwMiniLogMgrT* thiz, uint32_t logLevel );
/**
* Set MiniLogMgr log level
* @param thiz : Pointer to global singleton MiniLogMgr instance
* @param logLevel : Log Level
*/
-NwRcT nwMiniLogMgrSetLogLevel(NwMiniLogMgrT* thiz, NwU32T logLevel);
+NwRcT nwMiniLogMgrSetLogLevel(NwMiniLogMgrT* thiz, uint32_t logLevel);
/**
* Process log request from stack
@@ -77,9 +77,9 @@ NwRcT nwMiniLogMgrSetLogLevel(NwMiniLogMgrT* thiz, NwU32T logLevel);
* @param logStr : Log string
*/
NwRcT nwMiniLogMgrLogRequest (NwGtpv2cLogMgrHandleT logMgrHandle,
- NwU32T logLevel,
+ uint32_t logLevel,
NwCharT* file,
- NwU32T line,
+ uint32_t line,
NwCharT* logStr);
#ifdef __cplusplus
diff --git a/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-egtping/NwMiniTmrMgrEntity.c b/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-egtping/NwMiniTmrMgrEntity.c
index 9dad245081..7b5553aa6b 100644
--- a/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-egtping/NwMiniTmrMgrEntity.c
+++ b/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-egtping/NwMiniTmrMgrEntity.c
@@ -55,9 +55,9 @@ NW_TMR_CALLBACK(nwGtpv2cNodeHandleStackTimerTimeout)
*--------------------------------------------------------------------------*/
NwRcT nwTimerStart( NwGtpv2cTimerMgrHandleT tmrMgrHandle,
- NwU32T timeoutSec,
- NwU32T timeoutUsec,
- NwU32T tmrType,
+ uint32_t timeoutSec,
+ uint32_t timeoutUsec,
+ uint32_t tmrType,
void* timeoutArg,
NwGtpv2cTimerHandleT* hTmr)
{
diff --git a/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-egtping/NwMiniTmrMgrEntity.h b/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-egtping/NwMiniTmrMgrEntity.h
index 5db18d8a82..85970c6cc2 100644
--- a/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-egtping/NwMiniTmrMgrEntity.h
+++ b/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-egtping/NwMiniTmrMgrEntity.h
@@ -25,7 +25,7 @@
#define __NW_MINI_TMR_MGR_H__
typedef struct {
- NwU8T _tbd;
+ uint8_t _tbd;
} NwGtpv2cNodeTmrMgrT;
typedef struct {
@@ -39,9 +39,9 @@ extern "C" {
#endif
NwRcT nwTimerStart( NwGtpv2cTimerMgrHandleT tmrMgrHandle,
- NwU32T timeoutSec,
- NwU32T timeoutUsec,
- NwU32T tmrType,
+ uint32_t timeoutSec,
+ uint32_t timeoutUsec,
+ uint32_t tmrType,
void* timeoutArg,
NwGtpv2cTimerHandleT* hTmr);
diff --git a/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-egtping/NwMiniUdpEntity.c b/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-egtping/NwMiniUdpEntity.c
index e2add191f7..16f5f2bcea 100644
--- a/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-egtping/NwMiniUdpEntity.c
+++ b/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-egtping/NwMiniUdpEntity.c
@@ -47,10 +47,10 @@ static
void NW_EVT_CALLBACK(nwUdpDataIndicationCallbackData)
{
NwRcT rc;
- NwU8T udpBuf[MAX_UDP_PAYLOAD_LEN];
+ uint8_t udpBuf[MAX_UDP_PAYLOAD_LEN];
NwS32T bytesRead;
struct sockaddr_in peer;
- NwU32T peerLen;
+ uint32_t peerLen;
NwGtpv2cNodeUdpT* thiz = (NwGtpv2cNodeUdpT*) arg;
peerLen = sizeof(peer);
@@ -96,7 +96,7 @@ void NW_EVT_CALLBACK(nwUdpDataIndicationCallbackData)
* Public functions
*--------------------------------------------------------------------------*/
-NwRcT nwGtpv2cUdpInit(NwGtpv2cNodeUdpT* thiz, NwGtpv2cStackHandleT hGtpv2cStack, NwU8T* ipAddrStr)
+NwRcT nwGtpv2cUdpInit(NwGtpv2cNodeUdpT* thiz, NwGtpv2cStackHandleT hGtpv2cStack, uint8_t* ipAddrStr)
{
int sd;
struct sockaddr_in addr;
@@ -179,10 +179,10 @@ NwRcT nwGtpv2cUdpReset(NwGtpv2cNodeUdpT* thiz)
}
NwRcT nwGtpv2cUdpDataReq(NwGtpv2cUdpHandleT udpHandle,
- NwU8T* dataBuf,
- NwU32T dataSize,
- NwU32T peerIp,
- NwU32T peerPort)
+ uint8_t* dataBuf,
+ uint32_t dataSize,
+ uint32_t peerIp,
+ uint32_t peerPort)
{
struct sockaddr_in peerAddr;
NwS32T bytesSent;
diff --git a/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-egtping/NwMiniUdpEntity.h b/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-egtping/NwMiniUdpEntity.h
index d1a653c3eb..37061e95e4 100644
--- a/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-egtping/NwMiniUdpEntity.h
+++ b/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-egtping/NwMiniUdpEntity.h
@@ -25,27 +25,27 @@
#define __NW_MINI_UDP_ENTITY_H__
typedef struct {
- NwU32T ipv4Addr;
- NwU32T hSocket;
+ uint32_t ipv4Addr;
+ uint32_t hSocket;
NwEventT ev;
NwGtpv2cStackHandleT hGtpv2cStack;
- NwU32T packetsSent;
- NwU32T packetsRcvd;
+ uint32_t packetsSent;
+ uint32_t packetsRcvd;
} NwGtpv2cNodeUdpT;
#ifdef __cplusplus
extern "C" {
#endif
-NwRcT nwGtpv2cUdpInit(NwGtpv2cNodeUdpT* thiz, NwGtpv2cStackHandleT hGtpv2cStack, NwU8T* ipAddrStr);
+NwRcT nwGtpv2cUdpInit(NwGtpv2cNodeUdpT* thiz, NwGtpv2cStackHandleT hGtpv2cStack, uint8_t* ipAddrStr);
NwRcT nwGtpv2cUdpDestroy(NwGtpv2cNodeUdpT* thiz);
NwRcT nwGtpv2cUdpDataReq(NwGtpv2cUdpHandleT udpHandle,
- NwU8T* dataBuf,
- NwU32T dataSize,
- NwU32T peerIp,
- NwU32T peerPort);
+ uint8_t* dataBuf,
+ uint32_t dataSize,
+ uint32_t peerIp,
+ uint32_t peerPort);
NwRcT nwGtpv2cUdpReset(NwGtpv2cNodeUdpT* thiz);
diff --git a/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-egtping/NwMiniUlpEntity.c b/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-egtping/NwMiniUlpEntity.c
index f9c20cba1e..fc5cc809d0 100644
--- a/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-egtping/NwMiniUlpEntity.c
+++ b/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-egtping/NwMiniUlpEntity.c
@@ -56,18 +56,18 @@ nwGtpv2cUlpDestroy(NwGtpv2cNodeUlpT* thiz)
}
typedef struct NwGtpv2cPeerS {
- NwU32T ipv4Addr;
- NwU32T pingCount;
- NwU32T pingInterval;
- NwU32T t3Time;
- NwU32T n3Count;
+ uint32_t ipv4Addr;
+ uint32_t pingCount;
+ uint32_t pingInterval;
+ uint32_t t3Time;
+ uint32_t n3Count;
- NwU32T sendTimeStamp;
+ uint32_t sendTimeStamp;
NwGtpv2cTunnelHandleT hTunnel;
} NwGtpv2cPeerT;
NwGtpv2cPeerT*
-nwGtpv2cUlpCreatePeerContext(NwGtpv2cNodeUlpT* thiz, NwU32T peerIp)
+nwGtpv2cUlpCreatePeerContext(NwGtpv2cNodeUlpT* thiz, uint32_t peerIp)
{
NwRcT rc;
NwGtpv2cUlpApiT ulpReq;
@@ -135,11 +135,11 @@ nwGtpv2cUlpSendEchoRequestToPeer(NwGtpv2cNodeUlpT* thiz, NwGtpv2cPeerT *pPeer)
NwRcT
nwGtpv2cUlpPing(NwGtpv2cNodeUlpT* thiz,
- NwU32T peerIp,
- NwU32T pingCount,
- NwU32T pingInterval,
- NwU32T t3Time,
- NwU32T n3Count)
+ uint32_t peerIp,
+ uint32_t pingCount,
+ uint32_t pingInterval,
+ uint32_t t3Time,
+ uint32_t n3Count)
{
NwRcT rc;
NwGtpv2cPeerT *pPeer;
@@ -165,9 +165,9 @@ nwGtpv2cUlpProcessStackReqCallback (NwGtpv2cUlpHandleT hUlp,
NwGtpv2cUlpApiT *pUlpApi)
{
NwRcT rc;
- NwU32T seqNum;
- NwU32T len;
- NwU32T recvTimeStamp;
+ uint32_t seqNum;
+ uint32_t len;
+ uint32_t recvTimeStamp;
struct timeval tv;
NwGtpv2cPeerT *pPeer;
NwGtpv2cNodeUlpT* thiz;
diff --git a/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-egtping/NwMiniUlpEntity.h b/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-egtping/NwMiniUlpEntity.h
index 782074df7c..3f56bf58e8 100644
--- a/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-egtping/NwMiniUlpEntity.h
+++ b/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-egtping/NwMiniUlpEntity.h
@@ -20,8 +20,8 @@
#define __NW_MINI_ULP_H__
typedef struct {
- NwU8T peerIpStr[16];
- NwU32T restartCounter;
+ uint8_t peerIpStr[16];
+ uint32_t restartCounter;
NwGtpv2cStackHandleT hGtpv2cStack;
} NwGtpv2cNodeUlpT;
@@ -41,11 +41,11 @@ nwGtpv2cUlpProcessStackReqCallback (NwGtpv2cUlpHandleT hUlp,
NwRcT
nwGtpv2cUlpPing(NwGtpv2cNodeUlpT* thiz,
- NwU32T peerIp,
- NwU32T pingCount,
- NwU32T pingInterval,
- NwU32T t3Time,
- NwU32T n3Count);
+ uint32_t peerIp,
+ uint32_t pingCount,
+ uint32_t pingInterval,
+ uint32_t t3Time,
+ uint32_t n3Count);
#ifdef __cplusplus
}
diff --git a/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-helloworld/NwMiniLogMgrEntity.c b/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-helloworld/NwMiniLogMgrEntity.c
index 5d0343655c..3ebc6a3a23 100644
--- a/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-helloworld/NwMiniLogMgrEntity.c
+++ b/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-helloworld/NwMiniLogMgrEntity.c
@@ -40,21 +40,21 @@ NwMiniLogMgrT* nwMiniLogMgrGetInstance()
return &(__gLogMgr);
}
-NwRcT nwMiniLogMgrInit(NwMiniLogMgrT* thiz, NwU32T logLevel )
+NwRcT nwMiniLogMgrInit(NwMiniLogMgrT* thiz, uint32_t logLevel )
{
thiz->logLevel = logLevel;
return NW_OK;
}
-NwRcT nwMiniLogMgrSetLogLevel(NwMiniLogMgrT* thiz, NwU32T logLevel)
+NwRcT nwMiniLogMgrSetLogLevel(NwMiniLogMgrT* thiz, uint32_t logLevel)
{
thiz->logLevel = logLevel;
}
NwRcT nwMiniLogMgrLogRequest (NwGtpv2cLogMgrHandleT hLogMgr,
- NwU32T logLevel,
+ uint32_t logLevel,
NwCharT* file,
- NwU32T line,
+ uint32_t line,
NwCharT* logStr)
{
NwMiniLogMgrT* thiz = (NwMiniLogMgrT*) hLogMgr;
diff --git a/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-helloworld/NwMiniLogMgrEntity.h b/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-helloworld/NwMiniLogMgrEntity.h
index ebf63729cd..361a2c6d95 100644
--- a/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-helloworld/NwMiniLogMgrEntity.h
+++ b/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-helloworld/NwMiniLogMgrEntity.h
@@ -37,7 +37,7 @@
* MiniLogMgr Class Definition
*/
typedef struct NwMiniLogMgr {
- NwU8T logLevel; /*< Log level */
+ uint8_t logLevel; /*< Log level */
} NwMiniLogMgrT;
@@ -59,14 +59,14 @@ NwMiniLogMgrT* nwMiniLogMgrGetInstance();
* @param thiz : Pointer to global singleton MiniLogMgr instance
* @param logLevel : Log Level
*/
-NwRcT nwMiniLogMgrInit(NwMiniLogMgrT* thiz, NwU32T logLevel );
+NwRcT nwMiniLogMgrInit(NwMiniLogMgrT* thiz, uint32_t logLevel );
/**
* Set MiniLogMgr log level
* @param thiz : Pointer to global singleton MiniLogMgr instance
* @param logLevel : Log Level
*/
-NwRcT nwMiniLogMgrSetLogLevel(NwMiniLogMgrT* thiz, NwU32T logLevel);
+NwRcT nwMiniLogMgrSetLogLevel(NwMiniLogMgrT* thiz, uint32_t logLevel);
/**
* Process log request from stack
@@ -77,9 +77,9 @@ NwRcT nwMiniLogMgrSetLogLevel(NwMiniLogMgrT* thiz, NwU32T logLevel);
* @param logStr : Log string
*/
NwRcT nwMiniLogMgrLogRequest (NwGtpv2cLogMgrHandleT logMgrHandle,
- NwU32T logLevel,
+ uint32_t logLevel,
NwCharT* file,
- NwU32T line,
+ uint32_t line,
NwCharT* logStr);
#ifdef __cplusplus
diff --git a/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-helloworld/NwMiniTmrMgrEntity.c b/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-helloworld/NwMiniTmrMgrEntity.c
index b18c79a4f2..38d2ee6374 100644
--- a/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-helloworld/NwMiniTmrMgrEntity.c
+++ b/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-helloworld/NwMiniTmrMgrEntity.c
@@ -55,9 +55,9 @@ NW_TMR_CALLBACK(nwGtpv2cNodeHandleStackTimerTimeout)
*--------------------------------------------------------------------------*/
NwRcT nwTimerStart( NwGtpv2cTimerMgrHandleT tmrMgrHandle,
- NwU32T timeoutSec,
- NwU32T timeoutUsec,
- NwU32T tmrType,
+ uint32_t timeoutSec,
+ uint32_t timeoutUsec,
+ uint32_t tmrType,
void* timeoutArg,
NwGtpv2cTimerHandleT* hTmr)
{
diff --git a/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-helloworld/NwMiniTmrMgrEntity.h b/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-helloworld/NwMiniTmrMgrEntity.h
index 5db18d8a82..85970c6cc2 100644
--- a/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-helloworld/NwMiniTmrMgrEntity.h
+++ b/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-helloworld/NwMiniTmrMgrEntity.h
@@ -25,7 +25,7 @@
#define __NW_MINI_TMR_MGR_H__
typedef struct {
- NwU8T _tbd;
+ uint8_t _tbd;
} NwGtpv2cNodeTmrMgrT;
typedef struct {
@@ -39,9 +39,9 @@ extern "C" {
#endif
NwRcT nwTimerStart( NwGtpv2cTimerMgrHandleT tmrMgrHandle,
- NwU32T timeoutSec,
- NwU32T timeoutUsec,
- NwU32T tmrType,
+ uint32_t timeoutSec,
+ uint32_t timeoutUsec,
+ uint32_t tmrType,
void* timeoutArg,
NwGtpv2cTimerHandleT* hTmr);
diff --git a/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-helloworld/NwMiniUdpEntity.c b/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-helloworld/NwMiniUdpEntity.c
index 286d228058..a5352349f5 100644
--- a/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-helloworld/NwMiniUdpEntity.c
+++ b/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-helloworld/NwMiniUdpEntity.c
@@ -46,9 +46,9 @@ static
void NW_EVT_CALLBACK(nwUdpDataIndicationCallbackData)
{
NwRcT rc;
- NwU8T udpBuf[MAX_UDP_PAYLOAD_LEN];
+ uint8_t udpBuf[MAX_UDP_PAYLOAD_LEN];
NwS32T bytesRead;
- NwU32T peerLen;
+ uint32_t peerLen;
struct sockaddr_in peer;
NwGtpv2cNodeUdpT* thiz = (NwGtpv2cNodeUdpT*) arg;
@@ -57,7 +57,7 @@ void NW_EVT_CALLBACK(nwUdpDataIndicationCallbackData)
bytesRead = recvfrom(fd, udpBuf, MAX_UDP_PAYLOAD_LEN , 0, (struct sockaddr *) &peer,(socklen_t*) &peerLen);
if(bytesRead) {
- NwU32T peerIp = (peer.sin_addr.s_addr);
+ uint32_t peerIp = (peer.sin_addr.s_addr);
NW_LOG(NW_LOG_LEVEL_DEBG, "Received UDP message of size %u from peer %u.%u.%u.%u:%u", bytesRead,
(peerIp & 0x000000ff),
(peerIp & 0x0000ff00) >> 8,
@@ -75,7 +75,7 @@ void NW_EVT_CALLBACK(nwUdpDataIndicationCallbackData)
* Public functions
*--------------------------------------------------------------------------*/
-NwRcT nwGtpv2cUdpInit(NwGtpv2cNodeUdpT* thiz, NwGtpv2cStackHandleT hGtpv2cStack, NwU8T* ipv4Addr)
+NwRcT nwGtpv2cUdpInit(NwGtpv2cNodeUdpT* thiz, NwGtpv2cStackHandleT hGtpv2cStack, uint8_t* ipv4Addr)
{
int sd;
struct sockaddr_in addr;
@@ -111,10 +111,10 @@ NwRcT nwGtpv2cUdpDestroy(NwGtpv2cNodeUdpT* thiz)
}
NwRcT nwGtpv2cUdpDataReq(NwGtpv2cUdpHandleT udpHandle,
- NwU8T* dataBuf,
- NwU32T dataSize,
- NwU32T peerIp,
- NwU32T peerPort)
+ uint8_t* dataBuf,
+ uint32_t dataSize,
+ uint32_t peerIp,
+ uint32_t peerPort)
{
struct sockaddr_in peerAddr;
NwS32T bytesSent;
diff --git a/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-helloworld/NwMiniUdpEntity.h b/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-helloworld/NwMiniUdpEntity.h
index a8f36a2787..4f1bb3eef9 100644
--- a/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-helloworld/NwMiniUdpEntity.h
+++ b/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-helloworld/NwMiniUdpEntity.h
@@ -25,7 +25,7 @@
#define __NW_MINI_UDP_ENTITY_H__
typedef struct {
- NwU32T hSocket;
+ uint32_t hSocket;
NwEventT ev;
NwGtpv2cStackHandleT hGtpv2cStack;
} NwGtpv2cNodeUdpT;
@@ -34,15 +34,15 @@ typedef struct {
extern "C" {
#endif
-NwRcT nwGtpv2cUdpInit(NwGtpv2cNodeUdpT* thiz, NwGtpv2cStackHandleT hGtpv2cStack, NwU8T* ipv4Addr);
+NwRcT nwGtpv2cUdpInit(NwGtpv2cNodeUdpT* thiz, NwGtpv2cStackHandleT hGtpv2cStack, uint8_t* ipv4Addr);
NwRcT nwGtpv2cUdpDestroy(NwGtpv2cNodeUdpT* thiz);
NwRcT nwGtpv2cUdpDataReq(NwGtpv2cUdpHandleT udpHandle,
- NwU8T* dataBuf,
- NwU32T dataSize,
- NwU32T peerIp,
- NwU32T peerPort);
+ uint8_t* dataBuf,
+ uint32_t dataSize,
+ uint32_t peerIp,
+ uint32_t peerPort);
#ifdef __cplusplus
}
diff --git a/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-helloworld/NwMiniUlpEntity.c b/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-helloworld/NwMiniUlpEntity.c
index 5868e724eb..82bc6580af 100644
--- a/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-helloworld/NwMiniUlpEntity.c
+++ b/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-helloworld/NwMiniUlpEntity.c
@@ -34,7 +34,7 @@ static
NwCharT* gLogLevelStr[] = {"EMER", "ALER", "CRIT", "ERRO", "WARN", "NOTI", "INFO", "DEBG"};
static NwRcT
-nwGtpv2cCreateSessionRequestIeIndication(NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T* ieValue, void* arg)
+nwGtpv2cCreateSessionRequestIeIndication(uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t* ieValue, void* arg)
{
NW_LOG(NW_LOG_LEVEL_DEBG, "Received IE Parse Indication for of type %u, length %u, instance %u!", ieType, ieLength, ieInstance);
return NW_OK;
@@ -62,7 +62,7 @@ nwGtpv2cUlpDestroy(NwGtpv2cNodeUlpT* thiz)
}
NwRcT
-nwGtpv2cUlpSenEchoRequestToPeer(NwGtpv2cNodeUlpT* thiz, NwU32T peerIp)
+nwGtpv2cUlpSenEchoRequestToPeer(NwGtpv2cNodeUlpT* thiz, uint32_t peerIp)
{
NwRcT rc;
NwGtpv2cUlpApiT ulpReq;
@@ -153,18 +153,18 @@ nwGtpv2cUlpProcessStackReqCallback (NwGtpv2cUlpHandleT hUlp,
if(pUlpApi->apiInfo.initialReqIndInfo.msgType == NW_GTP_CREATE_SESSION_REQ) {
struct {
- NwU8T causeValue;
- NwU8T spare:5;
- NwU8T pce:1;
- NwU8T bce:1;
- NwU8T cs:1;
+ uint8_t causeValue;
+ uint8_t spare:5;
+ uint8_t pce:1;
+ uint8_t bce:1;
+ uint8_t cs:1;
} cause;
rc = nwGtpv2cMsgParserAddIe(pMsgParser, NW_GTPV2C_IE_RECOVERY, NW_GTPV2C_IE_INSTANCE_ZERO, NW_GTPV2C_IE_PRESENCE_MANDATORY, nwGtpv2cCreateSessionRequestIeIndication, NULL);
NW_ASSERT(NW_OK == rc);
- NwU8T offendingIeType, OffendingIeLength;
+ uint8_t offendingIeType, OffendingIeLength;
rc = nwGtpv2cMsgParserRun(pMsgParser, (pUlpApi->hMsg), &offendingIeType, &OffendingIeLength);
if( rc != NW_OK ) {
@@ -198,7 +198,7 @@ nwGtpv2cUlpProcessStackReqCallback (NwGtpv2cUlpHandleT hUlp,
nwGtpv2cMsgGetSeqNumber(pUlpApi->hMsg),
&(ulpReq.hMsg));
- rc = nwGtpv2cMsgAddIe((ulpReq.hMsg), NW_GTPV2C_IE_CAUSE, 2, 0, (NwU8T*)&cause);
+ rc = nwGtpv2cMsgAddIe((ulpReq.hMsg), NW_GTPV2C_IE_CAUSE, 2, 0, (uint8_t*)&cause);
NW_ASSERT(NW_OK == rc);
NW_LOG(NW_LOG_LEVEL_NOTI, "Received NW_GTP_CREATE_SESSION_REQ, Sending NW_GTP_CREATE_SESSION_RSP!");
@@ -227,7 +227,7 @@ nwGtpv2cUlpProcessStackReqCallback (NwGtpv2cUlpHandleT hUlp,
rc = nwGtpv2cMsgParserAddIe(pMsgParser, NW_GTPV2C_IE_CAUSE, NW_GTPV2C_IE_INSTANCE_ZERO, NW_GTPV2C_IE_PRESENCE_MANDATORY, nwGtpv2cCreateSessionRequestIeIndication, NULL);
NW_ASSERT(NW_OK == rc);
- NwU8T offendingIeType, OffendingIeLength;
+ uint8_t offendingIeType, OffendingIeLength;
rc = nwGtpv2cMsgParserRun(pMsgParser, (pUlpApi->hMsg), &offendingIeType, &OffendingIeLength);
if( rc != NW_OK ) {
diff --git a/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-helloworld/NwMiniUlpEntity.h b/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-helloworld/NwMiniUlpEntity.h
index f446dad27f..e92a6ba6bc 100644
--- a/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-helloworld/NwMiniUlpEntity.h
+++ b/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-helloworld/NwMiniUlpEntity.h
@@ -20,8 +20,8 @@
#define __NW_MINI_ULP_H__
typedef struct {
- NwU8T peerIpStr[16];
- NwU32T restartCounter;
+ uint8_t peerIpStr[16];
+ uint32_t restartCounter;
NwGtpv2cStackHandleT hGtpv2cStack;
} NwGtpv2cNodeUlpT;
diff --git a/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-helloworld/helloworld.c b/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-helloworld/helloworld.c
index 2335fcd08b..2b78e104e2 100644
--- a/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-helloworld/helloworld.c
+++ b/openair-cn/GTPV2-C/nwgtpv2c-0.11/test-app/nw-helloworld/helloworld.c
@@ -40,8 +40,8 @@ NwCharT* gLogLevelStr[] = {"EMER", "ALER", "CRIT", "ERRO", "WARN", "NOTI", "INF
int main(int argc, char* argv[])
{
NwRcT rc;
- NwU32T logLevel;
- NwU8T* logLevelStr;
+ uint32_t logLevel;
+ uint8_t* logLevelStr;
NwGtpv2cStackHandleT hGtpv2cStack = 0;
diff --git a/openair-cn/MME_APP/mme_app_authentication.c b/openair-cn/MME_APP/mme_app_authentication.c
index 514db141f1..d10e7d645b 100644
--- a/openair-cn/MME_APP/mme_app_authentication.c
+++ b/openair-cn/MME_APP/mme_app_authentication.c
@@ -170,8 +170,8 @@ int
mme_app_handle_authentication_info_answer(
const s6a_auth_info_ans_t * const s6a_auth_info_ans_pP)
{
- struct ue_context_s *ue_context;
- uint64_t imsi;
+ struct ue_context_s *ue_context = NULL;
+ uint64_t imsi = 0;
DevAssert(s6a_auth_info_ans_pP != NULL);
diff --git a/openair-cn/MME_APP/mme_app_bearer.c b/openair-cn/MME_APP/mme_app_bearer.c
index e28f40b009..fd909b198e 100644
--- a/openair-cn/MME_APP/mme_app_bearer.c
+++ b/openair-cn/MME_APP/mme_app_bearer.c
@@ -43,6 +43,7 @@
#include "mme_app_extern.h"
#include "mme_app_ue_context.h"
#include "mme_app_defs.h"
+#include "sgw_lite_ie_defs.h"
#include "secu_defs.h"
@@ -246,6 +247,13 @@ mme_app_send_s11_create_session_req(
}
}
+ if ((ue_context_pP->pending_pdn_connectivity_req_pco.length >= PCO_MIN_LENGTH) && (ue_context_pP->pending_pdn_connectivity_req_pco.length <= PCO_MAX_LENGTH)) {
+ memcpy(&session_request_p->pco.byte[0],
+ &ue_context_pP->pending_pdn_connectivity_req_pco.byte[0],
+ ue_context_pP->pending_pdn_connectivity_req_pco.length);
+ session_request_p->pco.length = ue_context_pP->pending_pdn_connectivity_req_pco.length;
+ }
+
config_read_lock(&mme_config);
session_request_p->peer_ip = mme_config.ipv4.sgw_ip_address_for_S11;
config_unlock(&mme_config);
@@ -321,6 +329,11 @@ mme_app_handle_nas_pdn_connectivity_req(
ue_context_p->pending_pdn_connectivity_req_pti = nas_pdn_connectivity_req_pP->pti;
ue_context_p->pending_pdn_connectivity_req_ue_id = nas_pdn_connectivity_req_pP->ue_id;
+ memcpy(&ue_context_p->pending_pdn_connectivity_req_pco.byte[0],
+ &nas_pdn_connectivity_req_pP->pco.byte[0],
+ nas_pdn_connectivity_req_pP->pco.length);
+ ue_context_p->pending_pdn_connectivity_req_pco.length = nas_pdn_connectivity_req_pP->pco.length;
+
memcpy(&ue_context_p->pending_pdn_connectivity_req_qos,
&nas_pdn_connectivity_req_pP->qos,
sizeof(network_qos_t));
@@ -759,6 +772,11 @@ mme_app_handle_create_sess_resp(
NAS_PDN_CONNECTIVITY_RSP(message_p).ambr.br_dl = ue_context_p->subscribed_ambr.br_dl;
+ memcpy(&NAS_PDN_CONNECTIVITY_RSP(message_p).pco.byte[0],
+ &create_sess_resp_pP->pco.byte[0],
+ create_sess_resp_pP->pco.length);
+ NAS_PDN_CONNECTIVITY_RSP(message_p).pco.length = create_sess_resp_pP->pco.length;
+
MSC_LOG_TX_MESSAGE(
MSC_MMEAPP_MME,
MSC_NAS_MME,
diff --git a/openair-cn/MME_APP/mme_app_context.c b/openair-cn/MME_APP/mme_app_context.c
index 43c6628fb4..f7ca54f8da 100644
--- a/openair-cn/MME_APP/mme_app_context.c
+++ b/openair-cn/MME_APP/mme_app_context.c
@@ -275,6 +275,29 @@ int mme_insert_ue_context(mme_ue_context_t *mme_ue_context, struct ue_context_s
return 0;
}
+
+
+//------------------------------------------------------------------------------
+void mme_remove_ue_context(mme_ue_context_t *mme_ue_context, struct ue_context_s *ue_context_p)
+//------------------------------------------------------------------------------
+{
+ struct ue_context_s *collision_p = NULL;
+
+ DevAssert(mme_ue_context != NULL);
+ DevAssert(ue_context_p != NULL);
+
+ /* Updating statistics */
+ mme_ue_context->nb_ue_managed++;
+ mme_ue_context->nb_ue_since_last_stat++;
+
+ collision_p = RB_REMOVE(ue_context_map, &mme_ue_context->ue_context_tree,
+ ue_context_p);
+#warning "TODO mme_ue_context_free_content"
+ //TODO mme_ue_context_free_content(ue_context_p);
+ free(ue_context_p);
+ return 0;
+}
+
//------------------------------------------------------------------------------
void mme_app_dump_ue_contexts(mme_ue_context_t *mme_ue_context)
//------------------------------------------------------------------------------
@@ -451,13 +474,12 @@ void mme_app_dump_ue_contexts(mme_ue_context_t *mme_ue_context)
void mme_app_handle_s1ap_ue_context_release_req(const s1ap_ue_context_release_req_t const *s1ap_ue_context_release_req)
//------------------------------------------------------------------------------
{
- struct ue_context_s *ue_context_p = NULL;
+ struct ue_context_s *ue_context_p = NULL;
+ MessageDef *message_p = NULL;
MME_APP_DEBUG("Received S1AP_UE_CONTEXT_RELEASE_REQ from S1AP\n");
-
ue_context_p = mme_ue_context_exists_nas_ue_id(&mme_app_desc.mme_ue_contexts, s1ap_ue_context_release_req->mme_ue_s1ap_id);
-
if (ue_context_p == NULL) {
MSC_LOG_EVENT(
MSC_MMEAPP_MME,
@@ -467,7 +489,29 @@ void mme_app_handle_s1ap_ue_context_release_req(const s1ap_ue_context_release_re
s1ap_ue_context_release_req->mme_ue_s1ap_id);
return;
}
- mme_app_send_s11_release_access_bearers_req(ue_context_p);
+ if ((ue_context_p->mme_s11_teid == 0) &&
+ (ue_context_p->sgw_s11_teid == 0)) {
+ // no session was created, no need for releasing bearers in SGW
+ message_p = itti_alloc_new_message(TASK_MME_APP, S1AP_UE_CONTEXT_RELEASE_COMMAND);
+
+ AssertFatal(message_p != NULL, "itti_alloc_new_message Failed");
+ memset((void*)&message_p->ittiMsg.s1ap_ue_context_release_command,
+ 0,
+ sizeof(s1ap_ue_context_release_command_t));
+
+ S1AP_UE_CONTEXT_RELEASE_COMMAND(message_p).mme_ue_s1ap_id = ue_context_p->mme_ue_s1ap_id;
+ MSC_LOG_TX_MESSAGE(
+ MSC_MMEAPP_MME,
+ MSC_S1AP_MME,
+ NULL,0,
+ "0 S1AP_UE_CONTEXT_RELEASE_COMMAND mme_ue_s1ap_id %06"PRIX32" ",
+ S1AP_UE_CONTEXT_RELEASE_COMMAND(message_p).mme_ue_s1ap_id);
+
+
+ itti_send_msg_to_task(TASK_S1AP, INSTANCE_DEFAULT, message_p);
+ } else {
+ mme_app_send_s11_release_access_bearers_req(ue_context_p);
+ }
}
@@ -506,4 +550,6 @@ void mme_app_handle_s1ap_ue_context_release_complete(const s1ap_ue_context_relea
"0 S1AP_DEREGISTER_UE_REQ");
itti_send_msg_to_task(TASK_NAS_MME, INSTANCE_DEFAULT, message_p);
+
+ mme_remove_ue_context(&mme_app_desc.mme_ue_contexts, ue_context_p);
}
diff --git a/openair-cn/MME_APP/mme_app_main.c b/openair-cn/MME_APP/mme_app_main.c
index 22ebe29658..ddd00e1faf 100644
--- a/openair-cn/MME_APP/mme_app_main.c
+++ b/openair-cn/MME_APP/mme_app_main.c
@@ -51,6 +51,7 @@ void *mme_app_thread(void *args);
void *mme_app_thread(void *args)
{
itti_mark_task_ready(TASK_MME_APP);
+ MSC_START_USE();
while(1) {
MessageDef *received_message_p = NULL;
diff --git a/openair-cn/MME_APP/mme_app_ue_context.h b/openair-cn/MME_APP/mme_app_ue_context.h
index 6ac65697ba..d87f0fa4c0 100644
--- a/openair-cn/MME_APP/mme_app_ue_context.h
+++ b/openair-cn/MME_APP/mme_app_ue_context.h
@@ -177,6 +177,7 @@ typedef struct ue_context_s {
int pending_pdn_connectivity_req_pti;
unsigned pending_pdn_connectivity_req_ue_id;
network_qos_t pending_pdn_connectivity_req_qos;
+ pco_flat_t pending_pdn_connectivity_req_pco;
void *pending_pdn_connectivity_req_proc_data;
int pending_pdn_connectivity_req_request_type;
@@ -240,6 +241,13 @@ ue_context_t *mme_ue_context_exists_guti(mme_ue_context_t *mme_ue_context,
int mme_insert_ue_context(mme_ue_context_t *mme_ue_context,
struct ue_context_s *ue_context_p);
+/** \brief Remove a UE context of the tree of known UEs.
+ * \param ue_context_p The UE context to remove
+ **/
+void mme_remove_ue_context(mme_ue_context_t *mme_ue_context,
+ struct ue_context_s *ue_context_p);
+
+
/** \brief Allocate memory for a new UE context
* @returns Pointer to the new structure, NULL if allocation failed
**/
diff --git a/openair-cn/NAS/EURECOM-NAS/COPYING b/openair-cn/NAS/COMMON/API/NETWORK/COPYING
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/COPYING
rename to openair-cn/NAS/COMMON/API/NETWORK/COPYING
diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/network/Makefile b/openair-cn/NAS/COMMON/API/NETWORK/Makefile
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/api/network/Makefile
rename to openair-cn/NAS/COMMON/API/NETWORK/Makefile
diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/network/as_message.c b/openair-cn/NAS/COMMON/API/NETWORK/as_message.c
similarity index 99%
rename from openair-cn/NAS/EURECOM-NAS/src/api/network/as_message.c
rename to openair-cn/NAS/COMMON/API/NETWORK/as_message.c
index b0f07f937d..5b29016f3a 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/api/network/as_message.c
+++ b/openair-cn/NAS/COMMON/API/NETWORK/as_message.c
@@ -91,8 +91,8 @@ int as_message_decode(const char* buffer, as_message_t* msg, int length)
Byte_t** data = NULL;
/* Get the message type */
- msg->msgID = *(UInt16_t*)(buffer);
- bytes = sizeof(UInt16_t);
+ msg->msgID = *(uint16_t*)(buffer);
+ bytes = sizeof(uint16_t);
switch (msg->msgID) {
case AS_NAS_ESTABLISH_REQ:
diff --git a/openair-cn/NAS/COMMON/API/NETWORK/as_message.h b/openair-cn/NAS/COMMON/API/NETWORK/as_message.h
new file mode 120000
index 0000000000..ef8d3686fd
--- /dev/null
+++ b/openair-cn/NAS/COMMON/API/NETWORK/as_message.h
@@ -0,0 +1 @@
+../../../../../openair2/COMMON/as_message.h
\ No newline at end of file
diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/network/l2_message.h b/openair-cn/NAS/COMMON/API/NETWORK/l2_message.h
similarity index 97%
rename from openair-cn/NAS/EURECOM-NAS/src/api/network/l2_message.h
rename to openair-cn/NAS/COMMON/API/NETWORK/l2_message.h
index ced2b54bc3..d24d78b503 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/api/network/l2_message.h
+++ b/openair-cn/NAS/COMMON/API/NETWORK/l2_message.h
@@ -204,13 +204,13 @@ typedef struct {} paging_ind_t;
/* Structure of the SAE Temporary Mobile Subscriber Identity */
typedef struct {
- UInt8_t MMEcode; /* MME code that allocated the GUTI */
- UInt32_t m_tmsi; /* M-Temporary Mobile Subscriber Identity */
+ uint8_t MMEcode; /* MME code that allocated the GUTI */
+ uint32_t m_tmsi; /* M-Temporary Mobile Subscriber Identity */
} as_stmsi_t;
/* Structure of the dedicated NAS information */
typedef struct {
- UInt32_t length; /* Length of the NAS information data */
+ uint32_t length; /* Length of the NAS information data */
Byte_t* data; /* Dedicated NAS information data container */
} as_nas_info_t;
@@ -220,8 +220,8 @@ typedef struct {
* to transfer initial NAS message to the network while UE is in IDLE mode.
*/
typedef struct {
- UInt8_t cause; /* Connection establishment cause */
- UInt8_t type; /* Associated call type */
+ uint8_t cause; /* Connection establishment cause */
+ uint8_t type; /* Associated call type */
plmn_t plmnID; /* Identifier of the selected PLMN */
as_stmsi_t s_tmsi; /* SAE Temporary Mobile Subscriber Identity */
as_nas_info_t initialNasMsg;/* Initial NAS message to transfer */
@@ -274,7 +274,7 @@ typedef as_nas_info_t ul_info_transfer_t;
* --------------------------------------------------------------------------
*/
typedef struct {
- UInt16_t msgID;
+ uint16_t msgID;
union {
cell_info_req_t cell_info_req;
cell_info_rsp_t cell_info_rsp;
diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/network/nas_message.c b/openair-cn/NAS/COMMON/API/NETWORK/nas_message.c
similarity index 97%
rename from openair-cn/NAS/EURECOM-NAS/src/api/network/nas_message.c
rename to openair-cn/NAS/COMMON/API/NETWORK/nas_message.c
index 9896ebfde0..611ad6fc3a 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/api/network/nas_message.c
+++ b/openair-cn/NAS/COMMON/API/NETWORK/nas_message.c
@@ -97,9 +97,9 @@ static int _nas_message_protected_encode(
static int _nas_message_decrypt(
char* dest,
const char* src,
- UInt8_t type,
- UInt32_t code,
- UInt8_t seq,
+ uint8_t type,
+ uint32_t code,
+ uint8_t seq,
int length,
const emm_security_context_t * const emm_security_context);
@@ -108,15 +108,15 @@ static int
_nas_message_encrypt(
char *dest,
const char *src,
- UInt8_t type,
- UInt32_t code,
- UInt8_t seq,
+ uint8_t type,
+ uint32_t code,
+ uint8_t seq,
int const direction,
int length,
const emm_security_context_t * const emm_security_context);
/* Functions used for integrity protection of layer 3 NAS messages */
-static UInt32_t _nas_message_get_mac(
+static uint32_t _nas_message_get_mac(
const char * const buffer,
int const length,
int const direction,
@@ -180,9 +180,9 @@ nas_message_encrypt(
/* Integrity protected the NAS message */
if (bytes > 0) {
/* Compute offset of the sequence number field */
- int offset = size - sizeof(UInt8_t);
+ int offset = size - sizeof(uint8_t);
/* Compute the NAS message authentication code */
- UInt32_t mac = _nas_message_get_mac(
+ uint32_t mac = _nas_message_get_mac(
outbuf + offset,
bytes + size - offset,
#ifdef NAS_MME
@@ -192,7 +192,7 @@ nas_message_encrypt(
#endif
emm_security_context);
/* Set the message authentication code of the NAS message */
- *(UInt32_t*)(outbuf + sizeof(UInt8_t)) = htonl(mac);
+ *(uint32_t*)(outbuf + sizeof(uint8_t)) = htonl(mac);
}
} else {
/* The input buffer does not need to be encrypted */
@@ -301,9 +301,9 @@ int nas_message_decrypt(
}
/* Compute offset of the sequence number field */
- int offset = size - sizeof(UInt8_t);
+ int offset = size - sizeof(uint8_t);
/* Compute the NAS message authentication code */
- UInt32_t mac = _nas_message_get_mac(
+ uint32_t mac = _nas_message_get_mac(
inbuf + offset,
length - offset,
#ifdef NAS_MME
@@ -410,9 +410,9 @@ int nas_message_decode(
}
/* Compute offset of the sequence number field */
- int offset = size - sizeof(UInt8_t);
+ int offset = size - sizeof(uint8_t);
/* Compute the NAS message authentication code */
- UInt32_t mac = _nas_message_get_mac(
+ uint32_t mac = _nas_message_get_mac(
buffer + offset,
length - offset,
#ifdef NAS_MME
@@ -524,13 +524,13 @@ int nas_message_encode(
/* Integrity protect the NAS message */
if (bytes > 0) {
/* Compute offset of the sequence number field */
- int offset = size - sizeof(UInt8_t);
+ int offset = size - sizeof(uint8_t);
/* Compute the NAS message authentication code */
LOG_TRACE(DEBUG,
"offset %d = %d - %d, hdr encode = %d, length = %d bytes = %d",
- offset, size, sizeof(UInt8_t),
+ offset, size, sizeof(uint8_t),
size, length, bytes);
- UInt32_t mac = _nas_message_get_mac(
+ uint32_t mac = _nas_message_get_mac(
buffer + offset,
bytes + size - offset,
#ifdef NAS_MME
@@ -540,7 +540,7 @@ int nas_message_encode(
#endif
emm_security_context);
/* Set the message authentication code of the NAS message */
- *(UInt32_t*)(buffer + sizeof(UInt8_t)) = htonl(mac);
+ *(uint32_t*)(buffer + sizeof(uint8_t)) = htonl(mac);
if (emm_security_context) {
#ifdef NAS_MME
@@ -644,7 +644,7 @@ _nas_message_header_decode(
/* Decode the first octet of the header (security header type or EPS bearer
* identity, and protocol discriminator) */
- DECODE_U8(buffer, *(UInt8_t*)(header), size);
+ DECODE_U8(buffer, *(uint8_t*)(header), size);
if (header->protocol_discriminator == EPS_MOBILITY_MANAGEMENT_MESSAGE) {
if (header->security_header_type != SECURITY_HEADER_TYPE_NOT_PROTECTED) {
@@ -798,7 +798,7 @@ static int _nas_message_header_encode(
/* Encode the first octet of the header (security header type or EPS bearer
* identity, and protocol discriminator) */
- ENCODE_U8(buffer, *(UInt8_t*)(header), size);
+ ENCODE_U8(buffer, *(uint8_t*)(header), size);
if (header->protocol_discriminator == EPS_MOBILITY_MANAGEMENT_MESSAGE) {
if (header->security_header_type != SECURITY_HEADER_TYPE_NOT_PROTECTED) {
@@ -956,9 +956,9 @@ static int _nas_message_protected_encode(
static int _nas_message_decrypt(
char *dest,
const char *src,
- UInt8_t security_header_type,
- UInt32_t code,
- UInt8_t seq,
+ uint8_t security_header_type,
+ uint32_t code,
+ uint8_t seq,
int length,
const emm_security_context_t * const emm_security_context)
{
@@ -986,7 +986,7 @@ static int _nas_message_decrypt(
"No decryption of message length %u according to security header type 0x%02x",
length, security_header_type);
memcpy(dest, src, length);
- DECODE_U8(dest, *(UInt8_t*)(&header), size);
+ DECODE_U8(dest, *(uint8_t*)(&header), size);
LOG_FUNC_RETURN (header.protocol_discriminator);
//LOG_FUNC_RETURN (length);
break;
@@ -1022,7 +1022,7 @@ static int _nas_message_decrypt(
nas_stream_encrypt_eea1(&stream_cipher, dest);
/* Decode the first octet (security header type or EPS bearer identity,
* and protocol discriminator) */
- DECODE_U8(dest, *(UInt8_t*)(&header), size);
+ DECODE_U8(dest, *(uint8_t*)(&header), size);
LOG_FUNC_RETURN (header.protocol_discriminator);
@@ -1056,7 +1056,7 @@ static int _nas_message_decrypt(
nas_stream_encrypt_eea1(&stream_cipher, dest);
/* Decode the first octet (security header type or EPS bearer identity,
* and protocol discriminator) */
- DECODE_U8(dest, *(UInt8_t*)(&header), size);
+ DECODE_U8(dest, *(uint8_t*)(&header), size);
LOG_FUNC_RETURN (header.protocol_discriminator);
}
@@ -1071,7 +1071,7 @@ static int _nas_message_decrypt(
memcpy(dest, src, length);
/* Decode the first octet (security header type or EPS bearer identity,
* and protocol discriminator) */
- DECODE_U8(dest, *(UInt8_t*)(&header), size);
+ DECODE_U8(dest, *(uint8_t*)(&header), size);
LOG_FUNC_RETURN (header.protocol_discriminator);
@@ -1084,7 +1084,7 @@ static int _nas_message_decrypt(
memcpy(dest, src, length);
/* Decode the first octet (security header type or EPS bearer identity,
* and protocol discriminator) */
- DECODE_U8(dest, *(UInt8_t*)(&header), size);
+ DECODE_U8(dest, *(uint8_t*)(&header), size);
LOG_FUNC_RETURN (header.protocol_discriminator);
break;
@@ -1124,9 +1124,9 @@ static int _nas_message_decrypt(
static int _nas_message_encrypt(
char *dest,
const char *src,
- UInt8_t security_header_type,
- UInt32_t code,
- UInt8_t seq,
+ uint8_t security_header_type,
+ uint32_t code,
+ uint8_t seq,
int const direction,
int length,
const emm_security_context_t * const emm_security_context)
@@ -1274,7 +1274,7 @@ static int _nas_message_encrypt(
** Others: None **
** **
***************************************************************************/
-static UInt32_t _nas_message_get_mac(
+static uint32_t _nas_message_get_mac(
const char * const buffer,
int const length,
int const direction,
@@ -1296,10 +1296,10 @@ static UInt32_t _nas_message_get_mac(
switch (emm_security_context->selected_algorithms.integrity) {
case NAS_SECURITY_ALGORITHMS_EIA1: {
- UInt8_t mac[4];
+ uint8_t mac[4];
nas_stream_cipher_t stream_cipher;
- UInt32_t count;
- UInt32_t *mac32;
+ uint32_t count;
+ uint32_t *mac32;
int i,bytes = 0;
@@ -1354,20 +1354,20 @@ static UInt32_t _nas_message_get_mac(
LOG_TRACE(DEBUG,
"NAS_SECURITY_ALGORITHMS_EIA1 returned MAC %x.%x.%x.%x(%u) for length %d direction %d, count %d",
mac[0], mac[1], mac[2],mac[3],
- *((UInt32_t*)&mac),
+ *((uint32_t*)&mac),
length,
direction,
count);
- mac32 = (UInt32_t*)&mac;
+ mac32 = (uint32_t*)&mac;
LOG_FUNC_RETURN (ntohl(*mac32));
}
break;
case NAS_SECURITY_ALGORITHMS_EIA2: {
- UInt8_t mac[4];
+ uint8_t mac[4];
nas_stream_cipher_t stream_cipher;
- UInt32_t count;
- UInt32_t *mac32;
+ uint32_t count;
+ uint32_t *mac32;
if (direction == SECU_DIRECTION_UPLINK) {
count = 0x00000000 ||
@@ -1400,11 +1400,11 @@ static UInt32_t _nas_message_get_mac(
LOG_TRACE(DEBUG,
"NAS_SECURITY_ALGORITHMS_EIA2 returned MAC %x.%x.%x.%x(%u) for length %d direction %d, count %d",
mac[0], mac[1], mac[2],mac[3],
- *((UInt32_t*)&mac),
+ *((uint32_t*)&mac),
length,
direction,
count);
- mac32 = (UInt32_t*)&mac;
+ mac32 = (uint32_t*)&mac;
LOG_FUNC_RETURN (ntohl(*mac32));
}
break;
diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/network/nas_message.h b/openair-cn/NAS/COMMON/API/NETWORK/nas_message.h
similarity index 95%
rename from openair-cn/NAS/EURECOM-NAS/src/api/network/nas_message.h
rename to openair-cn/NAS/COMMON/API/NETWORK/nas_message.h
index d7d09f1145..f4187b7396 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/api/network/nas_message.h
+++ b/openair-cn/NAS/COMMON/API/NETWORK/nas_message.h
@@ -68,14 +68,14 @@ Description Defines the layer 3 messages supported by the NAS sublayer
typedef struct {
#ifdef __LITTLE_ENDIAN_BITFIELD
eps_protocol_discriminator_t protocol_discriminator:4;
- UInt8_t security_header_type:4;
+ uint8_t security_header_type:4;
#endif
#ifdef __BIG_ENDIAN_BITFIELD
- UInt8_t security_header_type:4;
- UInt8_t protocol_discriminator:4;
+ uint8_t security_header_type:4;
+ uint8_t protocol_discriminator:4;
#endif
- UInt32_t message_authentication_code;
- UInt8_t sequence_number;
+ uint32_t message_authentication_code;
+ uint8_t sequence_number;
} nas_message_security_header_t;
/* Structure of plain NAS message */
diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/network/network_api.c b/openair-cn/NAS/COMMON/API/NETWORK/network_api.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/api/network/network_api.c
rename to openair-cn/NAS/COMMON/API/NETWORK/network_api.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/network/network_api.h b/openair-cn/NAS/COMMON/API/NETWORK/network_api.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/api/network/network_api.h
rename to openair-cn/NAS/COMMON/API/NETWORK/network_api.h
diff --git a/openair-cn/NAS/EURECOM-NAS/bin/COPYING b/openair-cn/NAS/COMMON/COPYING
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/bin/COPYING
rename to openair-cn/NAS/COMMON/COPYING
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AttachAccept.c b/openair-cn/NAS/COMMON/EMM/MSG/AttachAccept.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/AttachAccept.c
rename to openair-cn/NAS/COMMON/EMM/MSG/AttachAccept.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AttachAccept.h b/openair-cn/NAS/COMMON/EMM/MSG/AttachAccept.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/AttachAccept.h
rename to openair-cn/NAS/COMMON/EMM/MSG/AttachAccept.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AttachComplete.c b/openair-cn/NAS/COMMON/EMM/MSG/AttachComplete.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/AttachComplete.c
rename to openair-cn/NAS/COMMON/EMM/MSG/AttachComplete.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AttachComplete.h b/openair-cn/NAS/COMMON/EMM/MSG/AttachComplete.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/AttachComplete.h
rename to openair-cn/NAS/COMMON/EMM/MSG/AttachComplete.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AttachReject.c b/openair-cn/NAS/COMMON/EMM/MSG/AttachReject.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/AttachReject.c
rename to openair-cn/NAS/COMMON/EMM/MSG/AttachReject.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AttachReject.h b/openair-cn/NAS/COMMON/EMM/MSG/AttachReject.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/AttachReject.h
rename to openair-cn/NAS/COMMON/EMM/MSG/AttachReject.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AttachRequest.c b/openair-cn/NAS/COMMON/EMM/MSG/AttachRequest.c
similarity index 93%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/AttachRequest.c
rename to openair-cn/NAS/COMMON/EMM/MSG/AttachRequest.c
index 15a29b1f29..f301b44a86 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/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/EURECOM-NAS/src/emm/msg/AttachRequest.h b/openair-cn/NAS/COMMON/EMM/MSG/AttachRequest.h
similarity index 95%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/AttachRequest.h
rename to openair-cn/NAS/COMMON/EMM/MSG/AttachRequest.h
index 5368df7fc7..f19c53f1ad 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/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/EURECOM-NAS/src/emm/msg/AuthenticationFailure.c b/openair-cn/NAS/COMMON/EMM/MSG/AuthenticationFailure.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/AuthenticationFailure.c
rename to openair-cn/NAS/COMMON/EMM/MSG/AuthenticationFailure.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AuthenticationFailure.h b/openair-cn/NAS/COMMON/EMM/MSG/AuthenticationFailure.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/AuthenticationFailure.h
rename to openair-cn/NAS/COMMON/EMM/MSG/AuthenticationFailure.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AuthenticationReject.c b/openair-cn/NAS/COMMON/EMM/MSG/AuthenticationReject.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/AuthenticationReject.c
rename to openair-cn/NAS/COMMON/EMM/MSG/AuthenticationReject.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AuthenticationReject.h b/openair-cn/NAS/COMMON/EMM/MSG/AuthenticationReject.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/AuthenticationReject.h
rename to openair-cn/NAS/COMMON/EMM/MSG/AuthenticationReject.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AuthenticationRequest.c b/openair-cn/NAS/COMMON/EMM/MSG/AuthenticationRequest.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/AuthenticationRequest.c
rename to openair-cn/NAS/COMMON/EMM/MSG/AuthenticationRequest.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AuthenticationRequest.h b/openair-cn/NAS/COMMON/EMM/MSG/AuthenticationRequest.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/AuthenticationRequest.h
rename to openair-cn/NAS/COMMON/EMM/MSG/AuthenticationRequest.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AuthenticationResponse.c b/openair-cn/NAS/COMMON/EMM/MSG/AuthenticationResponse.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/AuthenticationResponse.c
rename to openair-cn/NAS/COMMON/EMM/MSG/AuthenticationResponse.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AuthenticationResponse.h b/openair-cn/NAS/COMMON/EMM/MSG/AuthenticationResponse.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/AuthenticationResponse.h
rename to openair-cn/NAS/COMMON/EMM/MSG/AuthenticationResponse.h
diff --git a/openair-cn/NAS/EURECOM-NAS/lib/COPYING b/openair-cn/NAS/COMMON/EMM/MSG/COPYING
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/lib/COPYING
rename to openair-cn/NAS/COMMON/EMM/MSG/COPYING
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/CsServiceNotification.c b/openair-cn/NAS/COMMON/EMM/MSG/CsServiceNotification.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/CsServiceNotification.c
rename to openair-cn/NAS/COMMON/EMM/MSG/CsServiceNotification.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/CsServiceNotification.h b/openair-cn/NAS/COMMON/EMM/MSG/CsServiceNotification.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/CsServiceNotification.h
rename to openair-cn/NAS/COMMON/EMM/MSG/CsServiceNotification.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/DetachAccept.c b/openair-cn/NAS/COMMON/EMM/MSG/DetachAccept.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/DetachAccept.c
rename to openair-cn/NAS/COMMON/EMM/MSG/DetachAccept.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/DetachAccept.h b/openair-cn/NAS/COMMON/EMM/MSG/DetachAccept.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/DetachAccept.h
rename to openair-cn/NAS/COMMON/EMM/MSG/DetachAccept.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/DetachRequest.c b/openair-cn/NAS/COMMON/EMM/MSG/DetachRequest.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/DetachRequest.c
rename to openair-cn/NAS/COMMON/EMM/MSG/DetachRequest.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/DetachRequest.h b/openair-cn/NAS/COMMON/EMM/MSG/DetachRequest.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/DetachRequest.h
rename to openair-cn/NAS/COMMON/EMM/MSG/DetachRequest.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/DownlinkNasTransport.c b/openair-cn/NAS/COMMON/EMM/MSG/DownlinkNasTransport.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/DownlinkNasTransport.c
rename to openair-cn/NAS/COMMON/EMM/MSG/DownlinkNasTransport.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/DownlinkNasTransport.h b/openair-cn/NAS/COMMON/EMM/MSG/DownlinkNasTransport.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/DownlinkNasTransport.h
rename to openair-cn/NAS/COMMON/EMM/MSG/DownlinkNasTransport.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/EmmInformation.c b/openair-cn/NAS/COMMON/EMM/MSG/EmmInformation.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/EmmInformation.c
rename to openair-cn/NAS/COMMON/EMM/MSG/EmmInformation.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/EmmInformation.h b/openair-cn/NAS/COMMON/EMM/MSG/EmmInformation.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/EmmInformation.h
rename to openair-cn/NAS/COMMON/EMM/MSG/EmmInformation.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/EmmStatus.c b/openair-cn/NAS/COMMON/EMM/MSG/EmmStatus.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/EmmStatus.c
rename to openair-cn/NAS/COMMON/EMM/MSG/EmmStatus.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/EmmStatus.h b/openair-cn/NAS/COMMON/EMM/MSG/EmmStatus.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/EmmStatus.h
rename to openair-cn/NAS/COMMON/EMM/MSG/EmmStatus.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/ExtendedServiceRequest.c b/openair-cn/NAS/COMMON/EMM/MSG/ExtendedServiceRequest.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/ExtendedServiceRequest.c
rename to openair-cn/NAS/COMMON/EMM/MSG/ExtendedServiceRequest.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/ExtendedServiceRequest.h b/openair-cn/NAS/COMMON/EMM/MSG/ExtendedServiceRequest.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/ExtendedServiceRequest.h
rename to openair-cn/NAS/COMMON/EMM/MSG/ExtendedServiceRequest.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/GutiReallocationCommand.c b/openair-cn/NAS/COMMON/EMM/MSG/GutiReallocationCommand.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/GutiReallocationCommand.c
rename to openair-cn/NAS/COMMON/EMM/MSG/GutiReallocationCommand.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/GutiReallocationCommand.h b/openair-cn/NAS/COMMON/EMM/MSG/GutiReallocationCommand.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/GutiReallocationCommand.h
rename to openair-cn/NAS/COMMON/EMM/MSG/GutiReallocationCommand.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/GutiReallocationComplete.c b/openair-cn/NAS/COMMON/EMM/MSG/GutiReallocationComplete.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/GutiReallocationComplete.c
rename to openair-cn/NAS/COMMON/EMM/MSG/GutiReallocationComplete.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/GutiReallocationComplete.h b/openair-cn/NAS/COMMON/EMM/MSG/GutiReallocationComplete.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/GutiReallocationComplete.h
rename to openair-cn/NAS/COMMON/EMM/MSG/GutiReallocationComplete.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/IdentityRequest.c b/openair-cn/NAS/COMMON/EMM/MSG/IdentityRequest.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/IdentityRequest.c
rename to openair-cn/NAS/COMMON/EMM/MSG/IdentityRequest.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/IdentityRequest.h b/openair-cn/NAS/COMMON/EMM/MSG/IdentityRequest.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/IdentityRequest.h
rename to openair-cn/NAS/COMMON/EMM/MSG/IdentityRequest.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/IdentityResponse.c b/openair-cn/NAS/COMMON/EMM/MSG/IdentityResponse.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/IdentityResponse.c
rename to openair-cn/NAS/COMMON/EMM/MSG/IdentityResponse.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/IdentityResponse.h b/openair-cn/NAS/COMMON/EMM/MSG/IdentityResponse.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/IdentityResponse.h
rename to openair-cn/NAS/COMMON/EMM/MSG/IdentityResponse.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/Makefile b/openair-cn/NAS/COMMON/EMM/MSG/Makefile
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/Makefile
rename to openair-cn/NAS/COMMON/EMM/MSG/Makefile
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/NASSecurityModeCommand.h b/openair-cn/NAS/COMMON/EMM/MSG/NASSecurityModeCommand.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/NASSecurityModeCommand.h
rename to openair-cn/NAS/COMMON/EMM/MSG/NASSecurityModeCommand.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/NASSecurityModeComplete.h b/openair-cn/NAS/COMMON/EMM/MSG/NASSecurityModeComplete.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/NASSecurityModeComplete.h
rename to openair-cn/NAS/COMMON/EMM/MSG/NASSecurityModeComplete.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/SecurityModeCommand.c b/openair-cn/NAS/COMMON/EMM/MSG/SecurityModeCommand.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/SecurityModeCommand.c
rename to openair-cn/NAS/COMMON/EMM/MSG/SecurityModeCommand.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/SecurityModeComplete.c b/openair-cn/NAS/COMMON/EMM/MSG/SecurityModeComplete.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/SecurityModeComplete.c
rename to openair-cn/NAS/COMMON/EMM/MSG/SecurityModeComplete.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/SecurityModeReject.c b/openair-cn/NAS/COMMON/EMM/MSG/SecurityModeReject.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/SecurityModeReject.c
rename to openair-cn/NAS/COMMON/EMM/MSG/SecurityModeReject.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/SecurityModeReject.h b/openair-cn/NAS/COMMON/EMM/MSG/SecurityModeReject.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/SecurityModeReject.h
rename to openair-cn/NAS/COMMON/EMM/MSG/SecurityModeReject.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/ServiceReject.c b/openair-cn/NAS/COMMON/EMM/MSG/ServiceReject.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/ServiceReject.c
rename to openair-cn/NAS/COMMON/EMM/MSG/ServiceReject.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/ServiceReject.h b/openair-cn/NAS/COMMON/EMM/MSG/ServiceReject.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/ServiceReject.h
rename to openair-cn/NAS/COMMON/EMM/MSG/ServiceReject.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/ServiceRequest.c b/openair-cn/NAS/COMMON/EMM/MSG/ServiceRequest.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/ServiceRequest.c
rename to openair-cn/NAS/COMMON/EMM/MSG/ServiceRequest.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/ServiceRequest.h b/openair-cn/NAS/COMMON/EMM/MSG/ServiceRequest.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/ServiceRequest.h
rename to openair-cn/NAS/COMMON/EMM/MSG/ServiceRequest.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/TrackingAreaUpdateAccept.c b/openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateAccept.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/TrackingAreaUpdateAccept.c
rename to openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateAccept.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/TrackingAreaUpdateAccept.h b/openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateAccept.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/TrackingAreaUpdateAccept.h
rename to openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateAccept.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/TrackingAreaUpdateComplete.c b/openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateComplete.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/TrackingAreaUpdateComplete.c
rename to openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateComplete.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/TrackingAreaUpdateComplete.h b/openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateComplete.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/TrackingAreaUpdateComplete.h
rename to openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateComplete.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/TrackingAreaUpdateReject.c b/openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateReject.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/TrackingAreaUpdateReject.c
rename to openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateReject.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/TrackingAreaUpdateReject.h b/openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateReject.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/TrackingAreaUpdateReject.h
rename to openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateReject.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/TrackingAreaUpdateRequest.c b/openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateRequest.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/TrackingAreaUpdateRequest.c
rename to openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateRequest.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/TrackingAreaUpdateRequest.h b/openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateRequest.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/TrackingAreaUpdateRequest.h
rename to openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateRequest.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/UplinkNasTransport.c b/openair-cn/NAS/COMMON/EMM/MSG/UplinkNasTransport.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/UplinkNasTransport.c
rename to openair-cn/NAS/COMMON/EMM/MSG/UplinkNasTransport.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/UplinkNasTransport.h b/openair-cn/NAS/COMMON/EMM/MSG/UplinkNasTransport.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/UplinkNasTransport.h
rename to openair-cn/NAS/COMMON/EMM/MSG/UplinkNasTransport.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/emm_cause.h b/openair-cn/NAS/COMMON/EMM/MSG/emm_cause.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/emm_cause.h
rename to openair-cn/NAS/COMMON/EMM/MSG/emm_cause.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/emm_msg.c b/openair-cn/NAS/COMMON/EMM/MSG/emm_msg.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/emm_msg.c
rename to openair-cn/NAS/COMMON/EMM/MSG/emm_msg.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/emm_msg.h b/openair-cn/NAS/COMMON/EMM/MSG/emm_msg.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/emm_msg.h
rename to openair-cn/NAS/COMMON/EMM/MSG/emm_msg.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/emm_msgDef.h b/openair-cn/NAS/COMMON/EMM/MSG/emm_msgDef.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/emm_msgDef.h
rename to openair-cn/NAS/COMMON/EMM/MSG/emm_msgDef.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDedicatedEpsBearerContextAccept.c b/openair-cn/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextAccept.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDedicatedEpsBearerContextAccept.c
rename to openair-cn/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextAccept.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDedicatedEpsBearerContextAccept.h b/openair-cn/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextAccept.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDedicatedEpsBearerContextAccept.h
rename to openair-cn/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextAccept.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDedicatedEpsBearerContextReject.c b/openair-cn/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextReject.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDedicatedEpsBearerContextReject.c
rename to openair-cn/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextReject.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDedicatedEpsBearerContextReject.h b/openair-cn/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextReject.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDedicatedEpsBearerContextReject.h
rename to openair-cn/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextReject.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDedicatedEpsBearerContextRequest.c b/openair-cn/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextRequest.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDedicatedEpsBearerContextRequest.c
rename to openair-cn/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextRequest.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDedicatedEpsBearerContextRequest.h b/openair-cn/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextRequest.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDedicatedEpsBearerContextRequest.h
rename to openair-cn/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextRequest.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDefaultEpsBearerContextAccept.c b/openair-cn/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextAccept.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDefaultEpsBearerContextAccept.c
rename to openair-cn/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextAccept.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDefaultEpsBearerContextAccept.h b/openair-cn/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextAccept.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDefaultEpsBearerContextAccept.h
rename to openair-cn/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextAccept.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDefaultEpsBearerContextReject.c b/openair-cn/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextReject.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDefaultEpsBearerContextReject.c
rename to openair-cn/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextReject.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDefaultEpsBearerContextReject.h b/openair-cn/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextReject.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDefaultEpsBearerContextReject.h
rename to openair-cn/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextReject.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDefaultEpsBearerContextRequest.c b/openair-cn/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextRequest.c
similarity index 99%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDefaultEpsBearerContextRequest.c
rename to openair-cn/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextRequest.c
index 578f53f75a..3dec0a429a 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDefaultEpsBearerContextRequest.c
+++ b/openair-cn/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextRequest.c
@@ -297,7 +297,7 @@ int encode_activate_default_eps_bearer_context_request(activate_default_eps_bear
encoded += encode_result;
}
-#if 1 /* LW: force Protocol Configuration Options to be included in the ESM message */
+#if 0 /* LW: force Protocol Configuration Options to be included in the ESM message */
{
#define CONFIGURATION_PROTOCOL_PPP 0
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDefaultEpsBearerContextRequest.h b/openair-cn/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextRequest.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDefaultEpsBearerContextRequest.h
rename to openair-cn/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextRequest.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/BearerResourceAllocationReject.c b/openair-cn/NAS/COMMON/ESM/MSG/BearerResourceAllocationReject.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/BearerResourceAllocationReject.c
rename to openair-cn/NAS/COMMON/ESM/MSG/BearerResourceAllocationReject.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/BearerResourceAllocationReject.h b/openair-cn/NAS/COMMON/ESM/MSG/BearerResourceAllocationReject.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/BearerResourceAllocationReject.h
rename to openair-cn/NAS/COMMON/ESM/MSG/BearerResourceAllocationReject.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/BearerResourceAllocationRequest.c b/openair-cn/NAS/COMMON/ESM/MSG/BearerResourceAllocationRequest.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/BearerResourceAllocationRequest.c
rename to openair-cn/NAS/COMMON/ESM/MSG/BearerResourceAllocationRequest.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/BearerResourceAllocationRequest.h b/openair-cn/NAS/COMMON/ESM/MSG/BearerResourceAllocationRequest.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/BearerResourceAllocationRequest.h
rename to openair-cn/NAS/COMMON/ESM/MSG/BearerResourceAllocationRequest.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/BearerResourceModificationReject.c b/openair-cn/NAS/COMMON/ESM/MSG/BearerResourceModificationReject.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/BearerResourceModificationReject.c
rename to openair-cn/NAS/COMMON/ESM/MSG/BearerResourceModificationReject.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/BearerResourceModificationReject.h b/openair-cn/NAS/COMMON/ESM/MSG/BearerResourceModificationReject.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/BearerResourceModificationReject.h
rename to openair-cn/NAS/COMMON/ESM/MSG/BearerResourceModificationReject.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/BearerResourceModificationRequest.c b/openair-cn/NAS/COMMON/ESM/MSG/BearerResourceModificationRequest.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/BearerResourceModificationRequest.c
rename to openair-cn/NAS/COMMON/ESM/MSG/BearerResourceModificationRequest.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/BearerResourceModificationRequest.h b/openair-cn/NAS/COMMON/ESM/MSG/BearerResourceModificationRequest.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/BearerResourceModificationRequest.h
rename to openair-cn/NAS/COMMON/ESM/MSG/BearerResourceModificationRequest.h
diff --git a/openair-cn/NAS/EURECOM-NAS/libMME/COPYING b/openair-cn/NAS/COMMON/ESM/MSG/COPYING
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/libMME/COPYING
rename to openair-cn/NAS/COMMON/ESM/MSG/COPYING
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/DeactivateEpsBearerContextAccept.c b/openair-cn/NAS/COMMON/ESM/MSG/DeactivateEpsBearerContextAccept.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/DeactivateEpsBearerContextAccept.c
rename to openair-cn/NAS/COMMON/ESM/MSG/DeactivateEpsBearerContextAccept.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/DeactivateEpsBearerContextAccept.h b/openair-cn/NAS/COMMON/ESM/MSG/DeactivateEpsBearerContextAccept.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/DeactivateEpsBearerContextAccept.h
rename to openair-cn/NAS/COMMON/ESM/MSG/DeactivateEpsBearerContextAccept.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/DeactivateEpsBearerContextRequest.c b/openair-cn/NAS/COMMON/ESM/MSG/DeactivateEpsBearerContextRequest.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/DeactivateEpsBearerContextRequest.c
rename to openair-cn/NAS/COMMON/ESM/MSG/DeactivateEpsBearerContextRequest.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/DeactivateEpsBearerContextRequest.h b/openair-cn/NAS/COMMON/ESM/MSG/DeactivateEpsBearerContextRequest.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/DeactivateEpsBearerContextRequest.h
rename to openair-cn/NAS/COMMON/ESM/MSG/DeactivateEpsBearerContextRequest.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/EsmInformationRequest.c b/openair-cn/NAS/COMMON/ESM/MSG/EsmInformationRequest.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/EsmInformationRequest.c
rename to openair-cn/NAS/COMMON/ESM/MSG/EsmInformationRequest.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/EsmInformationRequest.h b/openair-cn/NAS/COMMON/ESM/MSG/EsmInformationRequest.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/EsmInformationRequest.h
rename to openair-cn/NAS/COMMON/ESM/MSG/EsmInformationRequest.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/EsmInformationResponse.c b/openair-cn/NAS/COMMON/ESM/MSG/EsmInformationResponse.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/EsmInformationResponse.c
rename to openair-cn/NAS/COMMON/ESM/MSG/EsmInformationResponse.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/EsmInformationResponse.h b/openair-cn/NAS/COMMON/ESM/MSG/EsmInformationResponse.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/EsmInformationResponse.h
rename to openair-cn/NAS/COMMON/ESM/MSG/EsmInformationResponse.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/EsmStatus.c b/openair-cn/NAS/COMMON/ESM/MSG/EsmStatus.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/EsmStatus.c
rename to openair-cn/NAS/COMMON/ESM/MSG/EsmStatus.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/EsmStatus.h b/openair-cn/NAS/COMMON/ESM/MSG/EsmStatus.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/EsmStatus.h
rename to openair-cn/NAS/COMMON/ESM/MSG/EsmStatus.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/Makefile b/openair-cn/NAS/COMMON/ESM/MSG/Makefile
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/Makefile
rename to openair-cn/NAS/COMMON/ESM/MSG/Makefile
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ModifyEpsBearerContextAccept.c b/openair-cn/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextAccept.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/ModifyEpsBearerContextAccept.c
rename to openair-cn/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextAccept.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ModifyEpsBearerContextAccept.h b/openair-cn/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextAccept.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/ModifyEpsBearerContextAccept.h
rename to openair-cn/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextAccept.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ModifyEpsBearerContextReject.c b/openair-cn/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextReject.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/ModifyEpsBearerContextReject.c
rename to openair-cn/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextReject.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ModifyEpsBearerContextReject.h b/openair-cn/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextReject.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/ModifyEpsBearerContextReject.h
rename to openair-cn/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextReject.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ModifyEpsBearerContextRequest.c b/openair-cn/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextRequest.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/ModifyEpsBearerContextRequest.c
rename to openair-cn/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextRequest.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ModifyEpsBearerContextRequest.h b/openair-cn/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextRequest.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/ModifyEpsBearerContextRequest.h
rename to openair-cn/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextRequest.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/PdnConnectivityReject.c b/openair-cn/NAS/COMMON/ESM/MSG/PdnConnectivityReject.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/PdnConnectivityReject.c
rename to openair-cn/NAS/COMMON/ESM/MSG/PdnConnectivityReject.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/PdnConnectivityReject.h b/openair-cn/NAS/COMMON/ESM/MSG/PdnConnectivityReject.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/PdnConnectivityReject.h
rename to openair-cn/NAS/COMMON/ESM/MSG/PdnConnectivityReject.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/PdnConnectivityRequest.c b/openair-cn/NAS/COMMON/ESM/MSG/PdnConnectivityRequest.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/PdnConnectivityRequest.c
rename to openair-cn/NAS/COMMON/ESM/MSG/PdnConnectivityRequest.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/PdnConnectivityRequest.h b/openair-cn/NAS/COMMON/ESM/MSG/PdnConnectivityRequest.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/PdnConnectivityRequest.h
rename to openair-cn/NAS/COMMON/ESM/MSG/PdnConnectivityRequest.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/PdnDisconnectReject.c b/openair-cn/NAS/COMMON/ESM/MSG/PdnDisconnectReject.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/PdnDisconnectReject.c
rename to openair-cn/NAS/COMMON/ESM/MSG/PdnDisconnectReject.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/PdnDisconnectReject.h b/openair-cn/NAS/COMMON/ESM/MSG/PdnDisconnectReject.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/PdnDisconnectReject.h
rename to openair-cn/NAS/COMMON/ESM/MSG/PdnDisconnectReject.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/PdnDisconnectRequest.c b/openair-cn/NAS/COMMON/ESM/MSG/PdnDisconnectRequest.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/PdnDisconnectRequest.c
rename to openair-cn/NAS/COMMON/ESM/MSG/PdnDisconnectRequest.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/PdnDisconnectRequest.h b/openair-cn/NAS/COMMON/ESM/MSG/PdnDisconnectRequest.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/PdnDisconnectRequest.h
rename to openair-cn/NAS/COMMON/ESM/MSG/PdnDisconnectRequest.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/esm_cause.h b/openair-cn/NAS/COMMON/ESM/MSG/esm_cause.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/esm_cause.h
rename to openair-cn/NAS/COMMON/ESM/MSG/esm_cause.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/esm_msg.c b/openair-cn/NAS/COMMON/ESM/MSG/esm_msg.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/esm_msg.c
rename to openair-cn/NAS/COMMON/ESM/MSG/esm_msg.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/esm_msg.h b/openair-cn/NAS/COMMON/ESM/MSG/esm_msg.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/esm_msg.h
rename to openair-cn/NAS/COMMON/ESM/MSG/esm_msg.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/esm_msgDef.h b/openair-cn/NAS/COMMON/ESM/MSG/esm_msgDef.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/esm_msgDef.h
rename to openair-cn/NAS/COMMON/ESM/MSG/esm_msgDef.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/AccessPointName.c b/openair-cn/NAS/COMMON/IES/AccessPointName.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/AccessPointName.c
rename to openair-cn/NAS/COMMON/IES/AccessPointName.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/AccessPointName.h b/openair-cn/NAS/COMMON/IES/AccessPointName.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/AccessPointName.h
rename to openair-cn/NAS/COMMON/IES/AccessPointName.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/AdditionalUpdateResult.c b/openair-cn/NAS/COMMON/IES/AdditionalUpdateResult.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/AdditionalUpdateResult.c
rename to openair-cn/NAS/COMMON/IES/AdditionalUpdateResult.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/AdditionalUpdateResult.h b/openair-cn/NAS/COMMON/IES/AdditionalUpdateResult.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/AdditionalUpdateResult.h
rename to openair-cn/NAS/COMMON/IES/AdditionalUpdateResult.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/AdditionalUpdateType.c b/openair-cn/NAS/COMMON/IES/AdditionalUpdateType.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/AdditionalUpdateType.c
rename to openair-cn/NAS/COMMON/IES/AdditionalUpdateType.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/AdditionalUpdateType.h b/openair-cn/NAS/COMMON/IES/AdditionalUpdateType.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/AdditionalUpdateType.h
rename to openair-cn/NAS/COMMON/IES/AdditionalUpdateType.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/ApnAggregateMaximumBitRate.c b/openair-cn/NAS/COMMON/IES/ApnAggregateMaximumBitRate.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/ApnAggregateMaximumBitRate.c
rename to openair-cn/NAS/COMMON/IES/ApnAggregateMaximumBitRate.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/ApnAggregateMaximumBitRate.h b/openair-cn/NAS/COMMON/IES/ApnAggregateMaximumBitRate.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/ApnAggregateMaximumBitRate.h
rename to openair-cn/NAS/COMMON/IES/ApnAggregateMaximumBitRate.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/AuthenticationFailureParameter.c b/openair-cn/NAS/COMMON/IES/AuthenticationFailureParameter.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/AuthenticationFailureParameter.c
rename to openair-cn/NAS/COMMON/IES/AuthenticationFailureParameter.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/AuthenticationFailureParameter.h b/openair-cn/NAS/COMMON/IES/AuthenticationFailureParameter.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/AuthenticationFailureParameter.h
rename to openair-cn/NAS/COMMON/IES/AuthenticationFailureParameter.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/AuthenticationParameterAutn.c b/openair-cn/NAS/COMMON/IES/AuthenticationParameterAutn.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/AuthenticationParameterAutn.c
rename to openair-cn/NAS/COMMON/IES/AuthenticationParameterAutn.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/AuthenticationParameterAutn.h b/openair-cn/NAS/COMMON/IES/AuthenticationParameterAutn.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/AuthenticationParameterAutn.h
rename to openair-cn/NAS/COMMON/IES/AuthenticationParameterAutn.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/AuthenticationParameterRand.c b/openair-cn/NAS/COMMON/IES/AuthenticationParameterRand.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/AuthenticationParameterRand.c
rename to openair-cn/NAS/COMMON/IES/AuthenticationParameterRand.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/AuthenticationParameterRand.h b/openair-cn/NAS/COMMON/IES/AuthenticationParameterRand.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/AuthenticationParameterRand.h
rename to openair-cn/NAS/COMMON/IES/AuthenticationParameterRand.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/AuthenticationResponseParameter.c b/openair-cn/NAS/COMMON/IES/AuthenticationResponseParameter.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/AuthenticationResponseParameter.c
rename to openair-cn/NAS/COMMON/IES/AuthenticationResponseParameter.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/AuthenticationResponseParameter.h b/openair-cn/NAS/COMMON/IES/AuthenticationResponseParameter.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/AuthenticationResponseParameter.h
rename to openair-cn/NAS/COMMON/IES/AuthenticationResponseParameter.h
diff --git a/openair-cn/NAS/EURECOM-NAS/libUE/COPYING b/openair-cn/NAS/COMMON/IES/COPYING
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/libUE/COPYING
rename to openair-cn/NAS/COMMON/IES/COPYING
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/CipheringKeySequenceNumber.c b/openair-cn/NAS/COMMON/IES/CipheringKeySequenceNumber.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/CipheringKeySequenceNumber.c
rename to openair-cn/NAS/COMMON/IES/CipheringKeySequenceNumber.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/CipheringKeySequenceNumber.h b/openair-cn/NAS/COMMON/IES/CipheringKeySequenceNumber.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/CipheringKeySequenceNumber.h
rename to openair-cn/NAS/COMMON/IES/CipheringKeySequenceNumber.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/Cli.c b/openair-cn/NAS/COMMON/IES/Cli.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/Cli.c
rename to openair-cn/NAS/COMMON/IES/Cli.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/Cli.h b/openair-cn/NAS/COMMON/IES/Cli.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/Cli.h
rename to openair-cn/NAS/COMMON/IES/Cli.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/CsfbResponse.c b/openair-cn/NAS/COMMON/IES/CsfbResponse.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/CsfbResponse.c
rename to openair-cn/NAS/COMMON/IES/CsfbResponse.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/CsfbResponse.h b/openair-cn/NAS/COMMON/IES/CsfbResponse.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/CsfbResponse.h
rename to openair-cn/NAS/COMMON/IES/CsfbResponse.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/DaylightSavingTime.c b/openair-cn/NAS/COMMON/IES/DaylightSavingTime.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/DaylightSavingTime.c
rename to openair-cn/NAS/COMMON/IES/DaylightSavingTime.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/DaylightSavingTime.h b/openair-cn/NAS/COMMON/IES/DaylightSavingTime.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/DaylightSavingTime.h
rename to openair-cn/NAS/COMMON/IES/DaylightSavingTime.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/DetachType.c b/openair-cn/NAS/COMMON/IES/DetachType.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/DetachType.c
rename to openair-cn/NAS/COMMON/IES/DetachType.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/DetachType.h b/openair-cn/NAS/COMMON/IES/DetachType.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/DetachType.h
rename to openair-cn/NAS/COMMON/IES/DetachType.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/DrxParameter.c b/openair-cn/NAS/COMMON/IES/DrxParameter.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/DrxParameter.c
rename to openair-cn/NAS/COMMON/IES/DrxParameter.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/DrxParameter.h b/openair-cn/NAS/COMMON/IES/DrxParameter.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/DrxParameter.h
rename to openair-cn/NAS/COMMON/IES/DrxParameter.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EmergencyNumberList.c b/openair-cn/NAS/COMMON/IES/EmergencyNumberList.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/EmergencyNumberList.c
rename to openair-cn/NAS/COMMON/IES/EmergencyNumberList.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EmergencyNumberList.h b/openair-cn/NAS/COMMON/IES/EmergencyNumberList.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/EmergencyNumberList.h
rename to openair-cn/NAS/COMMON/IES/EmergencyNumberList.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EmmCause.c b/openair-cn/NAS/COMMON/IES/EmmCause.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/EmmCause.c
rename to openair-cn/NAS/COMMON/IES/EmmCause.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EmmCause.h b/openair-cn/NAS/COMMON/IES/EmmCause.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/EmmCause.h
rename to openair-cn/NAS/COMMON/IES/EmmCause.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsAttachResult.c b/openair-cn/NAS/COMMON/IES/EpsAttachResult.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/EpsAttachResult.c
rename to openair-cn/NAS/COMMON/IES/EpsAttachResult.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsAttachResult.h b/openair-cn/NAS/COMMON/IES/EpsAttachResult.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/EpsAttachResult.h
rename to openair-cn/NAS/COMMON/IES/EpsAttachResult.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsAttachType.c b/openair-cn/NAS/COMMON/IES/EpsAttachType.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/EpsAttachType.c
rename to openair-cn/NAS/COMMON/IES/EpsAttachType.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsAttachType.h b/openair-cn/NAS/COMMON/IES/EpsAttachType.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/EpsAttachType.h
rename to openair-cn/NAS/COMMON/IES/EpsAttachType.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsBearerContextStatus.c b/openair-cn/NAS/COMMON/IES/EpsBearerContextStatus.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/EpsBearerContextStatus.c
rename to openair-cn/NAS/COMMON/IES/EpsBearerContextStatus.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsBearerContextStatus.h b/openair-cn/NAS/COMMON/IES/EpsBearerContextStatus.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/EpsBearerContextStatus.h
rename to openair-cn/NAS/COMMON/IES/EpsBearerContextStatus.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsBearerIdentity.c b/openair-cn/NAS/COMMON/IES/EpsBearerIdentity.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/EpsBearerIdentity.c
rename to openair-cn/NAS/COMMON/IES/EpsBearerIdentity.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsBearerIdentity.h b/openair-cn/NAS/COMMON/IES/EpsBearerIdentity.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/EpsBearerIdentity.h
rename to openair-cn/NAS/COMMON/IES/EpsBearerIdentity.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsMobileIdentity.c b/openair-cn/NAS/COMMON/IES/EpsMobileIdentity.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/EpsMobileIdentity.c
rename to openair-cn/NAS/COMMON/IES/EpsMobileIdentity.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsMobileIdentity.h b/openair-cn/NAS/COMMON/IES/EpsMobileIdentity.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/EpsMobileIdentity.h
rename to openair-cn/NAS/COMMON/IES/EpsMobileIdentity.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsNetworkFeatureSupport.c b/openair-cn/NAS/COMMON/IES/EpsNetworkFeatureSupport.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/EpsNetworkFeatureSupport.c
rename to openair-cn/NAS/COMMON/IES/EpsNetworkFeatureSupport.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsNetworkFeatureSupport.h b/openair-cn/NAS/COMMON/IES/EpsNetworkFeatureSupport.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/EpsNetworkFeatureSupport.h
rename to openair-cn/NAS/COMMON/IES/EpsNetworkFeatureSupport.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsQualityOfService.c b/openair-cn/NAS/COMMON/IES/EpsQualityOfService.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/EpsQualityOfService.c
rename to openair-cn/NAS/COMMON/IES/EpsQualityOfService.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsQualityOfService.h b/openair-cn/NAS/COMMON/IES/EpsQualityOfService.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/EpsQualityOfService.h
rename to openair-cn/NAS/COMMON/IES/EpsQualityOfService.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsUpdateResult.c b/openair-cn/NAS/COMMON/IES/EpsUpdateResult.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/EpsUpdateResult.c
rename to openair-cn/NAS/COMMON/IES/EpsUpdateResult.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsUpdateResult.h b/openair-cn/NAS/COMMON/IES/EpsUpdateResult.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/EpsUpdateResult.h
rename to openair-cn/NAS/COMMON/IES/EpsUpdateResult.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsUpdateType.c b/openair-cn/NAS/COMMON/IES/EpsUpdateType.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/EpsUpdateType.c
rename to openair-cn/NAS/COMMON/IES/EpsUpdateType.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsUpdateType.h b/openair-cn/NAS/COMMON/IES/EpsUpdateType.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/EpsUpdateType.h
rename to openair-cn/NAS/COMMON/IES/EpsUpdateType.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EsmCause.c b/openair-cn/NAS/COMMON/IES/EsmCause.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/EsmCause.c
rename to openair-cn/NAS/COMMON/IES/EsmCause.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EsmCause.h b/openair-cn/NAS/COMMON/IES/EsmCause.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/EsmCause.h
rename to openair-cn/NAS/COMMON/IES/EsmCause.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EsmInformationTransferFlag.c b/openair-cn/NAS/COMMON/IES/EsmInformationTransferFlag.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/EsmInformationTransferFlag.c
rename to openair-cn/NAS/COMMON/IES/EsmInformationTransferFlag.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EsmInformationTransferFlag.h b/openair-cn/NAS/COMMON/IES/EsmInformationTransferFlag.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/EsmInformationTransferFlag.h
rename to openair-cn/NAS/COMMON/IES/EsmInformationTransferFlag.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EsmMessageContainer.c b/openair-cn/NAS/COMMON/IES/EsmMessageContainer.c
similarity index 99%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/EsmMessageContainer.c
rename to openair-cn/NAS/COMMON/IES/EsmMessageContainer.c
index 507a01f2f8..edb4cef9d8 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/ies/EsmMessageContainer.c
+++ b/openair-cn/NAS/COMMON/IES/EsmMessageContainer.c
@@ -54,6 +54,7 @@ int decode_esm_message_container(EsmMessageContainer *esmmessagecontainer, uint8
CHECK_LENGTH_DECODER(len - decoded, ielen);
+
if ((decode_result = decode_octet_string(&esmmessagecontainer->esmmessagecontainercontents, ielen, buffer + decoded, len - decoded)) < 0) {
LOG_FUNC_RETURN(decode_result);
} else {
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EsmMessageContainer.h b/openair-cn/NAS/COMMON/IES/EsmMessageContainer.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/EsmMessageContainer.h
rename to openair-cn/NAS/COMMON/IES/EsmMessageContainer.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/GprsTimer.c b/openair-cn/NAS/COMMON/IES/GprsTimer.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/GprsTimer.c
rename to openair-cn/NAS/COMMON/IES/GprsTimer.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/GprsTimer.h b/openair-cn/NAS/COMMON/IES/GprsTimer.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/GprsTimer.h
rename to openair-cn/NAS/COMMON/IES/GprsTimer.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/GutiType.c b/openair-cn/NAS/COMMON/IES/GutiType.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/GutiType.c
rename to openair-cn/NAS/COMMON/IES/GutiType.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/GutiType.h b/openair-cn/NAS/COMMON/IES/GutiType.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/GutiType.h
rename to openair-cn/NAS/COMMON/IES/GutiType.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/IdentityType2.c b/openair-cn/NAS/COMMON/IES/IdentityType2.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/IdentityType2.c
rename to openair-cn/NAS/COMMON/IES/IdentityType2.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/IdentityType2.h b/openair-cn/NAS/COMMON/IES/IdentityType2.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/IdentityType2.h
rename to openair-cn/NAS/COMMON/IES/IdentityType2.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/ImeisvRequest.c b/openair-cn/NAS/COMMON/IES/ImeisvRequest.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/ImeisvRequest.c
rename to openair-cn/NAS/COMMON/IES/ImeisvRequest.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/ImeisvRequest.h b/openair-cn/NAS/COMMON/IES/ImeisvRequest.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/ImeisvRequest.h
rename to openair-cn/NAS/COMMON/IES/ImeisvRequest.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/KsiAndSequenceNumber.c b/openair-cn/NAS/COMMON/IES/KsiAndSequenceNumber.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/KsiAndSequenceNumber.c
rename to openair-cn/NAS/COMMON/IES/KsiAndSequenceNumber.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/KsiAndSequenceNumber.h b/openair-cn/NAS/COMMON/IES/KsiAndSequenceNumber.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/KsiAndSequenceNumber.h
rename to openair-cn/NAS/COMMON/IES/KsiAndSequenceNumber.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/LcsClientIdentity.c b/openair-cn/NAS/COMMON/IES/LcsClientIdentity.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/LcsClientIdentity.c
rename to openair-cn/NAS/COMMON/IES/LcsClientIdentity.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/LcsClientIdentity.h b/openair-cn/NAS/COMMON/IES/LcsClientIdentity.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/LcsClientIdentity.h
rename to openair-cn/NAS/COMMON/IES/LcsClientIdentity.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/LcsIndicator.c b/openair-cn/NAS/COMMON/IES/LcsIndicator.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/LcsIndicator.c
rename to openair-cn/NAS/COMMON/IES/LcsIndicator.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/LcsIndicator.h b/openair-cn/NAS/COMMON/IES/LcsIndicator.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/LcsIndicator.h
rename to openair-cn/NAS/COMMON/IES/LcsIndicator.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/LinkedEpsBearerIdentity.c b/openair-cn/NAS/COMMON/IES/LinkedEpsBearerIdentity.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/LinkedEpsBearerIdentity.c
rename to openair-cn/NAS/COMMON/IES/LinkedEpsBearerIdentity.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/LinkedEpsBearerIdentity.h b/openair-cn/NAS/COMMON/IES/LinkedEpsBearerIdentity.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/LinkedEpsBearerIdentity.h
rename to openair-cn/NAS/COMMON/IES/LinkedEpsBearerIdentity.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/LlcServiceAccessPointIdentifier.c b/openair-cn/NAS/COMMON/IES/LlcServiceAccessPointIdentifier.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/LlcServiceAccessPointIdentifier.c
rename to openair-cn/NAS/COMMON/IES/LlcServiceAccessPointIdentifier.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/LlcServiceAccessPointIdentifier.h b/openair-cn/NAS/COMMON/IES/LlcServiceAccessPointIdentifier.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/LlcServiceAccessPointIdentifier.h
rename to openair-cn/NAS/COMMON/IES/LlcServiceAccessPointIdentifier.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/LocationAreaIdentification.c b/openair-cn/NAS/COMMON/IES/LocationAreaIdentification.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/LocationAreaIdentification.c
rename to openair-cn/NAS/COMMON/IES/LocationAreaIdentification.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/LocationAreaIdentification.h b/openair-cn/NAS/COMMON/IES/LocationAreaIdentification.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/LocationAreaIdentification.h
rename to openair-cn/NAS/COMMON/IES/LocationAreaIdentification.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/Makefile b/openair-cn/NAS/COMMON/IES/Makefile
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/Makefile
rename to openair-cn/NAS/COMMON/IES/Makefile
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/MessageType.c b/openair-cn/NAS/COMMON/IES/MessageType.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/MessageType.c
rename to openair-cn/NAS/COMMON/IES/MessageType.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/MessageType.h b/openair-cn/NAS/COMMON/IES/MessageType.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/MessageType.h
rename to openair-cn/NAS/COMMON/IES/MessageType.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/MobileIdentity.c b/openair-cn/NAS/COMMON/IES/MobileIdentity.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/MobileIdentity.c
rename to openair-cn/NAS/COMMON/IES/MobileIdentity.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/MobileIdentity.h b/openair-cn/NAS/COMMON/IES/MobileIdentity.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/MobileIdentity.h
rename to openair-cn/NAS/COMMON/IES/MobileIdentity.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/MobileStationClassmark2.c b/openair-cn/NAS/COMMON/IES/MobileStationClassmark2.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/MobileStationClassmark2.c
rename to openair-cn/NAS/COMMON/IES/MobileStationClassmark2.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/MobileStationClassmark2.h b/openair-cn/NAS/COMMON/IES/MobileStationClassmark2.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/MobileStationClassmark2.h
rename to openair-cn/NAS/COMMON/IES/MobileStationClassmark2.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/MobileStationClassmark3.c b/openair-cn/NAS/COMMON/IES/MobileStationClassmark3.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/MobileStationClassmark3.c
rename to openair-cn/NAS/COMMON/IES/MobileStationClassmark3.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/MobileStationClassmark3.h b/openair-cn/NAS/COMMON/IES/MobileStationClassmark3.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/MobileStationClassmark3.h
rename to openair-cn/NAS/COMMON/IES/MobileStationClassmark3.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/MsNetworkCapability.c b/openair-cn/NAS/COMMON/IES/MsNetworkCapability.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/MsNetworkCapability.c
rename to openair-cn/NAS/COMMON/IES/MsNetworkCapability.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/MsNetworkCapability.h b/openair-cn/NAS/COMMON/IES/MsNetworkCapability.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/MsNetworkCapability.h
rename to openair-cn/NAS/COMMON/IES/MsNetworkCapability.h
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/openair3/RAL-LTE/RAL-DUMMY/INCLUDE/mRALlte_proto.h b/openair-cn/NAS/COMMON/IES/MsNetworkFeatureSupport.h
old mode 100755
new mode 100644
similarity index 56%
rename from openair3/RAL-LTE/RAL-DUMMY/INCLUDE/mRALlte_proto.h
rename to openair-cn/NAS/COMMON/IES/MsNetworkFeatureSupport.h
index 69070c6d87..334430de1a
--- a/openair3/RAL-LTE/RAL-DUMMY/INCLUDE/mRALlte_proto.h
+++ b/openair-cn/NAS/COMMON/IES/MsNetworkFeatureSupport.h
@@ -23,26 +23,31 @@
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@eurecom.fr
- Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
+ Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
*******************************************************************************/
-#ifndef __RAL_LTE_PROTO_H__
-#define __RAL_LTE_PROTO_H__
+#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
-//mRALuD_NAS.c
-int IAL_decode_NAS_message(void);
-int IAL_process_DNAS_message(int ioctl_obj, int ioctl_cmd, int ioctl_cellid);
+typedef struct MsNetworkFeatureSupport_tag {
+ uint8_t spare_bits:3;
+ uint8_t extended_periodic_timers:1;
+} MsNetworkFeatureSupport;
-//mRALuD_process.c
-void IAL_NAS_measures_init(void);
-void IAL_NAS_measures_update(int i);
-void IAL_integrate_measure(int measure, int i);
-void rallte_NAS_measures_polling(void);
-int rallte_NAS_corresponding_cell(int req_index);
-void rallte_verifyPendingConnection(void);
+int encode_ms_network_feature_support(MsNetworkFeatureSupport *msnetworkfeaturesupport, uint8_t iei, uint8_t *buffer, uint32_t len);
-#endif
+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/EURECOM-NAS/src/ies/NasKeySetIdentifier.c b/openair-cn/NAS/COMMON/IES/NasKeySetIdentifier.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/NasKeySetIdentifier.c
rename to openair-cn/NAS/COMMON/IES/NasKeySetIdentifier.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/NasKeySetIdentifier.h b/openair-cn/NAS/COMMON/IES/NasKeySetIdentifier.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/NasKeySetIdentifier.h
rename to openair-cn/NAS/COMMON/IES/NasKeySetIdentifier.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/NasMessageContainer.c b/openair-cn/NAS/COMMON/IES/NasMessageContainer.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/NasMessageContainer.c
rename to openair-cn/NAS/COMMON/IES/NasMessageContainer.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/NasMessageContainer.h b/openair-cn/NAS/COMMON/IES/NasMessageContainer.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/NasMessageContainer.h
rename to openair-cn/NAS/COMMON/IES/NasMessageContainer.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/NasRequestType.c b/openair-cn/NAS/COMMON/IES/NasRequestType.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/NasRequestType.c
rename to openair-cn/NAS/COMMON/IES/NasRequestType.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/NasRequestType.h b/openair-cn/NAS/COMMON/IES/NasRequestType.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/NasRequestType.h
rename to openair-cn/NAS/COMMON/IES/NasRequestType.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/NasSecurityAlgorithms.c b/openair-cn/NAS/COMMON/IES/NasSecurityAlgorithms.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/NasSecurityAlgorithms.c
rename to openair-cn/NAS/COMMON/IES/NasSecurityAlgorithms.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/NasSecurityAlgorithms.h b/openair-cn/NAS/COMMON/IES/NasSecurityAlgorithms.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/NasSecurityAlgorithms.h
rename to openair-cn/NAS/COMMON/IES/NasSecurityAlgorithms.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/NetworkName.c b/openair-cn/NAS/COMMON/IES/NetworkName.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/NetworkName.c
rename to openair-cn/NAS/COMMON/IES/NetworkName.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/NetworkName.h b/openair-cn/NAS/COMMON/IES/NetworkName.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/NetworkName.h
rename to openair-cn/NAS/COMMON/IES/NetworkName.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/Nonce.c b/openair-cn/NAS/COMMON/IES/Nonce.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/Nonce.c
rename to openair-cn/NAS/COMMON/IES/Nonce.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/Nonce.h b/openair-cn/NAS/COMMON/IES/Nonce.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/Nonce.h
rename to openair-cn/NAS/COMMON/IES/Nonce.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/PTmsiSignature.c b/openair-cn/NAS/COMMON/IES/PTmsiSignature.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/PTmsiSignature.c
rename to openair-cn/NAS/COMMON/IES/PTmsiSignature.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/PTmsiSignature.h b/openair-cn/NAS/COMMON/IES/PTmsiSignature.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/PTmsiSignature.h
rename to openair-cn/NAS/COMMON/IES/PTmsiSignature.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/PacketFlowIdentifier.c b/openair-cn/NAS/COMMON/IES/PacketFlowIdentifier.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/PacketFlowIdentifier.c
rename to openair-cn/NAS/COMMON/IES/PacketFlowIdentifier.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/PacketFlowIdentifier.h b/openair-cn/NAS/COMMON/IES/PacketFlowIdentifier.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/PacketFlowIdentifier.h
rename to openair-cn/NAS/COMMON/IES/PacketFlowIdentifier.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/PagingIdentity.c b/openair-cn/NAS/COMMON/IES/PagingIdentity.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/PagingIdentity.c
rename to openair-cn/NAS/COMMON/IES/PagingIdentity.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/PagingIdentity.h b/openair-cn/NAS/COMMON/IES/PagingIdentity.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/PagingIdentity.h
rename to openair-cn/NAS/COMMON/IES/PagingIdentity.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/PdnAddress.c b/openair-cn/NAS/COMMON/IES/PdnAddress.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/PdnAddress.c
rename to openair-cn/NAS/COMMON/IES/PdnAddress.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/PdnAddress.h b/openair-cn/NAS/COMMON/IES/PdnAddress.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/PdnAddress.h
rename to openair-cn/NAS/COMMON/IES/PdnAddress.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/PdnType.c b/openair-cn/NAS/COMMON/IES/PdnType.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/PdnType.c
rename to openair-cn/NAS/COMMON/IES/PdnType.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/PdnType.h b/openair-cn/NAS/COMMON/IES/PdnType.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/PdnType.h
rename to openair-cn/NAS/COMMON/IES/PdnType.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/PlmnList.c b/openair-cn/NAS/COMMON/IES/PlmnList.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/PlmnList.c
rename to openair-cn/NAS/COMMON/IES/PlmnList.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/PlmnList.h b/openair-cn/NAS/COMMON/IES/PlmnList.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/PlmnList.h
rename to openair-cn/NAS/COMMON/IES/PlmnList.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/ProcedureTransactionIdentity.c b/openair-cn/NAS/COMMON/IES/ProcedureTransactionIdentity.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/ProcedureTransactionIdentity.c
rename to openair-cn/NAS/COMMON/IES/ProcedureTransactionIdentity.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/ProcedureTransactionIdentity.h b/openair-cn/NAS/COMMON/IES/ProcedureTransactionIdentity.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/ProcedureTransactionIdentity.h
rename to openair-cn/NAS/COMMON/IES/ProcedureTransactionIdentity.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/ProtocolConfigurationOptions.c b/openair-cn/NAS/COMMON/IES/ProtocolConfigurationOptions.c
similarity index 64%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/ProtocolConfigurationOptions.c
rename to openair-cn/NAS/COMMON/IES/ProtocolConfigurationOptions.c
index ebdafdf66c..dc17201da0 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/ies/ProtocolConfigurationOptions.c
+++ b/openair-cn/NAS/COMMON/IES/ProtocolConfigurationOptions.c
@@ -64,16 +64,23 @@ int decode_protocol_configuration_options(ProtocolConfigurationOptions *protocol
decoded++;
//IES_DECODE_U16(protocolconfigurationoptions->protocolid, *(buffer + decoded));
+ protocolconfigurationoptions->num_protocol_id_or_container_id = 0;
while ((len - decoded) > 0) {
- IES_DECODE_U16(buffer, decoded, protocolconfigurationoptions->protocolid);
- DECODE_U8(buffer + decoded, protocolconfigurationoptions->lengthofprotocolid, decoded);
+ IES_DECODE_U16(buffer, decoded, protocolconfigurationoptions->protocolid[protocolconfigurationoptions->num_protocol_id_or_container_id]);
+ DECODE_U8(buffer + decoded, protocolconfigurationoptions->lengthofprotocolid[protocolconfigurationoptions->num_protocol_id_or_container_id], decoded);
- if ((decode_result = decode_octet_string(&protocolconfigurationoptions->protocolidcontents,
- protocolconfigurationoptions->lengthofprotocolid, buffer + decoded, len - decoded)) < 0) {
- return decode_result;
+ if (protocolconfigurationoptions->lengthofprotocolid[protocolconfigurationoptions->num_protocol_id_or_container_id] > 0) {
+ if ((decode_result = decode_octet_string(&protocolconfigurationoptions->protocolidcontents[protocolconfigurationoptions->num_protocol_id_or_container_id],
+ protocolconfigurationoptions->lengthofprotocolid[protocolconfigurationoptions->num_protocol_id_or_container_id], buffer + decoded, len - decoded)) < 0) {
+ return decode_result;
+ } else {
+ decoded += decode_result;
+ }
} else {
- decoded += decode_result;
+ protocolconfigurationoptions->protocolidcontents[protocolconfigurationoptions->num_protocol_id_or_container_id].length = 0;
+ protocolconfigurationoptions->protocolidcontents[protocolconfigurationoptions->num_protocol_id_or_container_id].value = NULL;
}
+ protocolconfigurationoptions->num_protocol_id_or_container_id += 1;
}
#if defined (NAS_DEBUG)
@@ -84,6 +91,7 @@ int decode_protocol_configuration_options(ProtocolConfigurationOptions *protocol
int encode_protocol_configuration_options(ProtocolConfigurationOptions *protocolconfigurationoptions, uint8_t iei, uint8_t *buffer, uint32_t len)
{
uint8_t *lenPtr;
+ uint8_t num_protocol_id_or_container_id = 0;
uint32_t encoded = 0;
int encode_result;
/* Checking IEI and pointer */
@@ -102,21 +110,29 @@ int encode_protocol_configuration_options(ProtocolConfigurationOptions *protocol
*(buffer + encoded) = 0x00 | (1 << 7) |
(protocolconfigurationoptions->configurationprotol & 0x7);
encoded++;
- IES_ENCODE_U16(buffer, encoded, protocolconfigurationoptions->protocolid);
- *(buffer + encoded) = protocolconfigurationoptions->lengthofprotocolid;
- encoded++;
- if ((encode_result = encode_octet_string(&protocolconfigurationoptions->protocolidcontents, buffer + encoded, len - encoded)) < 0)
- return encode_result;
- else
- encoded += encode_result;
+ while (num_protocol_id_or_container_id < protocolconfigurationoptions->num_protocol_id_or_container_id) {
+ IES_ENCODE_U16(buffer, encoded, protocolconfigurationoptions->protocolid[num_protocol_id_or_container_id]);
+ *(buffer + encoded) = protocolconfigurationoptions->lengthofprotocolid[num_protocol_id_or_container_id];
+ encoded++;
+
+ if ((encode_result = encode_octet_string(&protocolconfigurationoptions->protocolidcontents[num_protocol_id_or_container_id],
+ buffer + encoded,
+ len - encoded)) < 0)
+ return encode_result;
+ else
+ encoded += encode_result;
+
+ num_protocol_id_or_container_id += 1;
+ }
*lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0);
return encoded;
}
void dump_protocol_configuration_options_xml(ProtocolConfigurationOptions *protocolconfigurationoptions, uint8_t iei)
{
+ int i;
printf("\n");
if (iei > 0)
@@ -124,9 +140,13 @@ void dump_protocol_configuration_options_xml(ProtocolConfigurationOptions *proto
printf(" 0x%X\n", iei);
printf(" %u\n", protocolconfigurationoptions->configurationprotol);
- printf(" %u\n", protocolconfigurationoptions->protocolid);
- printf(" %u\n", protocolconfigurationoptions->lengthofprotocolid);
- printf("%s",dump_octet_string_xml(&protocolconfigurationoptions->protocolidcontents));
+ i = 0;
+ while (i < protocolconfigurationoptions->num_protocol_id_or_container_id) {
+ printf(" %u\n", protocolconfigurationoptions->protocolid[i]);
+ printf(" %u\n", protocolconfigurationoptions->lengthofprotocolid[i]);
+ printf(" %s",dump_octet_string_xml(&protocolconfigurationoptions->protocolidcontents[i]));
+ i++;
+ }
printf("\n");
}
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/ProtocolConfigurationOptions.h b/openair-cn/NAS/COMMON/IES/ProtocolConfigurationOptions.h
similarity index 83%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/ProtocolConfigurationOptions.h
rename to openair-cn/NAS/COMMON/IES/ProtocolConfigurationOptions.h
index f73f4be832..bd59d2c4ac 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/ies/ProtocolConfigurationOptions.h
+++ b/openair-cn/NAS/COMMON/IES/ProtocolConfigurationOptions.h
@@ -38,6 +38,10 @@
#define PROTOCOL_CONFIGURATION_OPTIONS_MINIMUM_LENGTH 3
#define PROTOCOL_CONFIGURATION_OPTIONS_MAXIMUM_LENGTH 253
+// arbitrary value, theoricaly can be greater than defined (250/3)
+#define PROTOCOL_CONFIGURATION_OPTIONS_MAXIMUM_PROTOCOL_ID_OR_CONTAINER_ID 16
+
+
/* 3GPP TS 24.008 Table 10.5.154
* MS to network table
*/
@@ -58,10 +62,11 @@ typedef enum ProtocolConfigurationOptionsList_ids_tag {
*/
typedef struct ProtocolConfigurationOptions_tag {
- uint8_t configurationprotol:3;
- uint16_t protocolid;
- uint8_t lengthofprotocolid;
- OctetString protocolidcontents;
+ uint8_t configurationprotol:3;
+ uint8_t num_protocol_id_or_container_id;
+ uint16_t protocolid[PROTOCOL_CONFIGURATION_OPTIONS_MAXIMUM_PROTOCOL_ID_OR_CONTAINER_ID];
+ uint8_t lengthofprotocolid[PROTOCOL_CONFIGURATION_OPTIONS_MAXIMUM_PROTOCOL_ID_OR_CONTAINER_ID];
+ OctetString protocolidcontents[PROTOCOL_CONFIGURATION_OPTIONS_MAXIMUM_PROTOCOL_ID_OR_CONTAINER_ID];
} ProtocolConfigurationOptions;
int encode_protocol_configuration_options(ProtocolConfigurationOptions *protocolconfigurationoptions, uint8_t iei, uint8_t *buffer, uint32_t len);
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/ProtocolDiscriminator.c b/openair-cn/NAS/COMMON/IES/ProtocolDiscriminator.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/ProtocolDiscriminator.c
rename to openair-cn/NAS/COMMON/IES/ProtocolDiscriminator.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/ProtocolDiscriminator.h b/openair-cn/NAS/COMMON/IES/ProtocolDiscriminator.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/ProtocolDiscriminator.h
rename to openair-cn/NAS/COMMON/IES/ProtocolDiscriminator.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/QualityOfService.c b/openair-cn/NAS/COMMON/IES/QualityOfService.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/QualityOfService.c
rename to openair-cn/NAS/COMMON/IES/QualityOfService.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/QualityOfService.h b/openair-cn/NAS/COMMON/IES/QualityOfService.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/QualityOfService.h
rename to openair-cn/NAS/COMMON/IES/QualityOfService.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/RadioPriority.c b/openair-cn/NAS/COMMON/IES/RadioPriority.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/RadioPriority.c
rename to openair-cn/NAS/COMMON/IES/RadioPriority.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/RadioPriority.h b/openair-cn/NAS/COMMON/IES/RadioPriority.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/RadioPriority.h
rename to openair-cn/NAS/COMMON/IES/RadioPriority.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/SecurityHeaderType.c b/openair-cn/NAS/COMMON/IES/SecurityHeaderType.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/SecurityHeaderType.c
rename to openair-cn/NAS/COMMON/IES/SecurityHeaderType.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/SecurityHeaderType.h b/openair-cn/NAS/COMMON/IES/SecurityHeaderType.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/SecurityHeaderType.h
rename to openair-cn/NAS/COMMON/IES/SecurityHeaderType.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/ServiceType.c b/openair-cn/NAS/COMMON/IES/ServiceType.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/ServiceType.c
rename to openair-cn/NAS/COMMON/IES/ServiceType.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/ServiceType.h b/openair-cn/NAS/COMMON/IES/ServiceType.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/ServiceType.h
rename to openair-cn/NAS/COMMON/IES/ServiceType.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/ShortMac.c b/openair-cn/NAS/COMMON/IES/ShortMac.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/ShortMac.c
rename to openair-cn/NAS/COMMON/IES/ShortMac.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/ShortMac.h b/openair-cn/NAS/COMMON/IES/ShortMac.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/ShortMac.h
rename to openair-cn/NAS/COMMON/IES/ShortMac.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/SsCode.c b/openair-cn/NAS/COMMON/IES/SsCode.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/SsCode.c
rename to openair-cn/NAS/COMMON/IES/SsCode.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/SsCode.h b/openair-cn/NAS/COMMON/IES/SsCode.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/SsCode.h
rename to openair-cn/NAS/COMMON/IES/SsCode.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/SupportedCodecList.c b/openair-cn/NAS/COMMON/IES/SupportedCodecList.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/SupportedCodecList.c
rename to openair-cn/NAS/COMMON/IES/SupportedCodecList.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/SupportedCodecList.h b/openair-cn/NAS/COMMON/IES/SupportedCodecList.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/SupportedCodecList.h
rename to openair-cn/NAS/COMMON/IES/SupportedCodecList.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/TimeZone.c b/openair-cn/NAS/COMMON/IES/TimeZone.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/TimeZone.c
rename to openair-cn/NAS/COMMON/IES/TimeZone.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/TimeZone.h b/openair-cn/NAS/COMMON/IES/TimeZone.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/TimeZone.h
rename to openair-cn/NAS/COMMON/IES/TimeZone.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/TimeZoneAndTime.c b/openair-cn/NAS/COMMON/IES/TimeZoneAndTime.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/TimeZoneAndTime.c
rename to openair-cn/NAS/COMMON/IES/TimeZoneAndTime.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/TimeZoneAndTime.h b/openair-cn/NAS/COMMON/IES/TimeZoneAndTime.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/TimeZoneAndTime.h
rename to openair-cn/NAS/COMMON/IES/TimeZoneAndTime.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/TmsiStatus.c b/openair-cn/NAS/COMMON/IES/TmsiStatus.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/TmsiStatus.c
rename to openair-cn/NAS/COMMON/IES/TmsiStatus.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/TmsiStatus.h b/openair-cn/NAS/COMMON/IES/TmsiStatus.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/TmsiStatus.h
rename to openair-cn/NAS/COMMON/IES/TmsiStatus.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/TrackingAreaIdentity.c b/openair-cn/NAS/COMMON/IES/TrackingAreaIdentity.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/TrackingAreaIdentity.c
rename to openair-cn/NAS/COMMON/IES/TrackingAreaIdentity.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/TrackingAreaIdentity.h b/openair-cn/NAS/COMMON/IES/TrackingAreaIdentity.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/TrackingAreaIdentity.h
rename to openair-cn/NAS/COMMON/IES/TrackingAreaIdentity.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/TrackingAreaIdentityList.c b/openair-cn/NAS/COMMON/IES/TrackingAreaIdentityList.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/TrackingAreaIdentityList.c
rename to openair-cn/NAS/COMMON/IES/TrackingAreaIdentityList.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/TrackingAreaIdentityList.h b/openair-cn/NAS/COMMON/IES/TrackingAreaIdentityList.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/TrackingAreaIdentityList.h
rename to openair-cn/NAS/COMMON/IES/TrackingAreaIdentityList.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/TrafficFlowAggregateDescription.c b/openair-cn/NAS/COMMON/IES/TrafficFlowAggregateDescription.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/TrafficFlowAggregateDescription.c
rename to openair-cn/NAS/COMMON/IES/TrafficFlowAggregateDescription.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/TrafficFlowAggregateDescription.h b/openair-cn/NAS/COMMON/IES/TrafficFlowAggregateDescription.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/TrafficFlowAggregateDescription.h
rename to openair-cn/NAS/COMMON/IES/TrafficFlowAggregateDescription.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/TrafficFlowTemplate.c b/openair-cn/NAS/COMMON/IES/TrafficFlowTemplate.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/TrafficFlowTemplate.c
rename to openair-cn/NAS/COMMON/IES/TrafficFlowTemplate.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/TrafficFlowTemplate.h b/openair-cn/NAS/COMMON/IES/TrafficFlowTemplate.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/TrafficFlowTemplate.h
rename to openair-cn/NAS/COMMON/IES/TrafficFlowTemplate.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/TransactionIdentifier.c b/openair-cn/NAS/COMMON/IES/TransactionIdentifier.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/TransactionIdentifier.c
rename to openair-cn/NAS/COMMON/IES/TransactionIdentifier.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/TransactionIdentifier.h b/openair-cn/NAS/COMMON/IES/TransactionIdentifier.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/TransactionIdentifier.h
rename to openair-cn/NAS/COMMON/IES/TransactionIdentifier.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/UeNetworkCapability.c b/openair-cn/NAS/COMMON/IES/UeNetworkCapability.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/UeNetworkCapability.c
rename to openair-cn/NAS/COMMON/IES/UeNetworkCapability.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/UeNetworkCapability.h b/openair-cn/NAS/COMMON/IES/UeNetworkCapability.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/UeNetworkCapability.h
rename to openair-cn/NAS/COMMON/IES/UeNetworkCapability.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/UeRadioCapabilityInformationUpdateNeeded.c b/openair-cn/NAS/COMMON/IES/UeRadioCapabilityInformationUpdateNeeded.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/UeRadioCapabilityInformationUpdateNeeded.c
rename to openair-cn/NAS/COMMON/IES/UeRadioCapabilityInformationUpdateNeeded.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/UeRadioCapabilityInformationUpdateNeeded.h b/openair-cn/NAS/COMMON/IES/UeRadioCapabilityInformationUpdateNeeded.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/UeRadioCapabilityInformationUpdateNeeded.h
rename to openair-cn/NAS/COMMON/IES/UeRadioCapabilityInformationUpdateNeeded.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/UeSecurityCapability.c b/openair-cn/NAS/COMMON/IES/UeSecurityCapability.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/UeSecurityCapability.c
rename to openair-cn/NAS/COMMON/IES/UeSecurityCapability.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/UeSecurityCapability.h b/openair-cn/NAS/COMMON/IES/UeSecurityCapability.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/UeSecurityCapability.h
rename to openair-cn/NAS/COMMON/IES/UeSecurityCapability.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/VoiceDomainPreferenceAndUeUsageSetting.c b/openair-cn/NAS/COMMON/IES/VoiceDomainPreferenceAndUeUsageSetting.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/VoiceDomainPreferenceAndUeUsageSetting.c
rename to openair-cn/NAS/COMMON/IES/VoiceDomainPreferenceAndUeUsageSetting.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/VoiceDomainPreferenceAndUeUsageSetting.h b/openair-cn/NAS/COMMON/IES/VoiceDomainPreferenceAndUeUsageSetting.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/VoiceDomainPreferenceAndUeUsageSetting.h
rename to openair-cn/NAS/COMMON/IES/VoiceDomainPreferenceAndUeUsageSetting.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/COPYING b/openair-cn/NAS/COMMON/UTIL/COPYING
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/COPYING
rename to openair-cn/NAS/COMMON/UTIL/COPYING
diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/Makefile b/openair-cn/NAS/COMMON/UTIL/Makefile
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/util/Makefile
rename to openair-cn/NAS/COMMON/UTIL/Makefile
diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/OctetString.c b/openair-cn/NAS/COMMON/UTIL/OctetString.c
similarity index 68%
rename from openair-cn/NAS/EURECOM-NAS/src/util/OctetString.c
rename to openair-cn/NAS/COMMON/UTIL/OctetString.c
index 9b29ab02dd..fd16e27014 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/util/OctetString.c
+++ b/openair-cn/NAS/COMMON/UTIL/OctetString.c
@@ -48,7 +48,6 @@ OctetString* dup_octet_string(OctetString *octetstring)
memcpy(os_p->value, octetstring->value, octetstring->length);
os_p->value[octetstring->length] = '\0';
}
-
return os_p;
}
@@ -57,7 +56,6 @@ void free_octet_string(OctetString *octetstring)
{
if (octetstring) {
if (octetstring->value) free(octetstring->value);
-
octetstring->value = NULL;
octetstring->length = 0;
free(octetstring);
@@ -67,9 +65,17 @@ void free_octet_string(OctetString *octetstring)
int encode_octet_string(OctetString *octetstring, uint8_t *buffer, uint32_t buflen)
{
- CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, octetstring->length, buflen);
- memcpy((void*)buffer, (void*)octetstring->value, octetstring->length);
- return octetstring->length;
+ if (octetstring != NULL) {
+ if ((octetstring->value != NULL) && (octetstring->length > 0)) {
+ CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, octetstring->length, buflen);
+ memcpy((void*)buffer, (void*)octetstring->value, octetstring->length);
+ return octetstring->length;
+ } else {
+ return 0;
+ }
+ } else {
+ return 0;
+ }
}
int decode_octet_string(OctetString *octetstring, uint16_t pdulen, uint8_t *buffer, uint32_t buflen)
@@ -77,11 +83,15 @@ int decode_octet_string(OctetString *octetstring, uint16_t pdulen, uint8_t *buff
if (buflen < pdulen)
return -1;
- octetstring->length = pdulen;
- octetstring->value = malloc(sizeof(uint8_t) * (pdulen+1));
- memcpy((void*)octetstring->value, (void*)buffer, pdulen);
- octetstring->value[pdulen] = '\0';
- return octetstring->length;
+ if ((octetstring != NULL) && (buffer!= NULL)) {
+ octetstring->length = pdulen;
+ octetstring->value = malloc(sizeof(uint8_t) * (pdulen+1));
+ memcpy((void*)octetstring->value, (void*)buffer, pdulen);
+ octetstring->value[pdulen] = '\0';
+ return octetstring->length;
+ } else {
+ return -1;
+ }
}
char* dump_octet_string_xml( const OctetString * const octetstring)
@@ -89,15 +99,19 @@ char* dump_octet_string_xml( const OctetString * const octetstring)
int i;
int remaining_size = DUMP_OUTPUT_SIZE;
int size = 0;
- size = snprintf(_dump_output, remaining_size, "%u\n\t", octetstring->length);
- remaining_size -= size;
+ int size_print = 0;
+
+ size_print = snprintf(_dump_output, remaining_size, "%u\n\t", octetstring->length);
+ size += size_print;
+ remaining_size -= size_print;
for (i = 0; i < octetstring->length; i++) {
- size +=snprintf(&_dump_output[size], remaining_size, "0x%x ", octetstring->value[i]);
- remaining_size -= size;
+ size_print = snprintf(&_dump_output[size], remaining_size, "0x%x ", octetstring->value[i]);
+ size += size_print;
+ remaining_size -= size_print;
}
- size +=snprintf(&_dump_output[size], remaining_size, "\n");
+ size_print = snprintf(&_dump_output[size], remaining_size, "\n");
return _dump_output;
}
@@ -106,10 +120,12 @@ char* dump_octet_string( const OctetString * const octetstring)
int i;
int remaining_size = DUMP_OUTPUT_SIZE;
int size = 0;
+ int size_print = 0;
for (i = 0; i < octetstring->length; i++) {
- size +=snprintf(&_dump_output[size], remaining_size, "0x%x ", octetstring->value[i]);
- remaining_size -= size;
+ size_print = snprintf(&_dump_output[size], remaining_size, "0x%x ", octetstring->value[i]);
+ size += size_print;
+ remaining_size -= size_print;
}
return _dump_output;
diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/OctetString.h b/openair-cn/NAS/COMMON/UTIL/OctetString.h
similarity index 90%
rename from openair-cn/NAS/EURECOM-NAS/src/util/OctetString.h
rename to openair-cn/NAS/COMMON/UTIL/OctetString.h
index c7f564a3b6..15cd8f6823 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/util/OctetString.h
+++ b/openair-cn/NAS/COMMON/UTIL/OctetString.h
@@ -46,19 +46,19 @@ typedef struct OctetString_tag {
} while (0);
-#define DUP_OCTET_STRING(oCTETsTRINGoRIG,oCTETsTRINGcOPY) \
- do { \
- if ((oCTETsTRINGoRIG).value == NULL) { \
- (oCTETsTRINGcOPY).length = 0; \
- (oCTETsTRINGcOPY).value = NULL; \
- break; \
- } \
- (oCTETsTRINGcOPY).length = strlen((const char*)(oCTETsTRINGoRIG).value);\
- assert((oCTETsTRINGoRIG).length == (oCTETsTRINGcOPY).length); \
- (oCTETsTRINGcOPY).value = malloc((oCTETsTRINGoRIG).length); \
- memcpy((oCTETsTRINGcOPY).value, \
- (oCTETsTRINGoRIG).value, \
- (oCTETsTRINGoRIG).length); \
+#define DUP_OCTET_STRING(oCTETsTRINGoRIG,oCTETsTRINGcOPY) \
+ do { \
+ if ((oCTETsTRINGoRIG).value == NULL) { \
+ (oCTETsTRINGcOPY).length = 0; \
+ (oCTETsTRINGcOPY).value = NULL; \
+ break; \
+ } \
+ (oCTETsTRINGcOPY).length = (oCTETsTRINGoRIG).length; \
+ (oCTETsTRINGcOPY).value = malloc((oCTETsTRINGoRIG).length+1); \
+ (oCTETsTRINGcOPY).value[(oCTETsTRINGoRIG).length] = '\0'; \
+ memcpy((oCTETsTRINGcOPY).value, \
+ (oCTETsTRINGoRIG).value, \
+ (oCTETsTRINGoRIG).length); \
} while (0);
OctetString* dup_octet_string(OctetString*octetstring);
diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/TLVDecoder.c b/openair-cn/NAS/COMMON/UTIL/TLVDecoder.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/util/TLVDecoder.c
rename to openair-cn/NAS/COMMON/UTIL/TLVDecoder.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/TLVDecoder.h b/openair-cn/NAS/COMMON/UTIL/TLVDecoder.h
similarity index 98%
rename from openair-cn/NAS/EURECOM-NAS/src/util/TLVDecoder.h
rename to openair-cn/NAS/COMMON/UTIL/TLVDecoder.h
index 6e1764edad..152fd9c737 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/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); \
}
diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/TLVEncoder.c b/openair-cn/NAS/COMMON/UTIL/TLVEncoder.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/util/TLVEncoder.c
rename to openair-cn/NAS/COMMON/UTIL/TLVEncoder.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/TLVEncoder.h b/openair-cn/NAS/COMMON/UTIL/TLVEncoder.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/util/TLVEncoder.h
rename to openair-cn/NAS/COMMON/UTIL/TLVEncoder.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/device.c b/openair-cn/NAS/COMMON/UTIL/device.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/util/device.c
rename to openair-cn/NAS/COMMON/UTIL/device.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/device.h b/openair-cn/NAS/COMMON/UTIL/device.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/util/device.h
rename to openair-cn/NAS/COMMON/UTIL/device.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/memory.c b/openair-cn/NAS/COMMON/UTIL/memory.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/util/memory.c
rename to openair-cn/NAS/COMMON/UTIL/memory.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/memory.h b/openair-cn/NAS/COMMON/UTIL/memory.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/util/memory.h
rename to openair-cn/NAS/COMMON/UTIL/memory.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/nas_log.c b/openair-cn/NAS/COMMON/UTIL/nas_log.c
similarity index 99%
rename from openair-cn/NAS/EURECOM-NAS/src/util/nas_log.c
rename to openair-cn/NAS/COMMON/UTIL/nas_log.c
index 5479122b5f..a781d25971 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/util/nas_log.c
+++ b/openair-cn/NAS/COMMON/UTIL/nas_log.c
@@ -49,6 +49,7 @@ int nas_log_func_indent;
#else
#include // stderr, sprintf, fprintf, vfprintf
#include // va_list, va_start, va_end
+#include // strlen
/****************************************************************************/
/**************** E X T E R N A L D E F I N I T I O N S ****************/
diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/nas_log.h b/openair-cn/NAS/COMMON/UTIL/nas_log.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/util/nas_log.h
rename to openair-cn/NAS/COMMON/UTIL/nas_log.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/nas_timer.c b/openair-cn/NAS/COMMON/UTIL/nas_timer.c
similarity index 99%
rename from openair-cn/NAS/EURECOM-NAS/src/util/nas_timer.c
rename to openair-cn/NAS/COMMON/UTIL/nas_timer.c
index 4eea8c36ce..d7c1eb9f0e 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/util/nas_timer.c
+++ b/openair-cn/NAS/COMMON/UTIL/nas_timer.c
@@ -60,6 +60,7 @@ Description Timer utilities
#endif
#include "nas_timer.h"
#include "commonDef.h"
+#include "msc.h"
/****************************************************************************/
/**************** E X T E R N A L D E F I N I T I O N S ****************/
@@ -278,7 +279,7 @@ int nas_timer_start(long sec, nas_timer_callback_t cb, void *args)
/* Insert the new entry into the timer queue */
_nas_timer_db_insert_entry(id, te);
#if defined(ENABLE_ITTI)
-# if defined(NAS_BUILT_IN_EPC)
+# if defined(NAS_MME)
ret = timer_setup(sec, 0, TASK_NAS_MME, INSTANCE_DEFAULT, TIMER_PERIODIC, args, &timer_id);
# else
ret = timer_setup(sec, 0, TASK_NAS_UE, INSTANCE_DEFAULT, TIMER_PERIODIC, args, &timer_id);
@@ -542,7 +543,8 @@ static nas_timer_entry_t *_nas_timer_db_create_entry(
if (te != NULL) {
te->itv.tv_sec = sec;
te->itv.tv_usec = 0;
- te->tv = te->itv;
+ te->tv.tv_sec = te->itv.tv_sec;
+ te->tv.tv_usec = te->itv.tv_usec;
te->cb = cb;
te->args = args;
}
diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/nas_timer.h b/openair-cn/NAS/COMMON/UTIL/nas_timer.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/util/nas_timer.h
rename to openair-cn/NAS/COMMON/UTIL/nas_timer.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/parser.c b/openair-cn/NAS/COMMON/UTIL/parser.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/util/parser.c
rename to openair-cn/NAS/COMMON/UTIL/parser.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/parser.h b/openair-cn/NAS/COMMON/UTIL/parser.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/util/parser.h
rename to openair-cn/NAS/COMMON/UTIL/parser.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/socket.c b/openair-cn/NAS/COMMON/UTIL/socket.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/util/socket.c
rename to openair-cn/NAS/COMMON/UTIL/socket.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/socket.h b/openair-cn/NAS/COMMON/UTIL/socket.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/util/socket.h
rename to openair-cn/NAS/COMMON/UTIL/socket.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/stty.c b/openair-cn/NAS/COMMON/UTIL/stty.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/util/stty.c
rename to openair-cn/NAS/COMMON/UTIL/stty.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/tst/Makefile b/openair-cn/NAS/COMMON/UTIL/tst/Makefile
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/util/tst/Makefile
rename to openair-cn/NAS/COMMON/UTIL/tst/Makefile
diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/tst/timer.c b/openair-cn/NAS/COMMON/UTIL/tst/timer.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/util/tst/timer.c
rename to openair-cn/NAS/COMMON/UTIL/tst/timer.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/tst/timer_debug.txt b/openair-cn/NAS/COMMON/UTIL/tst/timer_debug.txt
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/util/tst/timer_debug.txt
rename to openair-cn/NAS/COMMON/UTIL/tst/timer_debug.txt
diff --git a/openair-cn/NAS/COMMON/commonDef.h b/openair-cn/NAS/COMMON/commonDef.h
new file mode 120000
index 0000000000..19553e9b64
--- /dev/null
+++ b/openair-cn/NAS/COMMON/commonDef.h
@@ -0,0 +1 @@
+../../../openair2/COMMON/commonDef.h
\ No newline at end of file
diff --git a/openair-cn/NAS/COMMON/networkDef.h b/openair-cn/NAS/COMMON/networkDef.h
new file mode 120000
index 0000000000..2648b55e99
--- /dev/null
+++ b/openair-cn/NAS/COMMON/networkDef.h
@@ -0,0 +1 @@
+../../../openair2/COMMON/networkDef.h
\ No newline at end of file
diff --git a/openair-cn/NAS/EURECOM-NAS/src/include/securityDef.h b/openair-cn/NAS/COMMON/securityDef.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/include/securityDef.h
rename to openair-cn/NAS/COMMON/securityDef.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/include/userDef.h b/openair-cn/NAS/COMMON/userDef.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/include/userDef.h
rename to openair-cn/NAS/COMMON/userDef.h
diff --git a/openair-cn/NAS/EURECOM-NAS/Makefile b/openair-cn/NAS/EURECOM-NAS/Makefile
deleted file mode 100644
index c4a02b99d7..0000000000
--- a/openair-cn/NAS/EURECOM-NAS/Makefile
+++ /dev/null
@@ -1,96 +0,0 @@
-################################################################################
-# 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.
-#
-################################################################################
-# To be run as: make or make PROCESS=UE or make PROCESS=MME
-# make and make PROCESS=UE build ./bin/UEprocess
-# make PROCESS=MME builds ./bin/MMEprocess
-
-include Makerules
-include Makefile.inc
-
-export PROJDIR = $(CURDIR)
-
-all:
-ifeq ($(PROCESS), UE)
- @$(CD) $(SECUDIR) && $(MAKE) -f Makefile.NAS
-endif
- @$(CD) $(UTILDIR) && $(MAKE)
- @$(CD) $(APIDIR) && $(MAKE)
- @$(CD) $(IESDIR) && $(MAKE)
- @$(CD) $(EMMDIR) && $(MAKE)
- @$(CD) $(ESMDIR) && $(MAKE)
- @$(CD) $(SRCDIR) && $(MAKE)
-ifeq ($(PROCESS), UE)
- @$(CD) $(TOOLSDIR) && $(MAKE)
- @$(CD) $(USRTSTDIR) && $(MAKE)
-endif
-ifeq ($(PROCESS), MME)
- @$(CD) $(NETTSTDIR) && $(MAKE)
- @$(CD) $(ASSIMUDIR) && $(MAKE)
-endif
-# SR include all objects in a single archive
- $(AR) rcs libUE/libNasUE.a `find . -name *.o` `find $(OPENAIRCN_DIR)/SECU -name *.o`
-
-clean:
- @$(CD) $(SRCDIR) && $(MAKE) $@
- @$(CD) $(APIDIR) && $(MAKE) $@
- @$(CD) $(EMMDIR) && $(MAKE) $@
- @$(CD) $(ESMDIR) && $(MAKE) $@
-
-veryclean: clean
- @$(CD) $(SRCDIR) && $(MAKE) $@
- @$(CD) $(APIDIR) && $(MAKE) $@
- @$(CD) $(EMMDIR) && $(MAKE) $@
- @$(CD) $(ESMDIR) && $(MAKE) $@
- @$(CD) $(UTILDIR) && $(MAKE) $@
- @$(CD) $(IESDIR) && $(MAKE) $@
- @$(CD) $(TOOLSDIR) && $(MAKE) $@
- @$(CD) $(USRTSTDIR) && $(MAKE) $@
- @$(CD) $(NETTSTDIR) && $(MAKE) $@
- @$(CD) $(ASSIMUDIR) && $(MAKE) $@
- @$(RM) libUE/libNasUE.a
-
-veryveryclean: veryclean
- @$(CD) $(BINDIR) && $(RM) * .*.nvram
- @$(CD) $(LIBDIR) && $(RM) *
- @$(CD) $(LIBDIR)UE && $(RM) *
- @$(CD) $(LIBDIR)MME && $(RM) *
-
-depend:
- @$(CD) $(SRCDIR) && $(MAKE) depend
- @$(CD) $(APIDIR) && $(MAKE) depend
- @$(CD) $(EMMDIR) && $(MAKE) depend
- @$(CD) $(ESMDIR) && $(MAKE) depend
- @$(CD) $(UTILDIR) && $(MAKE) depend
- @$(CD) $(IESDIR) && $(MAKE) depend
- @$(CD) $(TOOLSDIR) && $(MAKE) depend
- @$(CD) $(USRTSTDIR) && $(MAKE) depend
- @$(CD) $(NETTSTDIR) && $(MAKE) depend
- @$(CD) $(ASSIMUDIR) && $(MAKE) depend
-
-# DO NOT DELETE
diff --git a/openair-cn/NAS/EURECOM-NAS/Makefile.inc b/openair-cn/NAS/EURECOM-NAS/Makefile.inc
deleted file mode 100644
index 6244567e3d..0000000000
--- a/openair-cn/NAS/EURECOM-NAS/Makefile.inc
+++ /dev/null
@@ -1,68 +0,0 @@
-################################################################################
-# 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.
-#
-################################################################################
-# list of generated libraries
-LIBUTIL = libutil
-LIBAPI = libapi
-LIBIES = libies
-LIBEMMMSG = libEMMmsg
-LIBEMMSAP = libEMMsap
-LIBESMMSG = libESMmsg
-LIBESMSAP = libESMsap
-
-# Binary directories
-BINDIR = $(PROJDIR)/bin
-LIBDIR = $(PROJDIR)/lib
-LIBPROCESS = $(LIBDIR)$(PROCESS)
-
-# Source directories
-SECUDIR = $(OPENAIRCN_DIR)/SECU
-SRCDIR = $(PROJDIR)/src
-INCDIR = $(SRCDIR)/include
-UTILDIR = $(SRCDIR)/util
-APIDIR = $(SRCDIR)/api
-USERAPIDIR = $(APIDIR)/user
-NETAPIDIR = $(APIDIR)/network
-USIMAPIDIR = $(APIDIR)/usim
-MMEAPIDIR = $(APIDIR)/mme
-IESDIR = $(SRCDIR)/ies
-EMMDIR = $(SRCDIR)/emm
-ESMDIR = $(SRCDIR)/esm
-EMMMSGDIR = $(EMMDIR)/msg
-EMMSAPDIR = $(EMMDIR)/sap
-ESMMSGDIR = $(ESMDIR)/msg
-ESMSAPDIR = $(ESMDIR)/sap
-
-# Tools directory
-TOOLSDIR = $(PROJDIR)/tools
-
-# Test directories
-TSTDIR = $(PROJDIR)/tst
-USRTSTDIR = $(TSTDIR)/user
-NETTSTDIR = $(TSTDIR)/network
-ASSIMUDIR = $(TSTDIR)/as_simulator
diff --git a/openair-cn/NAS/EURECOM-NAS/Makerules b/openair-cn/NAS/EURECOM-NAS/Makerules
deleted file mode 100644
index c3e2f765fe..0000000000
--- a/openair-cn/NAS/EURECOM-NAS/Makerules
+++ /dev/null
@@ -1,61 +0,0 @@
-################################################################################
-# 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.
-#
-################################################################################
-CC = gcc
-RM = rm -f
-CP = cp -p
-LD = /usr/bin/ld
-AR = /usr/bin/ar
-CD = cd
-MAKE = make
-
-# machine hardware name
-HARDWARE_NAME = $(shell uname -m)
-ifeq ($(HARDWARE_NAME), x86_64)
- CFLAGS = $(INCLUDES) $(DEFINES) -fPIC -g -pthread
-else
- CFLAGS = $(INCLUDES) $(DEFINES) -g -pthread
-endif
-DEFINES = -DLINUX -D_REENTRANT -Wall -O -std=gnu99
-
-SVN_REV = $(shell svnversion -n .)
-DATE_REV = $(shell date '+%F %T')
-
-# Default builds UEprocess
-ifeq ($(PROCESS), MME)
- DEFINES += -DNAS_MME
-else
- PROCESS = UE
- DEFINES += -DNAS_UE
-endif
-
-LDFLAGS = -pthread -L$(LIBDIR) -L$(LIBPROCESS) -lrt
-
-SRCS = $(wildcard *.c)
-OBJS = $(SRCS:.c=.o)
-
diff --git a/openair-cn/NAS/EURECOM-NAS/src/Makefile b/openair-cn/NAS/EURECOM-NAS/src/Makefile
deleted file mode 100644
index e9b2e87b81..0000000000
--- a/openair-cn/NAS/EURECOM-NAS/src/Makefile
+++ /dev/null
@@ -1,82 +0,0 @@
-################################################################################
-# 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.
-#
-################################################################################
-ifndef PROJDIR
-PROJDIR = $(PWD)/..
-endif
-
-include $(PROJDIR)/Makerules
-include $(PROJDIR)/Makefile.inc
-
-export LD_RUN_PATH = $(LIBDIR):$(LIBPROCESS)
-
-TARGET = $(PROCESS)process
-
-# Define the version number
-DEFINES += -D'FIRMWARE_VERSION="$(SVN_REV) - $(DATE_REV)"'
-
-ifeq ($(TARGET), MMEprocess)
- SRCS = MMEprocess.c nas_network.c nas_parser.c nas_proc.c
-endif
-ifeq ($(TARGET), UEprocess)
- SRCS = UEprocess.c nas_network.c nas_parser.c nas_proc.c nas_user.c
-endif
-
-LIBS = -lutil -lapi -lEMMmsg -lESMmsg -lEMMsap -lESMsap -lies -lrt -lnettle -lcrypto -lm
-INCLUDES = -I. -I$(INCDIR) -I$(UTILDIR) -I$(USERAPIDIR) -I$(NETAPIDIR) \
- -I$(EMMDIR) -I$(EMMMSGDIR) -I$(EMMSAPDIR) \
- -I$(ESMDIR) -I$(ESMMSGDIR) -I$(ESMSAPDIR) \
- -I$(IESDIR) -I$(MMEAPIDIR)
-
-.PHONY: $(TARGET)
-
-%.o: %.c Makefile $(PROJDIR)/Makerules $(PROJDIR)/Makefile.inc
- @echo Compiling $<
- @$(CC) $(CFLAGS) -c $< -o $@
-
-$(TARGET): $(OBJS)
- $(CC) $(LDFLAGS) -o $@ $^ $(EMMDIR)/*.o $(ESMDIR)/*.o $(SECUDIR)/*.o $(LIBS)
- @echo Replacing $@ to $(BINDIR)
- @$(RM) $(BINDIR)/$@
- @$(CP) $@ $(BINDIR)
-
-# Always build the main object file which contains the version number
-$(TARGET).o: .FORCE
-.FORCE:
-
-clean:
- $(RM) $(OBJS) *.bak *~
-
-veryclean: clean
- $(RM) UE$(TARGET) MME$(TARGET)
-
-depend:
- makedepend -- ${CFLAGS} -- ${SRCS}
-
-# DO NOT DELETE THIS LINE -- make depend depends on it.
-
diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/Makefile b/openair-cn/NAS/EURECOM-NAS/src/api/Makefile
deleted file mode 100644
index cc4ae1eb25..0000000000
--- a/openair-cn/NAS/EURECOM-NAS/src/api/Makefile
+++ /dev/null
@@ -1,83 +0,0 @@
-################################################################################
-# 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.
-#
-################################################################################
-ifndef PROJDIR
-export PROJDIR = $(PWD)/../..
-endif
-
-include $(PROJDIR)/Makerules
-include $(PROJDIR)/Makefile.inc
-
-export INCLUDES = -I. -I$(INCDIR) -I$(UTILDIR) -I$(IESDIR) \
- -I$(EMMDIR) \
- -I$(ESMDIR) \
- -I$(EMMMSGDIR) \
- -I$(ESMMSGDIR) \
- -I$(SRCDIR) \
- -I$(OPENAIRCN_DIR)/COMMON \
- -I$(OPENAIRCN_DIR)/SECU
-
-TARGET = $(LIBAPI)
-TARGETS = $(TARGET).a $(TARGET).so
-OBJS = $(USERAPIDIR)/*.o $(NETAPIDIR)/*.o $(USIMAPIDIR)/*.o $(MMEAPIDIR)/*.o
-
-all:
- @$(CD) $(NETAPIDIR) && $(MAKE)
- @$(CD) $(USERAPIDIR) && $(MAKE)
- @$(CD) $(USIMAPIDIR) && $(MAKE)
- @$(CD) $(MMEAPIDIR) && $(MAKE)
- @$(MAKE) $(TARGETS)
-
-$(TARGET).a: $(OBJS)
- @echo target.a
- @$(RM) $@
- @$(AR) $(ARFLAGS) $@ $^
- @echo Replacing $@ to $(LIBPROCESS)
- @$(RM) $(LIBPROCESS)/$@
- @$(CP) $@ $(LIBPROCESS)
-
-$(TARGET).so: $(OBJS)
- @$(LD) -G -o $@ $^
- @echo Replacing $@ to $(LIBPROCESS)
- @$(RM) $(LIBPROCESS)/$@
- @$(CP) $@ $(LIBPROCESS)
-
-clean:
- $(RM) *.bak *~
- @$(CD) $(USERAPIDIR) && $(MAKE) $@
- @$(CD) $(NETAPIDIR) && $(MAKE) $@
- @$(CD) $(USIMAPIDIR) && $(MAKE) $@
- @$(CD) $(MMEAPIDIR) && $(MAKE) $@
-
-veryclean: clean
- $(RM) $(TARGETS)
-
-depend:
- makedepend -- ${CFLAGS} -- ${SRCS}
-
-# DO NOT DELETE THIS LINE -- make depend depends on it.
diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/network/as_message.h b/openair-cn/NAS/EURECOM-NAS/src/api/network/as_message.h
deleted file mode 120000
index 91405a472b..0000000000
--- a/openair-cn/NAS/EURECOM-NAS/src/api/network/as_message.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../openair2/COMMON/as_message.h
\ No newline at end of file
diff --git a/openair-cn/NAS/EURECOM-NAS/src/include/commonDef.h b/openair-cn/NAS/EURECOM-NAS/src/include/commonDef.h
deleted file mode 120000
index 5d0024abc5..0000000000
--- a/openair-cn/NAS/EURECOM-NAS/src/include/commonDef.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../openair2/COMMON/commonDef.h
\ No newline at end of file
diff --git a/openair-cn/NAS/EURECOM-NAS/src/include/networkDef.h b/openair-cn/NAS/EURECOM-NAS/src/include/networkDef.h
deleted file mode 120000
index 5fab87cc92..0000000000
--- a/openair-cn/NAS/EURECOM-NAS/src/include/networkDef.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../openair2/COMMON/networkDef.h
\ No newline at end of file
diff --git a/openair-cn/NAS/EURECOM-NAS/tst/COPYING b/openair-cn/NAS/EURECOM-NAS/tst/COPYING
deleted file mode 100644
index 94a9ed024d..0000000000
--- a/openair-cn/NAS/EURECOM-NAS/tst/COPYING
+++ /dev/null
@@ -1,674 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users. We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors. You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
- To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights. Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received. You must make sure that they, too, receive
-or can get the source code. And you must show them these terms so they
-know their rights.
-
- Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
- For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software. For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
- Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so. This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software. The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable. Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products. If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
- Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary. To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
- 0. Definitions.
-
- "This License" refers to version 3 of the GNU General Public License.
-
- "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
- To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
- A "covered work" means either the unmodified Program or a work based
-on the Program.
-
- To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
- An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
- 1. Source Code.
-
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
- A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
- The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
- The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
- The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
- The Corresponding Source for a work in source code form is that
-same work.
-
- 2. Basic Permissions.
-
- All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
- You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
- No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
- When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
- 4. Conveying Verbatim Copies.
-
- You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
- You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
- 5. Conveying Modified Source Versions.
-
- You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
- A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
- 6. Conveying Non-Source Forms.
-
- You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
- A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
- A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
- "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
- If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
- The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
- Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
- 7. Additional Terms.
-
- "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
- When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
- Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
- If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
- Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
- 8. Termination.
-
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
- However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
- Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
- 9. Acceptance Not Required for Having Copies.
-
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
- 10. Automatic Licensing of Downstream Recipients.
-
- Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
- An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
- 11. Patents.
-
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
- A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
- Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
- In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
- If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
- If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
- A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
- Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
- 12. No Surrender of Others' Freedom.
-
- If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
- 13. Use with the GNU Affero General Public License.
-
- Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
- 14. Revised Versions of this License.
-
- The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
- If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
- 15. Disclaimer of Warranty.
-
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. Limitation of Liability.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
- 17. Interpretation of Sections 15 and 16.
-
- If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-
- Copyright (C)
-
- This program 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.
-
- This program 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 this program. If not, see .
-
-Also add information on how to contact you by electronic and paper mail.
-
- If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
- Copyright (C)
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
- You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-.
-
- The GNU General Public License does not permit incorporating your program
-into proprietary programs. If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License. But first, please read
-.
diff --git a/openair-cn/NAS/EURECOM-NAS/tst/MSC/COPYING b/openair-cn/NAS/EURECOM-NAS/tst/MSC/COPYING
deleted file mode 100644
index 94a9ed024d..0000000000
--- a/openair-cn/NAS/EURECOM-NAS/tst/MSC/COPYING
+++ /dev/null
@@ -1,674 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users. We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors. You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
- To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights. Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received. You must make sure that they, too, receive
-or can get the source code. And you must show them these terms so they
-know their rights.
-
- Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
- For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software. For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
- Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so. This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software. The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable. Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products. If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
- Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary. To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
- 0. Definitions.
-
- "This License" refers to version 3 of the GNU General Public License.
-
- "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
- To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
- A "covered work" means either the unmodified Program or a work based
-on the Program.
-
- To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
- An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
- 1. Source Code.
-
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
- A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
- The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
- The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
- The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
- The Corresponding Source for a work in source code form is that
-same work.
-
- 2. Basic Permissions.
-
- All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
- You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
- No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
- When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
- 4. Conveying Verbatim Copies.
-
- You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
- You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
- 5. Conveying Modified Source Versions.
-
- You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
- A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
- 6. Conveying Non-Source Forms.
-
- You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
- A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
- A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
- "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
- If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
- The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
- Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
- 7. Additional Terms.
-
- "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
- When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
- Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
- If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
- Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
- 8. Termination.
-
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
- However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
- Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
- 9. Acceptance Not Required for Having Copies.
-
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
- 10. Automatic Licensing of Downstream Recipients.
-
- Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
- An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
- 11. Patents.
-
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
- A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
- Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
- In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
- If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
- If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
- A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
- Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
- 12. No Surrender of Others' Freedom.
-
- If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
- 13. Use with the GNU Affero General Public License.
-
- Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
- 14. Revised Versions of this License.
-
- The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
- If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
- 15. Disclaimer of Warranty.
-
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. Limitation of Liability.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
- 17. Interpretation of Sections 15 and 16.
-
- If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-
- Copyright (C)
-
- This program 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.
-
- This program 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 this program. If not, see .
-
-Also add information on how to contact you by electronic and paper mail.
-
- If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
- Copyright (C)
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
- You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-.
-
- The GNU General Public License does not permit incorporating your program
-into proprietary programs. If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License. But first, please read
-.
diff --git a/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/COPYING b/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/COPYING
deleted file mode 100644
index 94a9ed024d..0000000000
--- a/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/COPYING
+++ /dev/null
@@ -1,674 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users. We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors. You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
- To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights. Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received. You must make sure that they, too, receive
-or can get the source code. And you must show them these terms so they
-know their rights.
-
- Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
- For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software. For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
- Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so. This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software. The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable. Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products. If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
- Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary. To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
- 0. Definitions.
-
- "This License" refers to version 3 of the GNU General Public License.
-
- "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
- To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
- A "covered work" means either the unmodified Program or a work based
-on the Program.
-
- To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
- An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
- 1. Source Code.
-
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
- A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
- The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
- The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
- The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
- The Corresponding Source for a work in source code form is that
-same work.
-
- 2. Basic Permissions.
-
- All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
- You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
- No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
- When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
- 4. Conveying Verbatim Copies.
-
- You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
- You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
- 5. Conveying Modified Source Versions.
-
- You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
- A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
- 6. Conveying Non-Source Forms.
-
- You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
- A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
- A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
- "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
- If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
- The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
- Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
- 7. Additional Terms.
-
- "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
- When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
- Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
- If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
- Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
- 8. Termination.
-
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
- However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
- Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
- 9. Acceptance Not Required for Having Copies.
-
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
- 10. Automatic Licensing of Downstream Recipients.
-
- Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
- An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
- 11. Patents.
-
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
- A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
- Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
- In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
- If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
- If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
- A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
- Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
- 12. No Surrender of Others' Freedom.
-
- If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
- 13. Use with the GNU Affero General Public License.
-
- Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
- 14. Revised Versions of this License.
-
- The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
- If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
- 15. Disclaimer of Warranty.
-
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. Limitation of Liability.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
- 17. Interpretation of Sections 15 and 16.
-
- If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-
- Copyright (C)
-
- This program 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.
-
- This program 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 this program. If not, see .
-
-Also add information on how to contact you by electronic and paper mail.
-
- If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
- Copyright (C)
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
- You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-.
-
- The GNU General Public License does not permit incorporating your program
-into proprietary programs. If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License. But first, please read
-.
diff --git a/openair-cn/NAS/EURECOM-NAS/tst/network/COPYING b/openair-cn/NAS/EURECOM-NAS/tst/network/COPYING
deleted file mode 100644
index 94a9ed024d..0000000000
--- a/openair-cn/NAS/EURECOM-NAS/tst/network/COPYING
+++ /dev/null
@@ -1,674 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users. We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors. You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
- To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights. Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received. You must make sure that they, too, receive
-or can get the source code. And you must show them these terms so they
-know their rights.
-
- Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
- For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software. For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
- Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so. This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software. The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable. Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products. If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
- Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary. To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
- 0. Definitions.
-
- "This License" refers to version 3 of the GNU General Public License.
-
- "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
- To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
- A "covered work" means either the unmodified Program or a work based
-on the Program.
-
- To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
- An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
- 1. Source Code.
-
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
- A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
- The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
- The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
- The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
- The Corresponding Source for a work in source code form is that
-same work.
-
- 2. Basic Permissions.
-
- All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
- You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
- No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
- When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
- 4. Conveying Verbatim Copies.
-
- You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
- You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
- 5. Conveying Modified Source Versions.
-
- You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
- A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
- 6. Conveying Non-Source Forms.
-
- You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
- A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
- A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
- "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
- If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
- The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
- Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
- 7. Additional Terms.
-
- "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
- When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
- Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
- If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
- Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
- 8. Termination.
-
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
- However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
- Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
- 9. Acceptance Not Required for Having Copies.
-
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
- 10. Automatic Licensing of Downstream Recipients.
-
- Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
- An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
- 11. Patents.
-
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
- A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
- Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
- In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
- If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
- If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
- A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
- Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
- 12. No Surrender of Others' Freedom.
-
- If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
- 13. Use with the GNU Affero General Public License.
-
- Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
- 14. Revised Versions of this License.
-
- The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
- If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
- 15. Disclaimer of Warranty.
-
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. Limitation of Liability.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
- 17. Interpretation of Sections 15 and 16.
-
- If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-
- Copyright (C)
-
- This program 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.
-
- This program 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 this program. If not, see .
-
-Also add information on how to contact you by electronic and paper mail.
-
- If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
- Copyright (C)
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
- You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-.
-
- The GNU General Public License does not permit incorporating your program
-into proprietary programs. If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License. But first, please read
-.
diff --git a/openair-cn/NAS/EURECOM-NAS/tst/user/COPYING b/openair-cn/NAS/EURECOM-NAS/tst/user/COPYING
deleted file mode 100644
index 94a9ed024d..0000000000
--- a/openair-cn/NAS/EURECOM-NAS/tst/user/COPYING
+++ /dev/null
@@ -1,674 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users. We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors. You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
- To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights. Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received. You must make sure that they, too, receive
-or can get the source code. And you must show them these terms so they
-know their rights.
-
- Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
- For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software. For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
- Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so. This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software. The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable. Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products. If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
- Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary. To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
- 0. Definitions.
-
- "This License" refers to version 3 of the GNU General Public License.
-
- "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
- To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
- A "covered work" means either the unmodified Program or a work based
-on the Program.
-
- To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
- An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
- 1. Source Code.
-
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
- A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
- The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
- The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
- The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
- The Corresponding Source for a work in source code form is that
-same work.
-
- 2. Basic Permissions.
-
- All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
- You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
- No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
- When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
- 4. Conveying Verbatim Copies.
-
- You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
- You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
- 5. Conveying Modified Source Versions.
-
- You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
- A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
- 6. Conveying Non-Source Forms.
-
- You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
- A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
- A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
- "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
- If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
- The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
- Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
- 7. Additional Terms.
-
- "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
- When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
- Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
- If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
- Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
- 8. Termination.
-
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
- However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
- Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
- 9. Acceptance Not Required for Having Copies.
-
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
- 10. Automatic Licensing of Downstream Recipients.
-
- Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
- An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
- 11. Patents.
-
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
- A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
- Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
- In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
- If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
- If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
- A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
- Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
- 12. No Surrender of Others' Freedom.
-
- If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
- 13. Use with the GNU Affero General Public License.
-
- Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
- 14. Revised Versions of this License.
-
- The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
- If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
- 15. Disclaimer of Warranty.
-
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. Limitation of Liability.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
- 17. Interpretation of Sections 15 and 16.
-
- If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-
- Copyright (C)
-
- This program 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.
-
- This program 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 this program. If not, see .
-
-Also add information on how to contact you by electronic and paper mail.
-
- If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
- Copyright (C)
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
- You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-.
-
- The GNU General Public License does not permit incorporating your program
-into proprietary programs. If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License. But first, please read
-.
diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/COPYING b/openair-cn/NAS/MME/API/MME/COPYING
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/api/COPYING
rename to openair-cn/NAS/MME/API/MME/COPYING
diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/mme/Makefile b/openair-cn/NAS/MME/API/MME/Makefile
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/api/mme/Makefile
rename to openair-cn/NAS/MME/API/MME/Makefile
diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/mme/mme_api.c b/openair-cn/NAS/MME/API/MME/mme_api.c
similarity index 99%
rename from openair-cn/NAS/EURECOM-NAS/src/api/mme/mme_api.c
rename to openair-cn/NAS/MME/API/MME/mme_api.c
index dd0ff9c2f6..91b688558c 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/api/mme/mme_api.c
+++ b/openair-cn/NAS/MME/API/MME/mme_api.c
@@ -44,7 +44,6 @@ Description Implements the API used by the NAS layer running in the MME
*****************************************************************************/
-#ifdef NAS_MME
#include "mme_api.h"
#include "nas_log.h"
@@ -99,19 +98,19 @@ static const plmn_t mme_api_plmn = {0, 2, 0xf, 8, 0, 1}; // 20810
/* Authentication parameter RAND */
-static const UInt8_t _mme_api_rand[AUTH_RAND_SIZE] = {
+static const uint8_t _mme_api_rand[AUTH_RAND_SIZE] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x02, 0x03, 0x04
};
/* Authentication parameter AUTN */
-static const UInt8_t _mme_api_autn[AUTH_AUTN_SIZE] = {
+static const uint8_t _mme_api_autn[AUTH_AUTN_SIZE] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x05, 0x04, 0x03, 0x02, 0x00,
0x00, 0x00, 0x00, 0x00
};
/* Authentication response parameter */
-static const UInt8_t _mme_api_xres[AUTH_XRES_SIZE] = {
+static const uint8_t _mme_api_xres[AUTH_XRES_SIZE] = {
0x67, 0x70, 0x3a, 0x31, 0xf2, 0x2a, 0x2d, 0x51, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00
};
@@ -568,5 +567,3 @@ int mme_api_unsubscribe(OctetString *apn)
LOG_FUNC_RETURN(rc);
}
-
-#endif // NAS_MME
diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/mme/mme_api.h b/openair-cn/NAS/MME/API/MME/mme_api.h
similarity index 97%
rename from openair-cn/NAS/EURECOM-NAS/src/api/mme/mme_api.h
rename to openair-cn/NAS/MME/API/MME/mme_api.h
index dc3a603fcf..a8f83e1237 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/api/mme/mme_api.h
+++ b/openair-cn/NAS/MME/API/MME/mme_api.h
@@ -46,23 +46,20 @@ Description Implements the API used by the NAS layer running in the MME
#ifndef __MME_API_H__
#define __MME_API_H__
-#ifdef NAS_MME
# if defined(NAS_BUILT_IN_EPC)
# include "mme_config.h"
# endif
#include "commonDef.h"
#include "securityDef.h"
#include "OctetString.h"
-#endif
/****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/
/****************************************************************************/
/* Maximum number of UEs the MME may simultaneously support */
-#define MME_API_NB_UE_MAX 1
+#define MME_API_NB_UE_MAX 256
-#ifdef NAS_MME
/* Features supported by the MME */
typedef enum mme_api_feature_s {
@@ -99,6 +96,8 @@ typedef struct mme_api_emm_config_s {
*/
typedef struct mme_api_esm_config_s {
mme_api_feature_t features; /* Supported features */
+ uint8_t dns_prim_ipv4[4]; /* Network byte order */
+ uint8_t dns_sec_ipv4[4]; /* Network byte order */
} mme_api_esm_config_t;
/****************************************************************************/
@@ -144,6 +143,4 @@ int mme_api_subscribe(OctetString *apn, mme_api_ip_version_t mme_pdn_index, Octe
int is_emergency, mme_api_qos_t *qos);
int mme_api_unsubscribe(OctetString *apn);
-#endif // NAS_MME
-
#endif /* __MME_API_H__*/
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/Attach.c b/openair-cn/NAS/MME/EMM/Attach.c
similarity index 54%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/Attach.c
rename to openair-cn/NAS/MME/EMM/Attach.c
index cea1945847..ec7a873cd9 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/Attach.c
+++ b/openair-cn/NAS/MME/EMM/Attach.c
@@ -73,13 +73,11 @@ Description Defines the attach related EMM procedure executed by the
#include "NasSecurityAlgorithms.h"
-#ifdef NAS_MME
#include "mme_api.h"
#include "mme_config.h"
# if defined(NAS_BUILT_IN_EPC)
# include "nas_itti_messaging.h"
# endif
-#endif
#include // memcmp, memcpy
#include // malloc, free
@@ -97,40 +95,12 @@ static const char *_emm_attach_type_str[] = {
"EPS", "IMSI", "EMERGENCY", "RESERVED"
};
-/*
- * --------------------------------------------------------------------------
- * Internal data handled by the attach procedure in the UE
- * --------------------------------------------------------------------------
- */
-#ifdef NAS_UE
-/*
- * Timer handlers
- */
-void *_emm_attach_t3410_handler(void *);
-static void *_emm_attach_t3411_handler(void *);
-static void *_emm_attach_t3402_handler(void *);
-
-/*
- * Abnormal case attach procedure
- */
-static void _emm_attach_abnormal_cases_bcd(emm_sap_t *);
-
-/*
- * Internal data used for attach procedure
- */
-static struct {
-#define EMM_ATTACH_COUNTER_MAX 5
- unsigned int attempt_count; /* Counter used to limit the number of
- * subsequently rejected attach attempts */
-} _emm_attach_data = {0};
-#endif // NAS_UE
/*
* --------------------------------------------------------------------------
* Internal data handled by the attach procedure in the MME
* --------------------------------------------------------------------------
*/
-#ifdef NAS_MME
/*
* Timer handlers
*/
@@ -160,12 +130,12 @@ static int _emm_attach_update(emm_data_context_t *ctx, unsigned int ueid,
GUTI_t *guti, imsi_t *imsi, imei_t *imei,
int eea, int eia, int ucs2, int uea, int uia, int gea,
int umts_present, int gprs_present,
- const OctetString *esm_msg);
+ const OctetString *esm_msg_pP);
/*
* Internal data used for attach procedure
*/
-typedef struct {
+typedef struct attach_data_s {
unsigned int ueid; /* UE identifier */
#define ATTACH_COUNTER_MAX 5
unsigned int retransmission_count; /* Retransmission counter */
@@ -175,872 +145,16 @@ typedef struct {
static int _emm_attach_accept(emm_data_context_t *emm_ctx, attach_data_t *data);
-#endif // NAS_MME
-
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
-/*
- * --------------------------------------------------------------------------
- * Attach procedure executed by the UE
- * --------------------------------------------------------------------------
- */
-#ifdef NAS_UE
-/****************************************************************************
- ** **
- ** Name: emm_proc_attach() **
- ** **
- ** Description: Initiate EPS attach procedure to register a UE in PS mode **
- ** of operation for EPS services only, or register a UE for **
- ** emergency bearer services. **
- ** **
- ** 3GPP TS 24.301, section 5.5.1.2.2 **
- ** In state EMM-DEREGISTERED, the UE initiates the attach **
- ** procedure by sending an ATTACH REQUEST message to the MME,**
- ** starting timer T3410 and entering state EMM-REGISTERED- **
- ** INITIATED. **
- ** **
- ** Inputs: type: Type of the requested attach **
- ** Others: _emm_data **
- ** **
- ** Outputs: None **
- ** Return: RETURNok, RETURNerror **
- ** Others: T3402, T3410, T3411 **
- ** **
- ***************************************************************************/
-int emm_proc_attach(emm_proc_attach_type_t type)
-{
- LOG_FUNC_IN;
-
- emm_sap_t emm_sap;
- emm_as_establish_t *emm_as = &emm_sap.u.emm_as.u.establish;
- esm_sap_t esm_sap;
- int rc;
-
- LOG_TRACE(INFO, "EMM-PROC - Initiate EPS attach type = %s (%d)",
- _emm_attach_type_str[type], type);
-
- /* Update the emergency bearer service indicator */
- if (type == EMM_ATTACH_TYPE_EMERGENCY) {
- _emm_data.is_emergency = TRUE;
- }
-
- /* Setup initial NAS information message to transfer */
- emm_as->NASinfo = EMM_AS_NAS_INFO_ATTACH;
- /* Set the attach type */
- emm_as->type = type;
-
- /* Set the RRC connection establishment cause */
- if (_emm_data.is_emergency) {
- emm_as->RRCcause = NET_ESTABLISH_CAUSE_EMERGENCY;
- emm_as->RRCtype = NET_ESTABLISH_TYPE_EMERGENCY_CALLS;
- } else {
- emm_as->RRCcause = NET_ESTABLISH_CAUSE_MO_SIGNAL;
- emm_as->RRCtype = NET_ESTABLISH_TYPE_ORIGINATING_SIGNAL;
- }
-
- /* Set the PLMN identifier of the selected PLMN */
- emm_as->plmnID = &_emm_data.splmn;
- /*
- * Process the EPS mobile identity
- */
- emm_as->UEid.guti = NULL;
- emm_as->UEid.tai = NULL;
- emm_as->UEid.imsi = NULL;
- emm_as->UEid.imei = NULL;
-
- /* Check whether the UE is configured for "AttachWithIMSI" */
- if (_emm_data.AttachWithImsi) {
- /* Check whether the selected PLMN is neither the registered PLMN
- * nor in the list of equivalent PLMNs */
- if ( (!_emm_data.is_rplmn) && (!_emm_data.is_eplmn) ) {
- LOG_TRACE(INFO, "EMM-PROC - Initiate EPS attach with IMSI");
- /* Include the IMSI */
- emm_as->UEid.imsi = _emm_data.imsi;
- } else {
- LOG_TRACE(INFO,
- "EMM-PROC - Initiate EPS attach with NO IMSI, is registered PLMN %d, is equivalent PLMN %d",
- _emm_data.is_rplmn,
- _emm_data.is_eplmn);
- }
- } else if (_emm_data.guti) {
- LOG_TRACE(INFO, "EMM-PROC - Initiate EPS attach with GUTI");
- /* Include a valid GUTI and the last visited registered TAI */
- emm_as->UEid.guti = _emm_data.guti;
- emm_as->UEid.tai = _emm_data.tai;
- } else if (!_emm_data.is_emergency) {
- LOG_TRACE(INFO, "EMM-PROC - Initiate EPS attach with IMSI cause is no emergency and no GUTI");
- /* Include the IMSI if no valid GUTI is available */
- emm_as->UEid.imsi = _emm_data.imsi;
- } else {
- /* The UE is attaching for emergency bearer services and
- * does not hold a valid GUTI */
- if (_emm_data.imsi) {
- /* Include the IMSI if valid (USIM is present) */
- LOG_TRACE(INFO, "EMM-PROC - Initiate EPS attach with IMSI cause is emergency and no GUTI");
- emm_as->UEid.imsi = _emm_data.imsi;
- } else {
- LOG_TRACE(INFO, "EMM-PROC - Initiate EPS attach with IMSI cause is emergency and no GUTI and no IMSI");
- /* Include the IMEI if the IMSI is not valid */
- emm_as->UEid.imei = _emm_data.imei;
- }
- }
-
- /* Setup EPS NAS security data */
- emm_as_set_security_data(&emm_as->sctx, _emm_data.security, FALSE, FALSE);
- emm_as->ksi = EMM_AS_NO_KEY_AVAILABLE;
-
- if (_emm_data.security) {
- if (_emm_data.security->type != EMM_KSI_NOT_AVAILABLE) {
- emm_as->ksi = _emm_data.security->eksi;
- }
-
- LOG_TRACE(INFO, "EMM-PROC - eps_encryption 0x%X", _emm_data.security->capability.eps_encryption);
- LOG_TRACE(INFO, "EMM-PROC - eps_integrity 0x%X", _emm_data.security->capability.eps_integrity);
- emm_as->encryption = _emm_data.security->capability.eps_encryption;
- emm_as->integrity = _emm_data.security->capability.eps_integrity;
- }
-
- /*
- * Notify ESM that initiation of a PDN connectivity procedure
- * is requested to setup a default EPS bearer
- */
- esm_sap.primitive = ESM_PDN_CONNECTIVITY_REQ;
- esm_sap.is_standalone = FALSE;
- esm_sap.data.pdn_connect.is_defined = TRUE;
- esm_sap.data.pdn_connect.cid = 1;
- /* TODO: PDN type should be set according to the IP capability of the UE */
- esm_sap.data.pdn_connect.pdn_type = NET_PDN_TYPE_IPV4V6;
- esm_sap.data.pdn_connect.apn = NULL;
- esm_sap.data.pdn_connect.is_emergency = _emm_data.is_emergency;
- rc = esm_sap_send(&esm_sap);
-
- if (rc != RETURNerror) {
- /* Setup EMM procedure handler to be executed upon receiving
- * lower layer notification */
- rc = emm_proc_lowerlayer_initialize(emm_proc_attach_request,
- emm_proc_attach_failure,
- emm_proc_attach_release, NULL);
-
- if (rc != RETURNok) {
- LOG_TRACE(WARNING, "Failed to initialize EMM procedure handler");
- LOG_FUNC_RETURN (RETURNerror);
- }
-
- /* Start T3410 timer */
- T3410.id = nas_timer_start(T3410.sec, _emm_attach_t3410_handler, NULL);
- LOG_TRACE(INFO,"EMM-PROC - Timer T3410 (%d) expires in %ld seconds",
- T3410.id, T3410.sec);
- /* Stop T3402 and T3411 timers if running */
- T3402.id = nas_timer_stop(T3402.id);
- T3411.id = nas_timer_stop(T3411.id);
-
- /*
- * Notify EMM-AS SAP that a RRC connection establishment procedure
- * is requested from the Access-Stratum to send initial NAS message
- * attach request to the network
- */
- emm_sap.primitive = EMMAS_ESTABLISH_REQ;
- /* Get the PDN connectivity request to transfer within the ESM
- * container of the initial attach request message */
- emm_sap.u.emm_as.u.establish.NASmsg = esm_sap.send;
- rc = emm_sap_send(&emm_sap);
- }
-
- LOG_FUNC_RETURN(rc);
-}
-
-/****************************************************************************
- ** **
- ** Name: emm_proc_attach_request() **
- ** **
- ** Description: Performs the attach procedure upon receipt of indication **
- ** from lower layers that Attach Request message has been **
- ** successfully delivered to the network. **
- ** **
- ** Inputs: args: Not used **
- ** Others: None **
- ** **
- ** Outputs: None **
- ** Return: RETURNok, RETURNerror **
- ** Others: None **
- ** **
- ***************************************************************************/
-int emm_proc_attach_request(void *args)
-{
- LOG_FUNC_IN;
-
- emm_sap_t emm_sap;
- int rc;
-
- /*
- * Notify EMM that Attach Request has been sent to the network
- */
- emm_sap.primitive = EMMREG_ATTACH_REQ;
- rc = emm_sap_send(&emm_sap);
-
- LOG_FUNC_RETURN(rc);
-}
-
-/****************************************************************************
- ** **
- ** Name: emm_proc_attach_accept() **
- ** **
- ** Description: Performs the attach procedure accepted by the network. **
- ** **
- ** 3GPP TS 24.301, section 5.5.1.2.4 **
- ** Upon receiving the ATTACH ACCEPT message, the UE shall **
- ** stop timer T3410 and send an ATTACH COMPLETE message to **
- ** the MME. **
- ** **
- ** Inputs: t3412: Value of the T3412 timer in seconds **
- ** t3402: Value of the T3402 timer in seconds **
- ** t3423: Value of the T3423 timer in seconds **
- ** n_tais: Number of tracking area identities contai- **
- ** ned in the TAI list **
- ** tai: The TAI list that identifies the tracking **
- ** areas the UE is registered to **
- ** guti: New UE's temporary identity assigned by **
- ** the MME (GUTI reallocation) **
- ** n_eplmns: Number of equivalent PLMNs **
- ** eplmns: List of equivalent PLMNs **
- ** esm_msg: Activate default EPS bearer context re- **
- ** quest ESM message **
- ** Others: None **
- ** **
- ** Outputs: None **
- ** Return: RETURNok, RETURNerror **
- ** Others: _emm_data, T3412, T3402, T3423 **
- ** **
- ***************************************************************************/
-int emm_proc_attach_accept(long t3412, long t3402, long t3423,
- int n_tais, tai_t *tai, GUTI_t *guti,
- int n_eplmns, plmn_t *eplmn,
- const OctetString *esm_msg)
-{
- LOG_FUNC_IN;
-
- emm_sap_t emm_sap;
- esm_sap_t esm_sap;
- int rc;
- int i;
- int j;
-
- LOG_TRACE(INFO, "EMM-PROC - EPS attach accepted by the network");
-
- /* Stop timer T3410 */
- LOG_TRACE(INFO, "EMM-PROC - Stop timer T3410 (%d)", T3410.id);
- T3410.id = nas_timer_stop(T3410.id);
-
- /* Delete old TAI list and store the received TAI list */
- _emm_data.ltai.n_tais = n_tais;
-
- for (i = 0; (i < n_tais) && (i < EMM_DATA_TAI_MAX); i++) {
- _emm_data.ltai.tai[i] = tai[i];
- }
-
- /* Update periodic tracking area update timer value */
- T3412.sec = t3412;
-
- /* Update attach failure timer value */
- if ( !(t3402 < 0) ) {
- T3402.sec = t3402;
- }
-
- /* Update E-UTRAN deactivate ISR timer value */
- if ( !(t3423 < 0) ) {
- T3423.sec = t3423;
- }
-
- /* Delete old GUTI and store the new assigned GUTI if provided */
- if (guti) {
- *_emm_data.guti = *guti;
- }
-
- /* Update the stored list of equivalent PLMNs */
- _emm_data.nvdata.eplmn.n_plmns = 0;
-
- if (n_eplmns > 0) {
- for (i = 0; (i < n_eplmns) && (i < EMM_DATA_EPLMN_MAX); i++) {
- int is_forbidden = FALSE;
-
- if (!_emm_data.is_emergency) {
- /* If the attach procedure is not for emergency bearer
- * services, the UE shall remove from the list any PLMN
- * code that is already in the list of forbidden PLMNs */
- for (j = 0; j < _emm_data.fplmn.n_plmns; j++) {
- if (PLMNS_ARE_EQUAL(eplmn[i], _emm_data.fplmn.plmn[j])) {
- is_forbidden = TRUE;
- break;
- }
- }
- }
-
- if ( !is_forbidden ) {
- _emm_data.nvdata.eplmn.plmn[_emm_data.nvdata.eplmn.n_plmns++] =
- eplmn[i];
- }
- }
-
- /* Add the PLMN code of the registered PLMN that sent the list */
- if (_emm_data.nvdata.eplmn.n_plmns < EMM_DATA_EPLMN_MAX) {
- _emm_data.nvdata.eplmn.plmn[_emm_data.nvdata.eplmn.n_plmns++] =
- _emm_data.splmn;
- }
- }
-
- /*
- * Notify ESM that a default EPS bearer has to be activated
- */
- esm_sap.primitive = ESM_DEFAULT_EPS_BEARER_CONTEXT_ACTIVATE_REQ;
- esm_sap.is_standalone = FALSE;
- esm_sap.recv = esm_msg;
- rc = esm_sap_send(&esm_sap);
-
- if ( (rc != RETURNerror) && (esm_sap.err == ESM_SAP_SUCCESS) ) {
- /* Setup EMM procedure handler to be executed upon receiving
- * lower layer notification */
- rc = emm_proc_lowerlayer_initialize(emm_proc_attach_complete,
- emm_proc_attach_failure,
- NULL, NULL);
-
- if (rc != RETURNok) {
- LOG_TRACE(WARNING,
- "EMM-PROC - Failed to initialize EMM procedure handler");
- LOG_FUNC_RETURN (RETURNerror);
- }
-
- /*
- * Notify EMM-AS SAP that Attach Complete message together with
- * an Activate Default EPS Bearer Context Accept message has to
- * be sent to the network
- */
- emm_sap.primitive = EMMAS_DATA_REQ;
- emm_sap.u.emm_as.u.data.guti = _emm_data.guti;
- emm_sap.u.emm_as.u.data.ueid = 0;
- /* Setup EPS NAS security data */
- emm_as_set_security_data(&emm_sap.u.emm_as.u.data.sctx,
- _emm_data.security, FALSE, TRUE);
- /* Get the activate default EPS bearer context accept message
- * to be transfered within the ESM container of the attach
- * complete message */
- emm_sap.u.emm_as.u.data.NASinfo = EMM_AS_NAS_DATA_ATTACH;
- emm_sap.u.emm_as.u.data.NASmsg = esm_sap.send;
- rc = emm_sap_send(&emm_sap);
- } else if (esm_sap.err != ESM_SAP_DISCARDED) {
- /* 3GPP TS 24.301, section 5.5.1.2.6, case j
- * If the ACTIVATE DEFAULT BEARER CONTEXT REQUEST message combined
- * with the ATTACH ACCEPT is not accepted by the UE due to failure
- * in the UE ESM sublayer, then the UE shall initiate the detach
- * procedure by sending a DETACH REQUEST message to the network.
- */
- emm_sap.primitive = EMMREG_DETACH_INIT;
- rc = emm_sap_send(&emm_sap);
- } else {
- /*
- * ESM procedure failed and, received message has been discarded or
- * Status message has been returned; ignore ESM procedure failure
- */
- rc = RETURNok;
- }
-
- LOG_FUNC_RETURN(rc);
-}
-
-/****************************************************************************
- ** **
- ** Name: emm_proc_attach_reject() **
- ** **
- ** Description: Performs the attach procedure rejected by the network. **
- ** **
- ** 3GPP TS 24.301, section 5.5.1.2.5 **
- ** Upon receiving the ATTACH REJECT message, the UE shall **
- ** stop timer T3410 and take actions depending on the EMM **
- ** cause value received. **
- ** **
- ** Inputs: emm_cause: EMM cause indicating why the network re- **
- ** jected the attach request **
- ** esm_msg: PDN connectivity reject ESM message **
- ** Others: None **
- ** **
- ** Outputs: None **
- ** Return: RETURNok, RETURNerror **
- ** Others: _emm_data, _emm_attach_data, T3410 **
- ** **
- ***************************************************************************/
-int emm_proc_attach_reject(int emm_cause, const OctetString *esm_msg)
-{
- LOG_FUNC_IN;
-
- emm_sap_t emm_sap;
- int rc;
-
- LOG_TRACE(WARNING, "EMM-PROC - EPS attach rejected by the network, "
- "EMM cause = %d", emm_cause);
-
- /* Stop timer T3410 */
- LOG_TRACE(INFO, "EMM-PROC - Stop timer T3410 (%d)", T3410.id);
- T3410.id = nas_timer_stop(T3410.id);
-
- /* Update the EPS update status, the GUTI, the visited registered TAI and
- * the eKSI */
- switch (emm_cause) {
- case EMM_CAUSE_ILLEGAL_UE:
- case EMM_CAUSE_ILLEGAL_ME:
- case EMM_CAUSE_EPS_NOT_ALLOWED:
- case EMM_CAUSE_BOTH_NOT_ALLOWED:
- case EMM_CAUSE_PLMN_NOT_ALLOWED:
- case EMM_CAUSE_NOT_AUTHORIZED_IN_PLMN:
- case EMM_CAUSE_EPS_NOT_ALLOWED_IN_PLMN:
- case EMM_CAUSE_TA_NOT_ALLOWED:
- case EMM_CAUSE_ROAMING_NOT_ALLOWED:
- case EMM_CAUSE_NO_SUITABLE_CELLS:
- /* Set the EPS update status to EU3 ROAMING NOT ALLOWED */
- _emm_data.status = EU3_ROAMING_NOT_ALLOWED;
- /* Delete the GUTI */
- _emm_data.guti = NULL;
- /* Delete the last visited registered TAI */
- _emm_data.tai = NULL;
-
- /* Delete the eKSI */
- if (_emm_data.security) {
- _emm_data.security->type = EMM_KSI_NOT_AVAILABLE;
- }
-
- break;
-
- default :
- break;
- }
-
- /* Update list of equivalents PLMNs and attach attempt counter */
- switch (emm_cause) {
- case EMM_CAUSE_ILLEGAL_UE:
- case EMM_CAUSE_ILLEGAL_ME:
- case EMM_CAUSE_EPS_NOT_ALLOWED:
- case EMM_CAUSE_BOTH_NOT_ALLOWED:
- /* Consider the USIM as invalid for EPS services */
- _emm_data.usim_is_valid = FALSE;
- /* Delete the list of equivalent PLMNs */
- _emm_data.nvdata.eplmn.n_plmns = 0;
- break;
-
- case EMM_CAUSE_PLMN_NOT_ALLOWED:
- case EMM_CAUSE_NOT_AUTHORIZED_IN_PLMN:
- case EMM_CAUSE_ROAMING_NOT_ALLOWED:
- /* Delete the list of equivalent PLMNs */
- _emm_data.nvdata.eplmn.n_plmns = 0;
- /* Reset the attach attempt counter */
- _emm_attach_data.attempt_count = 0;
- break;
-
- case EMM_CAUSE_TA_NOT_ALLOWED:
- case EMM_CAUSE_EPS_NOT_ALLOWED_IN_PLMN:
- case EMM_CAUSE_NO_SUITABLE_CELLS:
- /* Reset the attach attempt counter */
- _emm_attach_data.attempt_count = 0;
- break;
-
- case EMM_CAUSE_ESM_FAILURE:
-
- /* 3GPP TS 24.301, section 5.5.1.2.6, case d */
- if (_emm_data.NAS_SignallingPriority != 1) {
- /* The UE is not configured for NAS signalling low priority;
- * set the attach attempt counter to 5 */
- _emm_attach_data.attempt_count = EMM_ATTACH_COUNTER_MAX;
- }
-
- break;
-
- case EMM_CAUSE_SEMANTICALLY_INCORRECT:
- case EMM_CAUSE_INVALID_MANDATORY_INFO:
- case EMM_CAUSE_MESSAGE_TYPE_NOT_IMPLEMENTED:
- case EMM_CAUSE_IE_NOT_IMPLEMENTED:
- case EMM_CAUSE_PROTOCOL_ERROR:
- /* 3GPP TS 24.301, section 5.5.1.2.6, case d
- * Set the attach attempt counter to 5 */
- _emm_attach_data.attempt_count = EMM_ATTACH_COUNTER_MAX;
- break;
-
- default :
- break;
- }
-
- /* Update "forbidden lists" */
- switch (emm_cause) {
- case EMM_CAUSE_PLMN_NOT_ALLOWED:
- case EMM_CAUSE_NOT_AUTHORIZED_IN_PLMN:
- /* Store the PLMN identity in the "forbidden PLMN list" */
- _emm_data.fplmn.plmn[_emm_data.fplmn.n_plmns++] = _emm_data.splmn;
- break;
-
- case EMM_CAUSE_TA_NOT_ALLOWED:
- /* Store the current TAI in the list of "forbidden tracking
- * areas for regional provision of service" */
- _emm_data.ftai.tai[_emm_data.ftai.n_tais++] = *_emm_data.tai;
- break;
-
- case EMM_CAUSE_ROAMING_NOT_ALLOWED:
- /* Store the current TAI in the list of "forbidden tracking
- * areas for roaming" */
- _emm_data.ftai_roaming.tai[_emm_data.ftai_roaming.n_tais++] = *_emm_data.tai;
- break;
-
- case EMM_CAUSE_EPS_NOT_ALLOWED_IN_PLMN:
- /* Store the PLMN identity in the "forbidden PLMNs for GPRS
- * service" list */
- _emm_data.fplmn_gprs.plmn[_emm_data.fplmn_gprs.n_plmns++] = _emm_data.splmn;
- break;
-
- default :
- break;
- }
-
- /* Update state of EMM sublayer */
- switch (emm_cause) {
- case EMM_CAUSE_ILLEGAL_UE:
- case EMM_CAUSE_ILLEGAL_ME:
- case EMM_CAUSE_EPS_NOT_ALLOWED:
- case EMM_CAUSE_BOTH_NOT_ALLOWED:
- /*
- * Notify EMM that EPS attach is rejected
- */
- emm_sap.primitive = EMMREG_ATTACH_REJ;
- break;
-
- case EMM_CAUSE_PLMN_NOT_ALLOWED:
- case EMM_CAUSE_NOT_AUTHORIZED_IN_PLMN:
- case EMM_CAUSE_EPS_NOT_ALLOWED_IN_PLMN:
- /*
- * Notify EMM that the UE has to perform a PLMN selection because
- * it is not allowed to operate in the currently selected PLMN
- */
- emm_sap.primitive = EMMREG_REGISTER_REQ;
- break;
-
- case EMM_CAUSE_TA_NOT_ALLOWED:
- case EMM_CAUSE_ROAMING_NOT_ALLOWED:
- case EMM_CAUSE_NO_SUITABLE_CELLS:
- /*
- * Notify EMM that the UE failed to register to the network for
- * EPS services because it is not allowed to operate in the
- * requested tracking area
- */
- emm_sap.primitive = EMMREG_REGISTER_REJ;
- break;
-
- case EMM_CAUSE_IMEI_NOT_ACCEPTED:
- if (_emm_data.is_emergency) {
- /*
- * Notify EMM that the UE failed to register to the network
- * for emergency bearer services because "IMEI not accepted"
- */
- emm_sap.primitive = EMMREG_NO_IMSI;
- break;
- }
-
- /* break is volontary missing */
-
- default :
- /* Other values are considered as abnormal cases
- * 3GPP TS 24.301, section 5.5.1.2.6, case d */
- _emm_attach_abnormal_cases_bcd(&emm_sap);
- break;
- }
-
- rc = emm_sap_send(&emm_sap);
-
- /*
- * Notify ESM that the network rejected connectivity to the PDN
- */
- if (esm_msg != NULL) {
- esm_sap_t esm_sap;
- esm_sap.primitive = ESM_PDN_CONNECTIVITY_REJ;
- esm_sap.is_standalone = FALSE;
- esm_sap.recv = esm_msg;
- rc = esm_sap_send(&esm_sap);
- }
-
- LOG_FUNC_RETURN(rc);
-}
-
-/****************************************************************************
- ** **
- ** Name: emm_proc_attach_complete() **
- ** **
- ** Description: Terminates the attach procedure when Attach Complete mes- **
- ** sage has been successfully delivered to the MME. **
- ** **
- ** 3GPP TS 24.301, section 5.5.1.2.4 **
- ** Upon successfully sending the ATTACH COMPLETE message, **
- ** the UE shall reset the attach attempt counter and tra- **
- ** cking area updating attempt counter, enter state EMM- **
- ** REGISTERED and set the EPS update status to EU1-UPDATED. **
- ** **
- ** Inputs: args: Not used **
- ** Others: None **
- ** **
- ** Outputs: None **
- ** Return: RETURNok, RETURNerror **
- ** Others: _emm_data, _emm_attach_data **
- ** **
- ***************************************************************************/
-int emm_proc_attach_complete(void *args)
-{
- LOG_FUNC_IN;
-
- emm_sap_t emm_sap;
- esm_sap_t esm_sap;
- int rc;
-
- LOG_TRACE(INFO, "EMM-PROC - EPS attach complete");
-
- /* Reset EMM procedure handler */
- (void) emm_proc_lowerlayer_initialize(NULL, NULL, NULL, NULL);
-
- /* Reset the attach attempt counter */
- _emm_attach_data.attempt_count = 0;
- /* TODO: Reset the tracking area updating attempt counter */
-
- /* Set the EPS update status to EU1 UPDATED */
- _emm_data.status = EU1_UPDATED;
- _emm_data.is_attached = TRUE;
-
- /*
- * Notify EMM that network attach complete message has been delivered
- * to the network
- */
- emm_sap.primitive = EMMREG_ATTACH_CNF;
- rc = emm_sap_send(&emm_sap);
-
- if (rc != RETURNerror) {
- /*
- * Notify ESM that the Activate Default EPS Bearer Context Accept
- * message has been delivered to the network within the Attach
- * Complete message
- */
- esm_sap.primitive = ESM_DEFAULT_EPS_BEARER_CONTEXT_ACTIVATE_CNF;
- esm_sap.is_standalone = FALSE;
- rc = esm_sap_send(&esm_sap);
- }
-
- LOG_FUNC_RETURN(rc);
-}
-
-/****************************************************************************
- ** **
- ** Name: emm_proc_attach_failure() **
- ** **
- ** Description: Performs the attach procedure abnormal case upon receipt **
- ** of transmission failure of Attach Request message or At- **
- ** tach Complete message. **
- ** **
- ** 3GPP TS 24.301, section 5.5.1.2.6, cases h and i **
- ** The UE shall restart the attach procedure when timer **
- ** T3411 expires. **
- ** **
- ** Inputs: is_initial: TRUE if the NAS message that failed to be **
- ** transfered is an initial NAS message (ESM **
- ** message embedded within an Attach Request **
- ** message) **
- ** args: Not used **
- ** Others: None **
- ** **
- ** Outputs: None **
- ** Return: RETURNok, RETURNerror **
- ** Others: T3410, T3411 **
- ** **
- ***************************************************************************/
-int emm_proc_attach_failure(int is_initial, void *args)
-{
- LOG_FUNC_IN;
-
- int rc = RETURNok;
- esm_sap_t esm_sap;
-
- LOG_TRACE(WARNING, "EMM-PROC - EPS attach failure");
-
- /* Reset EMM procedure handler */
- (void) emm_proc_lowerlayer_initialize(NULL, NULL, NULL, NULL);
-
- /* Stop timer T3410 if still running */
- if (T3410.id != NAS_TIMER_INACTIVE_ID) {
- LOG_TRACE(INFO, "EMM-PROC - Stop timer T3410 (%d)", T3410.id);
- T3410.id = nas_timer_stop(T3410.id);
- }
-
- if (is_initial) {
- /*
- * Notify ESM that the PDN CONNECTIVITY REQUEST message contained
- * in the ESM message container IE of the ATTACH REQUEST has failed
- * to be transmitted
- */
- esm_sap.primitive = ESM_PDN_CONNECTIVITY_REJ;
- esm_sap.is_standalone = FALSE;
- esm_sap.recv = NULL;
- } else {
- /*
- * Notify ESM that ACTIVATE DEFAULT EPS BEARER CONTEXT REQUEST message
- * contained in the ESM message container IE of the ATTACH COMPLETE
- * has failed to be transmitted
- */
- esm_sap.primitive = ESM_DEFAULT_EPS_BEARER_CONTEXT_ACTIVATE_REJ;
- esm_sap.is_standalone = FALSE;
- esm_sap.recv = NULL;
- }
-
- rc = esm_sap_send(&esm_sap);
-
- if (rc != RETURNerror) {
- /* Start T3411 timer */
- T3411.id = nas_timer_start(T3411.sec, _emm_attach_t3411_handler, NULL);
- LOG_TRACE(INFO, "EMM-PROC - Timer T3411 (%d) expires in %ld seconds",
- T3411.id, T3411.sec);
- }
-
- LOG_FUNC_RETURN(rc);
-}
-
-/****************************************************************************
- ** **
- ** Name: emm_proc_attach_release() **
- ** **
- ** Description: Performs the attach procedure abnormal case upon receipt **
- ** of NAS signalling connection release indication. **
- ** **
- ** 3GPP TS 24.301, section 5.5.1.2.6, case b **
- ** The attach procedure shall be aborted and the UE shall **
- ** execute abnormal case attach procedure. **
- ** **
- ** Inputs: args: Not used **
- ** Others: None **
- ** **
- ** Outputs: None **
- ** Return: RETURNok, RETURNerror **
- ** Others: None **
- ** **
- ***************************************************************************/
-int emm_proc_attach_release(void *args)
-{
- LOG_FUNC_IN;
-
- emm_sap_t emm_sap;
- int rc;
-
- LOG_TRACE(WARNING, "EMM-PROC - NAS signalling connection released");
-
- /* Execute abnormal case attach procedure */
- _emm_attach_abnormal_cases_bcd(&emm_sap);
-
- rc = emm_sap_send(&emm_sap);
-
- LOG_FUNC_RETURN(rc);
-}
-
-/****************************************************************************
- ** **
- ** Name: emm_proc_attach_restart() **
- ** **
- ** Description: Restarts the attach procedure **
- ** **
- ** Inputs: None **
- ** Others: None **
- ** **
- ** Outputs: None **
- ** Return: RETURNok, RETURNerror **
- ** Others: None **
- ** **
- ***************************************************************************/
-int emm_proc_attach_restart(void)
-{
- LOG_FUNC_IN;
-
- emm_sap_t emm_sap;
- int rc;
-
- LOG_TRACE(INFO, "EMM-PROC - Restart EPS attach procedure");
-
- /*
- * Notify EMM that the attach procedure has to be restarted
- */
- emm_sap.primitive = EMMREG_ATTACH_INIT;
- emm_sap.u.emm_reg.u.attach.is_emergency = _emm_data.is_emergency;
- rc = emm_sap_send(&emm_sap);
-
- LOG_FUNC_RETURN(rc);
-}
-
-/****************************************************************************
- ** **
- ** Name: emm_proc_attach_set_emergency() **
- ** **
- ** Description: Set the emergency bearer services indicator **
- ** **
- ** Inputs: None **
- ** Others: None **
- ** **
- ** Outputs: None **
- ** Return: RETURNok, RETURNerror **
- ** Others: _emm_data **
- ** **
- ***************************************************************************/
-int emm_proc_attach_set_emergency(void)
-{
- LOG_FUNC_IN;
-
- LOG_TRACE(WARNING, "EMM-PROC - UE is now attached to the network for "
- "emergency bearer services only");
-
- _emm_data.is_emergency = TRUE;
-
- LOG_FUNC_RETURN(RETURNok);
-}
-
-/****************************************************************************
- ** **
- ** Name: emm_proc_attach_set_detach() **
- ** **
- ** Description: Reset the network attachment indicator and enter state **
- ** EMM-DEREGISTERED
- ** **
- ** Inputs: None **
- ** Others: None **
- ** **
- ** Outputs: None **
- ** Return: RETURNok, RETURNerror **
- ** Others: _emm_data **
- ** **
- ***************************************************************************/
-int emm_proc_attach_set_detach(void)
-{
- LOG_FUNC_IN;
-
- int rc;
-
- LOG_TRACE(WARNING,
- "EMM-PROC - UE is now locally detached from the network");
-
- /* Reset the network attachment indicator */
- _emm_data.is_attached = FALSE;
- /*
- * Notify that the UE is locally detached from the network
- */
- emm_sap_t emm_sap;
- emm_sap.primitive = EMMREG_DETACH_CNF;
- rc = emm_sap_send(&emm_sap);
-
- LOG_FUNC_RETURN(rc);
-}
-
-#endif
/*
* --------------------------------------------------------------------------
* Attach procedure executed by the MME
* --------------------------------------------------------------------------
*/
-#ifdef NAS_MME
/****************************************************************************
** **
** Name: emm_proc_attach_request() **
@@ -1067,7 +181,7 @@ int emm_proc_attach_set_detach(void)
** the UE is registered to **
** eea: Supported EPS encryption algorithms **
** eia: Supported EPS integrity algorithms **
- ** esm_msg: PDN connectivity request ESM message **
+ ** esm_msg_pP: PDN connectivity request ESM message **
** Others: _emm_data **
** **
** Outputs: None **
@@ -1086,14 +200,14 @@ int emm_proc_attach_request(
tai_t *tai,
int eea, int eia, int ucs2, int uea, int uia, int gea,
int umts_present, int gprs_present,
- const OctetString *esm_msg)
+ const OctetString *esm_msg_pP)
{
LOG_FUNC_IN;
int rc;
emm_data_context_t ue_ctx;
- LOG_TRACE(INFO, "EMM-PROC - EPS attach type = %s (%d) requested (ueid=0x%08x)",
+ LOG_TRACE(INFO, "EMM-PROC - EPS attach type = %s (%d) requested (ueid="NAS_UE_ID_FMT")",
_emm_attach_type_str[type], type, ueid);
LOG_TRACE(INFO, "EMM-PROC - umts_present = %u umts_present = %u",
umts_present, gprs_present);
@@ -1168,7 +282,7 @@ int emm_proc_attach_request(
rc = emm_proc_attach_request(ueid, type, native_ksi, ksi,
native_guti, guti, imsi, imei,
tai, eea, eia, ucs2, uea, uia, gea,
- umts_present, gprs_present, esm_msg);
+ umts_present, gprs_present, esm_msg_pP);
}
LOG_FUNC_RETURN(rc);
@@ -1200,6 +314,15 @@ int emm_proc_attach_request(
(*emm_ctx)->emm_cause = EMM_CAUSE_SUCCESS;
(*emm_ctx)->_emm_fsm_status = EMM_INVALID;
(*emm_ctx)->ueid = ueid;
+ /*
+ * Initialize EMM timers
+ */
+ (*emm_ctx)->T3450.id = NAS_TIMER_INACTIVE_ID;
+ (*emm_ctx)->T3450.sec = T3450_DEFAULT_VALUE;
+ (*emm_ctx)->T3460.id = NAS_TIMER_INACTIVE_ID;
+ (*emm_ctx)->T3460.sec = T3460_DEFAULT_VALUE;
+ (*emm_ctx)->T3470.id = NAS_TIMER_INACTIVE_ID;
+ (*emm_ctx)->T3470.sec = T3470_DEFAULT_VALUE;
emm_fsm_set_status(ueid, *emm_ctx, EMM_DEREGISTERED);
#if defined(NAS_BUILT_IN_EPC)
@@ -1210,7 +333,7 @@ int emm_proc_attach_request(
if (tai) {
LOG_TRACE(WARNING,
- "EMM-PROC - Set tac %u in context %u ",
+ "EMM-PROC - Set tac %u in context",
tai->tac);
(*emm_ctx)->tac = tai->tac;
} else {
@@ -1221,7 +344,7 @@ int emm_proc_attach_request(
/* Update the EMM context with the current attach procedure parameters */
rc = _emm_attach_update(*emm_ctx, ueid, type, ksi, guti, imsi, imei,
- eea, eia, ucs2, uea, uia, gea, umts_present, gprs_present, esm_msg);
+ eea, eia, ucs2, uea, uia, gea, umts_present, gprs_present, esm_msg_pP);
if (rc != RETURNok) {
LOG_TRACE(WARNING, "EMM-PROC - Failed to update EMM context");
@@ -1301,7 +424,7 @@ int emm_proc_attach_reject(unsigned int ueid, int emm_cause)
** the GUTI sent in the ATTACH ACCEPT message as valid. **
** **
** Inputs: ueid: UE lower layer identifier **
- ** esm_msg: Activate default EPS bearer context accept **
+ ** esm_msg_pP: Activate default EPS bearer context accept **
** ESM message **
** Others: _emm_data **
** **
@@ -1310,7 +433,7 @@ int emm_proc_attach_reject(unsigned int ueid, int emm_cause)
** Others: _emm_data, T3450 **
** **
***************************************************************************/
-int emm_proc_attach_complete(unsigned int ueid, const OctetString *esm_msg)
+int emm_proc_attach_complete(unsigned int ueid, const OctetString *esm_msg_pP)
{
emm_data_context_t *emm_ctx = NULL;
int rc = RETURNerror;
@@ -1319,11 +442,7 @@ int emm_proc_attach_complete(unsigned int ueid, const OctetString *esm_msg)
LOG_FUNC_IN;
- LOG_TRACE(INFO, "EMM-PROC - EPS attach complete (ueid=%u)", ueid);
-
- /* Stop timer T3450 */
- LOG_TRACE(INFO, "EMM-PROC - Stop timer T3450 (%d)", T3450.id);
- T3450.id = nas_timer_stop(T3450.id);
+ LOG_TRACE(INFO, "EMM-PROC - EPS attach complete (ueid="NAS_UE_ID_FMT")", ueid);
/* Release retransmission timer parameters */
attach_data_t *data = (attach_data_t *)(emm_proc_common_get_args(ueid));
@@ -1332,28 +451,27 @@ int emm_proc_attach_complete(unsigned int ueid, const OctetString *esm_msg)
if (data->esm_msg.length > 0) {
free(data->esm_msg.value);
}
-
free(data);
}
/* Get the UE context */
-
#if defined(NAS_BUILT_IN_EPC)
-
if (ueid > 0) {
emm_ctx = emm_data_context_get(&_emm_data, ueid);
}
-
#else
-
if (ueid < EMM_DATA_NB_UE_MAX) {
emm_ctx = _emm_data.ctx[ueid];
}
-
#endif
if (emm_ctx) {
- /* Delete the old GUTI and consider the GUTI sent in the Attach
+ /* Stop timer T3450 */
+ LOG_TRACE(INFO, "EMM-PROC - Stop timer T3450 (%d)", emm_ctx->T3450.id);
+ emm_ctx->T3450.id = nas_timer_stop(emm_ctx->T3450.id);
+ MSC_LOG_EVENT(MSC_NAS_EMM_MME, "0 T3450 stopped UE "NAS_UE_ID_FMT" ", ueid);
+
+ /* Delete the old GUTI and consider the GUTI sent in the Attach
* Accept message as valid */
emm_ctx->guti_is_new = FALSE;
emm_ctx->old_guti = NULL;
@@ -1364,7 +482,7 @@ int emm_proc_attach_complete(unsigned int ueid, const OctetString *esm_msg)
esm_sap.primitive = ESM_DEFAULT_EPS_BEARER_CONTEXT_ACTIVATE_CNF;
esm_sap.is_standalone = FALSE;
esm_sap.ueid = ueid;
- esm_sap.recv = esm_msg;
+ esm_sap.recv = esm_msg_pP;
esm_sap.ctx = emm_ctx;
rc = esm_sap_send(&esm_sap);
} else {
@@ -1400,236 +518,13 @@ int emm_proc_attach_complete(unsigned int ueid, const OctetString *esm_msg)
LOG_FUNC_RETURN(rc);
}
-#endif // NAS_MME
/****************************************************************************/
/********************* L O C A L F U N C T I O N S *********************/
/****************************************************************************/
-#ifdef NAS_UE
-/*
- * --------------------------------------------------------------------------
- * Timer handlers
- * --------------------------------------------------------------------------
- */
-/****************************************************************************
- ** **
- ** Name: _emm_attach_t3410_handler() **
- ** **
- ** Description: T3410 timeout handler **
- ** **
- ** 3GPP TS 24.301, section 5.5.1.2.6, case c **
- ** Upon T3410 timer expiration, the attach procedure shall **
- ** be aborted and the UE shall execute abnormal case attach **
- ** procedure. **
- ** The NAS signalling connection shall be released locally. **
- ** **
- ** Inputs: args: handler parameters **
- ** Others: None **
- ** **
- ** Outputs: None **
- ** Return: None **
- ** Others: T3410 **
- ** **
- ***************************************************************************/
-void *_emm_attach_t3410_handler(void *args)
-{
- LOG_FUNC_IN;
- emm_sap_t emm_sap;
- int rc;
-
- LOG_TRACE(WARNING, "EMM-PROC - T3410 timer expired");
-
- /* Stop T3410 timer */
- T3410.id = nas_timer_stop(T3410.id);
- /* Execute abnormal case attach procedure */
- _emm_attach_abnormal_cases_bcd(&emm_sap);
-
- rc = emm_sap_send(&emm_sap);
-
- if (rc != RETURNerror) {
- /* Locally release the NAS signalling connection */
- _emm_data.ecm_status = ECM_IDLE;
- }
-
- LOG_FUNC_RETURN(NULL);
-}
-
-/****************************************************************************
- ** **
- ** Name: _emm_attach_t3411_handler() **
- ** **
- ** Description: T3411 timeout handler **
- ** **
- ** 3GPP TS 24.301, section 5.5.1.2.6 **
- ** Upon T3411 timer expiration, the attach procedure shall **
- ** be restarted, if still required by ESM sublayer. **
- ** **
- ** Inputs: args: handler parameters **
- ** Others: None **
- ** **
- ** Outputs: None **
- ** Return: None **
- ** Others: T3411 **
- ** **
- ***************************************************************************/
-static void *_emm_attach_t3411_handler(void *args)
-{
- LOG_FUNC_IN;
-
- emm_sap_t emm_sap;
-
- LOG_TRACE(WARNING, "EMM-PROC - T3411 timer expired");
-
- /* Stop T3411 timer */
- T3411.id = nas_timer_stop(T3411.id);
- /*
- * Notify EMM that timer T3411 expired and attach procedure has to be
- * restarted
- */
- emm_sap.primitive = EMMREG_ATTACH_INIT;
- emm_sap.u.emm_reg.u.attach.is_emergency = _emm_data.is_emergency;
-
- (void) emm_sap_send(&emm_sap);
-
- LOG_FUNC_RETURN(NULL);
-}
-
-/****************************************************************************
- ** **
- ** Name: _emm_attach_t3402_handler() **
- ** **
- ** Description: T3402 timeout handler **
- ** **
- ** Upon T3402 timer expiration: **
- ** 3GPP TS 24.301, section 5.5.1.1 **
- ** the attach attempt counter shall be reset when the UE is **
- ** in substate DEREGISTERED.ATTEMPTING-TO-ATTACH; **
- ** 3GPP TS 24.301, section 5.2.2.3.3 **
- ** the UE shall initiate an attach or combined attach proce- **
- ** dure in substate DEREGISTERED.ATTEMPTING-TO-ATTACH; **
- ** **
- ** Inputs: args: handler parameters **
- ** Others: None **
- ** **
- ** Outputs: None **
- ** Return: None **
- ** Others: _emm_attach_data, T3402 **
- ** **
- ***************************************************************************/
-static void *_emm_attach_t3402_handler(void *args)
-{
- LOG_FUNC_IN;
-
- emm_sap_t emm_sap;
-
- LOG_TRACE(WARNING, "EMM-PROC - T3402 timer expired");
-
- /* Stop T3402 timer */
- T3402.id = nas_timer_stop(T3402.id);
- /* Reset the attach attempt counter */
- _emm_attach_data.attempt_count = 0;
- /*
- * Notify EMM that timer T3402 expired and attach procedure has to be
- * restarted
- */
- emm_sap.primitive = EMMREG_ATTACH_INIT;
- emm_sap.u.emm_reg.u.attach.is_emergency = _emm_data.is_emergency;
-
- (void) emm_sap_send(&emm_sap);
-
- LOG_FUNC_RETURN(NULL);
-}
-
-/*
- * --------------------------------------------------------------------------
- * Abnormal cases in the UE
- * --------------------------------------------------------------------------
- */
-
-/****************************************************************************
- ** **
- ** Name: _emm_attach_abnormal_cases_bcd() **
- ** **
- ** Description: Performs the abnormal case attach procedure. **
- ** **
- ** 3GPP TS 24.301, section 5.5.1.2.6, cases b, c and d **
- ** The Timer T3410 shall be stopped if still running, the **
- ** attach attempt counter shall be incremented and the UE **
- ** shall proceed depending on whether the attach attempt **
- ** counter reached its maximum value or not. **
- ** **
- ** Inputs: None **
- ** Others: None **
- ** **
- ** Outputs: emm_sap: EMM service access point **
- ** Return: None **
- ** Others: _emm_data, _emm_attach_data, T3402, T3410, **
- ** T3411 **
- ** **
- ***************************************************************************/
-static void _emm_attach_abnormal_cases_bcd(emm_sap_t *emm_sap)
-{
- LOG_FUNC_IN;
-
- LOG_TRACE(WARNING, "EMM-PROC - Abnormal case, attach counter = %d",
- _emm_attach_data.attempt_count);
-
- /* Stop timer T3410 */
- if (T3410.id != NAS_TIMER_INACTIVE_ID) {
- LOG_TRACE(INFO, "EMM-PROC - Stop timer T3410 (%d)", T3410.id);
- T3410.id = nas_timer_stop(T3410.id);
- }
-
- if (_emm_attach_data.attempt_count < EMM_ATTACH_COUNTER_MAX) {
- /* Increment the attach attempt counter */
- _emm_attach_data.attempt_count += 1;
- /* Start T3411 timer */
- T3411.id = nas_timer_start(T3411.sec, _emm_attach_t3411_handler, NULL);
- LOG_TRACE(INFO, "EMM-PROC - Timer T3411 (%d) expires in %ld seconds",
- T3411.id, T3411.sec);
- /*
- * Notify EMM that the attempt to attach for EPS services failed and
- * the attach attempt counter didn't reach its maximum value; network
- * attach procedure shall be restarted when timer T3411 expires.
- */
- emm_sap->primitive = EMMREG_ATTACH_FAILED;
- } else {
- /* Delete the GUTI */
- _emm_data.guti = NULL;
- /* Delete the TAI list */
- _emm_data.ltai.n_tais = 0;
- /* Delete the last visited registered TAI */
- _emm_data.tai = NULL;
- /* Delete the list of equivalent PLMNs */
- _emm_data.nvdata.eplmn.n_plmns = 0;
-
- /* Delete the eKSI */
- if (_emm_data.security) {
- _emm_data.security->type = EMM_KSI_NOT_AVAILABLE;
- }
-
- /* Set the EPS update status to EU2 NOT UPDATED */
- _emm_data.status = EU2_NOT_UPDATED;
-
- /* Start T3402 timer */
- T3402.id = nas_timer_start(T3402.sec, _emm_attach_t3402_handler, NULL);
- LOG_TRACE(INFO, "EMM-PROC - Timer T3402 (%d) expires in %ld seconds",
- T3402.id, T3402.sec);
- /*
- * Notify EMM that the attempt to attach for EPS services failed and
- * the attach attempt counter reached its maximum value.
- */
- emm_sap->primitive = EMMREG_ATTACH_EXCEEDED;
- }
-
- LOG_FUNC_OUT;
-}
-#endif // NAS_UE
-
-#ifdef NAS_MME
/*
* --------------------------------------------------------------------------
* Timer handlers
@@ -1721,7 +616,7 @@ static int _emm_attach_release(void *args)
emm_data_context_t *emm_ctx = (emm_data_context_t *)(args);
if (emm_ctx) {
- LOG_TRACE(WARNING, "EMM-PROC - Release UE context data (ueid=%u)",
+ LOG_TRACE(WARNING, "EMM-PROC - Release UE context data (ueid="NAS_UE_ID_FMT")",
emm_ctx->ueid);
unsigned int ueid = emm_ctx->ueid;
@@ -1772,6 +667,25 @@ static int _emm_attach_release(void *args)
emm_ctx->security = NULL;
}
+ /* Stop timer T3450 */
+ if (emm_ctx->T3450.id != NAS_TIMER_INACTIVE_ID) {
+ LOG_TRACE(INFO, "EMM-PROC - Stop timer T3450 (%d)", emm_ctx->T3450.id);
+ emm_ctx->T3450.id = nas_timer_stop(emm_ctx->T3450.id);
+ MSC_LOG_EVENT(MSC_NAS_EMM_MME, "0 T3450 stopped UE "NAS_UE_ID_FMT" ", emm_ctx->ueid);
+ }
+ /* Stop timer T3460 */
+ if (emm_ctx->T3460.id != NAS_TIMER_INACTIVE_ID) {
+ LOG_TRACE(INFO, "EMM-PROC - Stop timer T3460 (%d)", emm_ctx->T3460.id);
+ emm_ctx->T3460.id = nas_timer_stop(emm_ctx->T3460.id);
+ MSC_LOG_EVENT(MSC_NAS_EMM_MME, "0 T3460 stopped UE "NAS_UE_ID_FMT" ", emm_ctx->ueid);
+ }
+ /* Stop timer T3470 */
+ if (emm_ctx->T3470.id != NAS_TIMER_INACTIVE_ID) {
+ LOG_TRACE(INFO, "EMM-PROC - Stop timer T3470 (%d)", emm_ctx->T3460.id);
+ emm_ctx->T3470.id = nas_timer_stop(emm_ctx->T3470.id);
+ MSC_LOG_EVENT(MSC_NAS_EMM_MME, "0 T3470 stopped UE "NAS_UE_ID_FMT" ", emm_ctx->ueid);
+ }
+
/* Release the EMM context */
#if defined(NAS_BUILT_IN_EPC)
emm_data_context_remove(&_emm_data, emm_ctx);
@@ -1822,7 +736,7 @@ static int _emm_attach_reject(void *args)
if (emm_ctx) {
emm_sap_t emm_sap;
LOG_TRACE(WARNING, "EMM-PROC - EMM attach procedure not accepted "
- "by the network (ueid=%08x, cause=%d)",
+ "by the network (ueid="NAS_UE_ID_FMT", cause=%d)",
emm_ctx->ueid, emm_ctx->emm_cause);
/*
* Notify EMM-AS SAP that Attach Reject message has to be sent
@@ -1892,13 +806,20 @@ static int _emm_attach_abort(void *args)
unsigned int ueid = data->ueid;
esm_sap_t esm_sap;
- LOG_TRACE(WARNING, "EMM-PROC - Abort the attach procedure (ueid=%u)",
+ LOG_TRACE(WARNING, "EMM-PROC - Abort the attach procedure (ueid="NAS_UE_ID_FMT")",
ueid);
-
- /* Stop timer T3450 */
- if (T3450.id != NAS_TIMER_INACTIVE_ID) {
- LOG_TRACE(INFO, "EMM-PROC - Stop timer T3450 (%d)", T3450.id);
- T3450.id = nas_timer_stop(T3450.id);
+#if defined(NAS_BUILT_IN_EPC)
+ ctx = emm_data_context_get(&_emm_data, ueid);
+#else
+ ctx = _emm_data.ctx[ueid];
+#endif
+ if (ctx) {
+ /* Stop timer T3450 */
+ if (ctx->T3450.id != NAS_TIMER_INACTIVE_ID) {
+ LOG_TRACE(INFO, "EMM-PROC - Stop timer T3450 (%d)", ctx->T3450.id);
+ ctx->T3450.id = nas_timer_stop(ctx->T3450.id);
+ MSC_LOG_EVENT(MSC_NAS_EMM_MME, "0 T3450 stopped UE "NAS_UE_ID_FMT" ", data->ueid);
+ }
}
/* Release retransmission timer parameters */
@@ -1908,11 +829,7 @@ static int _emm_attach_abort(void *args)
free(data);
-#if defined(NAS_BUILT_IN_EPC)
- ctx = emm_data_context_get(&_emm_data, ueid);
-#else
- ctx = _emm_data.ctx[ueid];
-#endif
+
/*
* Notify ESM that the network locally refused PDN connectivity
@@ -1974,7 +891,7 @@ static int _emm_attach_identify(void *args)
LOG_FUNC_IN;
- LOG_TRACE(INFO, "EMM-PROC - Identify incoming UE (ueid=0x%08x) using %s",
+ LOG_TRACE(INFO, "EMM-PROC - Identify incoming UE (ueid="NAS_UE_ID_FMT") using %s",
emm_ctx->ueid, (emm_ctx->imsi)? "IMSI" : (emm_ctx->guti)? "GUTI" :
(emm_ctx->imei)? "IMEI" : "none");
@@ -2164,7 +1081,7 @@ static int _emm_attach_security(void *args)
int rc;
emm_data_context_t *emm_ctx = (emm_data_context_t *)(args);
- LOG_TRACE(INFO, "EMM-PROC - Setup NAS security (ueid=%u)", emm_ctx->ueid);
+ LOG_TRACE(INFO, "EMM-PROC - Setup NAS security (ueid="NAS_UE_ID_FMT")", emm_ctx->ueid);
/* Create new NAS security context */
if (emm_ctx->security == NULL) {
@@ -2240,7 +1157,7 @@ static int _emm_attach(void *args)
emm_data_context_t *emm_ctx = (emm_data_context_t *)(args);
- LOG_TRACE(INFO, "EMM-PROC - Attach UE (ueid=%u)", emm_ctx->ueid);
+ LOG_TRACE(INFO, "EMM-PROC - Attach UE (ueid="NAS_UE_ID_FMT")", emm_ctx->ueid);
/* 3GPP TS 24.401, Figure 5.3.2.1-1, point 5a
* At this point, all NAS messages shall be protected by the NAS security
@@ -2384,71 +1301,77 @@ static int _emm_attach_accept(emm_data_context_t *emm_ctx, attach_data_t *data)
emm_sap_t emm_sap;
int rc;
- /*
- * Notify EMM-AS SAP that Attach Accept message together with an Activate
- * Default EPS Bearer Context Request message has to be sent to the UE
- */
+ // may be caused by timer not stopped when deleted context
+ if (emm_ctx) {
+ /*
+ * Notify EMM-AS SAP that Attach Accept message together with an Activate
+ * Default EPS Bearer Context Request message has to be sent to the UE
+ */
- emm_sap.primitive = EMMAS_ESTABLISH_CNF;
- emm_sap.u.emm_as.u.establish.ueid = emm_ctx->ueid;
+ emm_sap.primitive = EMMAS_ESTABLISH_CNF;
+ emm_sap.u.emm_as.u.establish.ueid = emm_ctx->ueid;
- if (emm_ctx->guti_is_new && emm_ctx->old_guti) {
- /* Implicit GUTI reallocation;
- * include the new assigned GUTI in the Attach Accept message */
- LOG_TRACE(INFO,"EMM-PROC - Implicit GUTI reallocation, include the new assigned GUTI in the Attach Accept message");
- emm_sap.u.emm_as.u.establish.UEid.guti = emm_ctx->old_guti;
- emm_sap.u.emm_as.u.establish.new_guti = emm_ctx->guti;
- } else if (emm_ctx->guti_is_new && emm_ctx->guti) {
- /* include the new assigned GUTI in the Attach Accept message */
- LOG_TRACE(INFO,"EMM-PROC - Include the new assigned GUTI in the Attach Accept message");
- emm_sap.u.emm_as.u.establish.UEid.guti = emm_ctx->guti;
- emm_sap.u.emm_as.u.establish.new_guti = emm_ctx->guti;
- } else {
- emm_sap.u.emm_as.u.establish.UEid.guti = emm_ctx->guti;
+ if (emm_ctx->guti_is_new && emm_ctx->old_guti) {
+ /* Implicit GUTI reallocation;
+ * include the new assigned GUTI in the Attach Accept message */
+ LOG_TRACE(INFO,"EMM-PROC - Implicit GUTI reallocation, include the new assigned GUTI in the Attach Accept message");
+ emm_sap.u.emm_as.u.establish.UEid.guti = emm_ctx->old_guti;
+ emm_sap.u.emm_as.u.establish.new_guti = emm_ctx->guti;
+ } else if (emm_ctx->guti_is_new && emm_ctx->guti) {
+ /* include the new assigned GUTI in the Attach Accept message */
+ LOG_TRACE(INFO,"EMM-PROC - Include the new assigned GUTI in the Attach Accept message");
+ emm_sap.u.emm_as.u.establish.UEid.guti = emm_ctx->guti;
+ emm_sap.u.emm_as.u.establish.new_guti = emm_ctx->guti;
+ } else {
+ emm_sap.u.emm_as.u.establish.UEid.guti = emm_ctx->guti;
#warning "TEST LG FORCE GUTI IE IN ATTACH ACCEPT"
- emm_sap.u.emm_as.u.establish.new_guti = emm_ctx->guti;
- //emm_sap.u.emm_as.u.establish.new_guti = NULL;
- }
+ emm_sap.u.emm_as.u.establish.new_guti = emm_ctx->guti;
+ //emm_sap.u.emm_as.u.establish.new_guti = NULL;
+ }
- emm_sap.u.emm_as.u.establish.n_tacs = emm_ctx->n_tacs;
- emm_sap.u.emm_as.u.establish.tac = emm_ctx->tac;
- emm_sap.u.emm_as.u.establish.NASinfo = EMM_AS_NAS_INFO_ATTACH;
- /* Setup EPS NAS security data */
- emm_as_set_security_data(&emm_sap.u.emm_as.u.establish.sctx,
+ emm_sap.u.emm_as.u.establish.n_tacs = emm_ctx->n_tacs;
+ emm_sap.u.emm_as.u.establish.tac = emm_ctx->tac;
+ emm_sap.u.emm_as.u.establish.NASinfo = EMM_AS_NAS_INFO_ATTACH;
+ /* Setup EPS NAS security data */
+ emm_as_set_security_data(&emm_sap.u.emm_as.u.establish.sctx,
emm_ctx->security, FALSE, TRUE);
- LOG_TRACE(INFO,"EMM-PROC - encryption = 0x%X ", emm_sap.u.emm_as.u.establish.encryption);
- LOG_TRACE(INFO,"EMM-PROC - integrity = 0x%X ", emm_sap.u.emm_as.u.establish.integrity);
- emm_sap.u.emm_as.u.establish.encryption = emm_ctx->security->selected_algorithms.encryption;
- emm_sap.u.emm_as.u.establish.integrity = emm_ctx->security->selected_algorithms.integrity;
- LOG_TRACE(INFO,"EMM-PROC - encryption = 0x%X (0x%X)",
+ LOG_TRACE(INFO,"EMM-PROC - encryption = 0x%X ", emm_sap.u.emm_as.u.establish.encryption);
+ LOG_TRACE(INFO,"EMM-PROC - integrity = 0x%X ", emm_sap.u.emm_as.u.establish.integrity);
+ emm_sap.u.emm_as.u.establish.encryption = emm_ctx->security->selected_algorithms.encryption;
+ emm_sap.u.emm_as.u.establish.integrity = emm_ctx->security->selected_algorithms.integrity;
+ LOG_TRACE(INFO,"EMM-PROC - encryption = 0x%X (0x%X)",
emm_sap.u.emm_as.u.establish.encryption,
emm_ctx->security->selected_algorithms.encryption);
- LOG_TRACE(INFO,"EMM-PROC - integrity = 0x%X (0x%X)",
+ LOG_TRACE(INFO,"EMM-PROC - integrity = 0x%X (0x%X)",
emm_sap.u.emm_as.u.establish.integrity,
emm_ctx->security->selected_algorithms.integrity);
/* Get the activate default EPS bearer context request message to
* transfer within the ESM container of the attach accept message */
- emm_sap.u.emm_as.u.establish.NASmsg = data->esm_msg;
- LOG_TRACE(INFO,"EMM-PROC - NASmsg src size = %d NASmsg dst size = %d ",
+ emm_sap.u.emm_as.u.establish.NASmsg = data->esm_msg;
+ LOG_TRACE(INFO,"EMM-PROC - NASmsg src size = %d NASmsg dst size = %d ",
data->esm_msg.length, emm_sap.u.emm_as.u.establish.NASmsg.length);
- rc = emm_sap_send(&emm_sap);
+ rc = emm_sap_send(&emm_sap);
- if (rc != RETURNerror) {
- if (T3450.id != NAS_TIMER_INACTIVE_ID) {
- /* Re-start T3450 timer */
- T3450.id = nas_timer_restart(T3450.id);
- } else {
- /* Start T3450 timer */
- T3450.id = nas_timer_start(T3450.sec, _emm_attach_t3450_handler, data);
+ if (rc != RETURNerror) {
+ if (emm_ctx->T3450.id != NAS_TIMER_INACTIVE_ID) {
+ /* Re-start T3450 timer */
+ emm_ctx->T3450.id = nas_timer_restart(emm_ctx->T3450.id);
+ MSC_LOG_EVENT(MSC_NAS_EMM_MME, "0 T3450 restarted UE "NAS_UE_ID_FMT"", data->ueid);
+ } else {
+ /* Start T3450 timer */
+ emm_ctx->T3450.id = nas_timer_start(emm_ctx->T3450.sec, _emm_attach_t3450_handler, data);
+ MSC_LOG_EVENT(MSC_NAS_EMM_MME, "0 T3450 started UE "NAS_UE_ID_FMT" ", data->ueid);
+ }
+
+ LOG_TRACE(INFO,"EMM-PROC - Timer T3450 (%d) expires in %ld seconds",
+ emm_ctx->T3450.id, emm_ctx->T3450.sec);
}
-
- LOG_TRACE(INFO,"EMM-PROC - Timer T3450 (%d) expires in %ld seconds",
- T3450.id, T3450.sec);
+ } else {
+ LOG_TRACE(WARNING,"EMM-PROC - emm_ctx NULL");
}
-
LOG_FUNC_RETURN (rc);
}
@@ -2601,7 +1524,7 @@ static int _emm_attach_have_changed(const emm_data_context_t *ctx,
** imei: The IMEI provided by the UE **
** eea: Supported EPS encryption algorithms **
** eia: Supported EPS integrity algorithms **
- ** esm_msg: ESM message contained with the attach re- **
+ ** esm_msg_pP: ESM message contained with the attach re- **
** quest **
** Others: None **
** **
@@ -2615,7 +1538,7 @@ static int _emm_attach_update(emm_data_context_t *ctx, unsigned int ueid,
GUTI_t *guti, imsi_t *imsi, imei_t *imei,
int eea, int eia, int ucs2, int uea, int uia, int gea,
int umts_present, int gprs_present,
- const OctetString *esm_msg)
+ const OctetString *esm_msg_pP)
{
int mnc_length;
LOG_FUNC_IN;
@@ -2743,24 +1666,27 @@ static int _emm_attach_update(emm_data_context_t *ctx, unsigned int ueid,
}
/* The ESM message contained within the attach request */
- if (esm_msg->length > 0) {
- if (ctx->esm_msg.length == 0) {
- ctx->esm_msg.value = (uint8_t *)malloc(esm_msg->length);
+ if (esm_msg_pP->length > 0) {
+ if (ctx->esm_msg.value != NULL) {
+ free(ctx->esm_msg.value);
+ ctx->esm_msg.value = NULL;
+ ctx->esm_msg.length = 0;
}
+ ctx->esm_msg.value = (uint8_t *)malloc(esm_msg_pP->length);
+
if (ctx->esm_msg.value != NULL) {
- strncpy((char *)ctx->esm_msg.value,
- (char *)esm_msg->value, esm_msg->length);
+ memcpy((char *)ctx->esm_msg.value,
+ (char *)esm_msg_pP->value, esm_msg_pP->length);
+
} else {
LOG_FUNC_RETURN (RETURNerror);
}
}
- ctx->esm_msg.length = esm_msg->length;
+ ctx->esm_msg.length = esm_msg_pP->length;
/* Attachment indicator */
ctx->is_attached = FALSE;
LOG_FUNC_RETURN (RETURNok);
}
-
-#endif // NAS_MME
diff --git a/openair-cn/NAS/MME/EMM/Authentication.c b/openair-cn/NAS/MME/EMM/Authentication.c
new file mode 100644
index 0000000000..19eb5c13a8
--- /dev/null
+++ b/openair-cn/NAS/MME/EMM/Authentication.c
@@ -0,0 +1,660 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+Source Authentication.c
+
+Version 0.1
+
+Date 2013/03/04
+
+Product NAS stack
+
+Subsystem EPS Mobility Management
+
+Author Frederic Maurel
+
+Description Defines the authentication EMM procedure executed by the
+ Non-Access Stratum.
+
+ The purpose of the EPS authentication and key agreement (AKA)
+ procedure is to provide mutual authentication between the user
+ and the network and to agree on a key KASME. The procedure is
+ always initiated and controlled by the network. However, the
+ UE can reject the EPS authentication challenge sent by the
+ network.
+
+ A partial native EPS security context is established in the
+ UE and the network when an EPS authentication is successfully
+ performed. The computed key material KASME is used as the
+ root for the EPS integrity protection and ciphering key
+ hierarchy.
+
+*****************************************************************************/
+
+#include // malloc, free
+#include // memcpy, memcmp, memset
+#include // htons
+
+#include "emm_proc.h"
+#include "nas_log.h"
+#include "nas_timer.h"
+#include "emmData.h"
+#include "emm_sap.h"
+#include "emm_cause.h"
+
+# if defined(NAS_BUILT_IN_EPC)
+# include "nas_itti_messaging.h"
+# endif
+#include "msc.h"
+
+/****************************************************************************/
+/**************** E X T E R N A L D E F I N I T I O N S ****************/
+/****************************************************************************/
+
+/****************************************************************************/
+/******************* L O C A L D E F I N I T I O N S *******************/
+/****************************************************************************/
+
+/*
+ * --------------------------------------------------------------------------
+ * Internal data handled by the authentication procedure in the UE
+ * --------------------------------------------------------------------------
+ */
+
+/*
+ * --------------------------------------------------------------------------
+ * Internal data handled by the authentication procedure in the MME
+ * --------------------------------------------------------------------------
+ */
+/*
+ * Timer handlers
+ */
+static void *_authentication_t3460_handler(void *);
+
+/*
+ * Function executed whenever the ongoing EMM procedure that initiated
+ * the authentication procedure is aborted or the maximum value of the
+ * retransmission timer counter is exceed
+ */
+static int _authentication_abort(void *);
+
+/*
+ * Internal data used for authentication procedure
+ */
+typedef struct {
+ unsigned int ueid; /* UE identifier */
+#define AUTHENTICATION_COUNTER_MAX 5
+ unsigned int retransmission_count; /* Retransmission counter */
+ int ksi; /* NAS key set identifier */
+ OctetString rand; /* Random challenge number */
+ OctetString autn; /* Authentication token */
+ int notify_failure; /* Indicates whether the authentication
+ * procedure failure shall be notified
+ * to the ongoing EMM procedure */
+} authentication_data_t;
+
+static int _authentication_request(authentication_data_t *data);
+static int _authentication_reject(unsigned int ueid);
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+
+/*
+ * --------------------------------------------------------------------------
+ * Authentication procedure executed by the MME
+ * --------------------------------------------------------------------------
+ */
+/****************************************************************************
+ ** **
+ ** Name: emm_proc_authentication() **
+ ** **
+ ** Description: Initiates authentication procedure to establish partial **
+ ** native EPS security context in the UE and the MME. **
+ ** **
+ ** 3GPP TS 24.301, section 5.4.2.2 **
+ ** The network initiates the authentication procedure by **
+ ** sending an AUTHENTICATION REQUEST message to the UE and **
+ ** starting the timer T3460. The AUTHENTICATION REQUEST mes- **
+ ** sage contains the parameters necessary to calculate the **
+ ** authentication response. **
+ ** **
+ ** Inputs: ueid: UE lower layer identifier **
+ ** ksi: NAS key set identifier **
+ ** rand: Random challenge number **
+ ** autn: Authentication token **
+ ** success: Callback function executed when the authen-**
+ ** tication procedure successfully completes **
+ ** reject: Callback function executed when the authen-**
+ ** tication procedure fails or is rejected **
+ ** failure: Callback function executed whener a lower **
+ ** layer failure occured before the authenti- **
+ ** cation procedure comnpletes **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int emm_proc_authentication(void *ctx, unsigned int ueid, int ksi,
+ const OctetString *_rand, const OctetString *autn,
+ emm_common_success_callback_t success,
+ emm_common_reject_callback_t reject,
+ emm_common_failure_callback_t failure)
+
+{
+ int rc = RETURNerror;
+ authentication_data_t *data;
+
+ LOG_FUNC_IN;
+
+ LOG_TRACE(INFO, "EMM-PROC - Initiate authentication KSI = %d, ctx = %p", ksi, ctx);
+
+ /* Allocate parameters of the retransmission timer callback */
+ data = (authentication_data_t *)malloc(sizeof(authentication_data_t));
+
+ if (data != NULL) {
+ /* Setup ongoing EMM procedure callback functions */
+ rc = emm_proc_common_initialize(ueid, success, reject, failure,
+ _authentication_abort, data);
+
+ if (rc != RETURNok) {
+ LOG_TRACE(WARNING, "Failed to initialize EMM callback functions");
+ LOG_FUNC_RETURN (RETURNerror);
+ }
+
+ /* Set the UE identifier */
+ data->ueid = ueid;
+ /* Reset the retransmission counter */
+ data->retransmission_count = 0;
+ /* Set the key set identifier */
+ data->ksi = ksi;
+
+ /* Set the authentication random challenge number */
+ if (_rand->length > 0) {
+ data->rand.value = (uint8_t *)malloc(_rand->length);
+ data->rand.length = 0;
+
+ if (data->rand.value) {
+ memcpy(data->rand.value, _rand->value, _rand->length);
+ data->rand.length = _rand->length;
+ }
+ }
+
+ /* Set the authentication token */
+ if (autn->length > 0) {
+ data->autn.value = (uint8_t *)malloc(autn->length);
+ data->autn.length = 0;
+
+ if (data->autn.value) {
+ memcpy(data->autn.value, autn->value, autn->length);
+ data->autn.length = autn->length;
+ }
+ }
+
+ /* Set the failure notification indicator */
+ data->notify_failure = FALSE;
+ /* Send authentication request message to the UE */
+ rc = _authentication_request(data);
+
+ if (rc != RETURNerror) {
+ /*
+ * Notify EMM that common procedure has been initiated
+ */
+
+
+ MSC_LOG_TX_MESSAGE(
+ MSC_NAS_EMM_MME,
+ MSC_NAS_EMM_MME,
+ NULL,0,
+ "0 EMMREG_COMMON_PROC_REQ ue id "NAS_UE_ID_FMT" (authentication)", ueid);
+
+ emm_sap_t emm_sap;
+ emm_sap.primitive = EMMREG_COMMON_PROC_REQ;
+ emm_sap.u.emm_reg.ueid = ueid;
+ emm_sap.u.emm_reg.ctx = ctx;
+ rc = emm_sap_send(&emm_sap);
+ }
+ }
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: emm_proc_authentication_complete() **
+ ** **
+ ** Description: Performs the authentication completion procedure executed **
+ ** by the network. **
+ ** **
+ ** 3GPP TS 24.301, section 5.4.2.4 **
+ ** Upon receiving the AUTHENTICATION RESPONSE message, the **
+ ** MME shall stop timer T3460 and check the correctness of **
+ ** the RES parameter. **
+ ** **
+ ** Inputs: ueid: UE lower layer identifier **
+ ** emm_cause: Authentication failure EMM cause code **
+ ** res: Authentication response parameter. or auts **
+ ** in case of sync failure **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: _emm_data, T3460 **
+ ** **
+ ***************************************************************************/
+int emm_proc_authentication_complete(unsigned int ueid, int emm_cause,
+ const OctetString *res)
+{
+ int rc;
+ emm_sap_t emm_sap;
+
+ LOG_FUNC_IN;
+
+ LOG_TRACE(INFO, "EMM-PROC - Authentication complete (ueid="NAS_UE_ID_FMT", cause=%d)",
+ ueid, emm_cause);
+
+
+ /* Release retransmission timer paramaters */
+ authentication_data_t *data =
+ (authentication_data_t *)(emm_proc_common_get_args(ueid));
+
+ if (data) {
+ if (data->rand.length > 0) {
+ free(data->rand.value);
+ }
+
+ if (data->autn.length > 0) {
+ free(data->autn.value);
+ }
+
+ free(data);
+ }
+
+ /* Get the UE context */
+ emm_data_context_t *emm_ctx = NULL;
+#if defined(NAS_BUILT_IN_EPC)
+ if (ueid > 0) {
+ emm_ctx = emm_data_context_get(&_emm_data, ueid);
+ }
+#else
+ if (ueid < EMM_DATA_NB_UE_MAX) {
+ emm_ctx = _emm_data.ctx[ueid];
+ }
+#endif
+
+ if (emm_ctx) {
+ /* Stop timer T3460 */
+ LOG_TRACE(INFO, "EMM-PROC - Stop timer T3460 (%d)", emm_ctx->T3460.id);
+ emm_ctx->T3460.id = nas_timer_stop(emm_ctx->T3460.id);
+ MSC_LOG_EVENT(MSC_NAS_EMM_MME, "0 T3460 stopped UE "NAS_UE_ID_FMT" ", data->ueid);
+ }
+ if (emm_cause == EMM_CAUSE_SUCCESS) {
+ /* Check the received RES parameter */
+ if ( (emm_ctx == NULL) ||
+ (memcmp(res->value, &emm_ctx->vector.xres, res->length) != 0) ) {
+ /* RES does not match the XRES parameter */
+ LOG_TRACE(WARNING, "EMM-PROC - Failed to authentify the UE");
+ emm_cause = EMM_CAUSE_ILLEGAL_UE;
+ } else {
+ LOG_TRACE(DEBUG, "EMM-PROC - Success to authentify the UE RESP XRES == XRES UE CONTEXT");
+ }
+ }
+
+ if (emm_cause != EMM_CAUSE_SUCCESS) {
+ switch (emm_cause) {
+
+#if defined(NAS_BUILT_IN_EPC)
+
+ case EMM_CAUSE_SYNCH_FAILURE:
+ /* USIM has detected a mismatch in SQN.
+ * Ask for a new vector.
+ */
+ MSC_LOG_EVENT(
+ MSC_NAS_EMM_MME,
+ "0 SQN SYNCH_FAILURE ue id "NAS_UE_ID_FMT" ", ueid);
+
+ LOG_TRACE(DEBUG, "EMM-PROC - USIM has detected a mismatch in SQN Ask for a new vector");
+ nas_itti_auth_info_req(ueid, emm_ctx->imsi, 0, res->value);
+
+ rc = RETURNok;
+ LOG_FUNC_RETURN (rc);
+ break;
+#endif
+
+ default:
+ LOG_TRACE(DEBUG, "EMM-PROC - The MME received an authentication failure message or the RES does not match the XRES parameter computed by the network");
+ /* The MME received an authentication failure message or the RES
+ * contained in the Authentication Response message received from
+ * the UE does not match the XRES parameter computed by the network */
+ (void) _authentication_reject(ueid);
+ /*
+ * Notify EMM that the authentication procedure failed
+ */
+ MSC_LOG_TX_MESSAGE(
+ MSC_NAS_EMM_MME,
+ MSC_NAS_EMM_MME,
+ NULL,0,
+ "0 EMMREG_COMMON_PROC_REJ ue id "NAS_UE_ID_FMT" ", ueid);
+
+
+ emm_sap.primitive = EMMREG_COMMON_PROC_REJ;
+ emm_sap.u.emm_reg.ueid = ueid;
+ emm_sap.u.emm_reg.ctx = emm_ctx;
+ break;
+ }
+ } else {
+ /*
+ * Notify EMM that the authentication procedure successfully completed
+ */
+ MSC_LOG_TX_MESSAGE(
+ MSC_NAS_EMM_MME,
+ MSC_NAS_EMM_MME,
+ NULL,0,
+ "0 EMMREG_COMMON_PROC_CNF ue id "NAS_UE_ID_FMT" ", ueid);
+
+ LOG_TRACE(DEBUG, "EMM-PROC - Notify EMM that the authentication procedure successfully completed");
+ emm_sap.primitive = EMMREG_COMMON_PROC_CNF;
+ emm_sap.u.emm_reg.ueid = ueid;
+ emm_sap.u.emm_reg.ctx = emm_ctx;
+ emm_sap.u.emm_reg.u.common.is_attached = emm_ctx->is_attached;
+ }
+
+ rc = emm_sap_send(&emm_sap);
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************/
+/********************* L O C A L F U N C T I O N S *********************/
+/****************************************************************************/
+
+
+/*
+ * --------------------------------------------------------------------------
+ * Timer handlers
+ * --------------------------------------------------------------------------
+ */
+
+/****************************************************************************
+ ** **
+ ** Name: _authentication_t3460_handler() **
+ ** **
+ ** Description: T3460 timeout handler **
+ ** Upon T3460 timer expiration, the authentication request **
+ ** message is retransmitted and the timer restarted. When **
+ ** retransmission counter is exceed, the MME shall abort the **
+ ** authentication procedure and any ongoing EMM specific **
+ ** procedure and release the NAS signalling connection. **
+ ** **
+ ** 3GPP TS 24.301, section 5.4.2.7, case b **
+ ** **
+ ** Inputs: args: handler parameters **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: None **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+static void *_authentication_t3460_handler(void *args)
+{
+ LOG_FUNC_IN;
+
+ int rc;
+
+ authentication_data_t *data = (authentication_data_t *)(args);
+
+ /* Increment the retransmission counter */
+ data->retransmission_count += 1;
+
+ LOG_TRACE(WARNING, "EMM-PROC - T3460 timer expired, retransmission "
+ "counter = %d", data->retransmission_count);
+
+ if (data->retransmission_count < AUTHENTICATION_COUNTER_MAX) {
+ /* Send authentication request message to the UE */
+ rc = _authentication_request(data);
+ } else {
+ unsigned int ueid = data->ueid;
+ /* Set the failure notification indicator */
+ data->notify_failure = TRUE;
+ /* Abort the authentication procedure */
+ rc = _authentication_abort(data);
+
+ /* Release the NAS signalling connection */
+ if (rc != RETURNerror) {
+ emm_sap_t emm_sap;
+ emm_sap.primitive = EMMAS_RELEASE_REQ;
+ emm_sap.u.emm_as.u.release.guti = NULL;
+ emm_sap.u.emm_as.u.release.ueid = ueid;
+ emm_sap.u.emm_as.u.release.cause = EMM_AS_CAUSE_AUTHENTICATION;
+ rc = emm_sap_send(&emm_sap);
+ }
+ }
+
+ LOG_FUNC_RETURN (NULL);
+}
+
+/*
+ * --------------------------------------------------------------------------
+ * MME specific local functions
+ * --------------------------------------------------------------------------
+ */
+
+/****************************************************************************
+ ** **
+ ** Name: _authentication_request() **
+ ** **
+ ** Description: Sends AUTHENTICATION REQUEST message and start timer T3460**
+ ** **
+ ** Inputs: args: handler parameters **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: T3460 **
+ ** **
+ ***************************************************************************/
+int _authentication_request(authentication_data_t *data)
+{
+ LOG_FUNC_IN;
+
+ emm_sap_t emm_sap;
+ int rc;
+ struct emm_data_context_s *emm_ctx;
+
+ /*
+ * Notify EMM-AS SAP that Authentication Request message has to be sent
+ * to the UE
+ */
+ emm_sap.primitive = EMMAS_SECURITY_REQ;
+ emm_sap.u.emm_as.u.security.guti = NULL;
+ emm_sap.u.emm_as.u.security.ueid = data->ueid;
+ emm_sap.u.emm_as.u.security.msgType = EMM_AS_MSG_TYPE_AUTH;
+ emm_sap.u.emm_as.u.security.ksi = data->ksi;
+ emm_sap.u.emm_as.u.security.rand = &data->rand;
+ emm_sap.u.emm_as.u.security.autn = &data->autn;
+
+ /* TODO: check for pointer validity */
+#if defined(NAS_BUILT_IN_EPC)
+ emm_ctx = emm_data_context_get(&_emm_data, data->ueid);
+#else
+ emm_ctx = _emm_data.ctx[data->ueid];
+#endif
+
+ /* Setup EPS NAS security data */
+ emm_as_set_security_data(&emm_sap.u.emm_as.u.security.sctx,
+ emm_ctx->security, FALSE, TRUE);
+
+ MSC_LOG_TX_MESSAGE(
+ MSC_NAS_EMM_MME,
+ MSC_NAS_EMM_MME,
+ NULL,0,
+ "0 EMMAS_SECURITY_REQ ue id "NAS_UE_ID_FMT" ", data->ueid);
+
+ rc = emm_sap_send(&emm_sap);
+
+ if (rc != RETURNerror) {
+ if (emm_ctx) {
+ if (emm_ctx->T3460.id != NAS_TIMER_INACTIVE_ID) {
+ /* Re-start T3460 timer */
+ emm_ctx->T3460.id = nas_timer_restart(emm_ctx->T3460.id);
+ MSC_LOG_EVENT(MSC_NAS_EMM_MME, "0 T3460 restarted UE "NAS_UE_ID_FMT" ", data->ueid);
+ } else {
+ /* Start T3460 timer */
+ emm_ctx->T3460.id = nas_timer_start(emm_ctx->T3460.sec, _authentication_t3460_handler,
+ data);
+ MSC_LOG_EVENT(MSC_NAS_EMM_MME, "0 T3460 started UE "NAS_UE_ID_FMT" ", data->ueid);
+ }
+ }
+
+ LOG_TRACE(INFO,"EMM-PROC - Timer T3460 (%d) expires in %ld seconds",
+ emm_ctx->T3460.id, emm_ctx->T3460.sec);
+ }
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: _authentication_reject() **
+ ** **
+ ** Description: Sends AUTHENTICATION REJECT message **
+ ** **
+ ** Inputs: ueid: UE lower layer identifier **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+static int _authentication_reject(unsigned int ueid)
+{
+ LOG_FUNC_IN;
+
+ emm_sap_t emm_sap;
+ int rc;
+ struct emm_data_context_s *emm_ctx;
+
+ /*
+ * Notify EMM-AS SAP that Authentication Reject message has to be sent
+ * to the UE
+ */
+ emm_sap.primitive = EMMAS_SECURITY_REJ;
+ emm_sap.u.emm_as.u.security.guti = NULL;
+ emm_sap.u.emm_as.u.security.ueid = ueid;
+ emm_sap.u.emm_as.u.security.msgType = EMM_AS_MSG_TYPE_AUTH;
+
+#if defined(NAS_BUILT_IN_EPC)
+ emm_ctx = emm_data_context_get(&_emm_data, ueid);
+#else
+ emm_ctx = _emm_data.ctx[ueid];
+#endif
+ /* Setup EPS NAS security data */
+ emm_as_set_security_data(&emm_sap.u.emm_as.u.security.sctx,
+ emm_ctx->security, FALSE, TRUE);
+ rc = emm_sap_send(&emm_sap);
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: _authentication_abort() **
+ ** **
+ ** Description: Aborts the authentication procedure currently in progress **
+ ** **
+ ** Inputs: args: Authentication data to be released **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: T3460 **
+ ** **
+ ***************************************************************************/
+static int _authentication_abort(void *args)
+{
+ LOG_FUNC_IN;
+
+ int rc = RETURNerror;
+ struct emm_data_context_s *emm_ctx;
+
+ authentication_data_t *data = (authentication_data_t *)(args);
+
+ if (data) {
+ unsigned int ueid = data->ueid;
+ int notify_failure = data->notify_failure;
+
+ LOG_TRACE(WARNING, "EMM-PROC - Abort authentication procedure "
+ "(ueid="NAS_UE_ID_FMT")", ueid);
+#if defined(NAS_BUILT_IN_EPC)
+ emm_ctx = emm_data_context_get(&_emm_data, ueid);
+#else
+ emm_ctx = _emm_data.ctx[ueid];
+#endif
+ if (emm_ctx) {
+ /* Stop timer T3460 */
+ if (emm_ctx->T3460.id != NAS_TIMER_INACTIVE_ID) {
+ LOG_TRACE(INFO, "EMM-PROC - Stop timer T3460 (%d)", emm_ctx->T3460.id);
+ emm_ctx->T3460.id = nas_timer_stop(emm_ctx->T3460.id);
+ MSC_LOG_EVENT(MSC_NAS_EMM_MME, "0 T3460 stopped UE "NAS_UE_ID_FMT" ", data->ueid);
+ }
+ }
+
+ /* Release retransmission timer paramaters */
+ if (data->rand.length > 0) {
+ free(data->rand.value);
+ }
+
+ if (data->autn.length > 0) {
+ free(data->autn.value);
+ }
+
+ free(data);
+
+ /*
+ * Notify EMM that the authentication procedure failed
+ */
+ if (notify_failure) {
+ emm_sap_t emm_sap;
+ emm_sap.primitive = EMMREG_COMMON_PROC_REJ;
+ emm_sap.u.emm_reg.ueid = ueid;
+ rc = emm_sap_send(&emm_sap);
+ } else {
+ rc = RETURNok;
+ }
+ }
+
+ LOG_FUNC_RETURN (rc);
+}
+
+
diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/mme/COPYING b/openair-cn/NAS/MME/EMM/COPYING
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/api/mme/COPYING
rename to openair-cn/NAS/MME/EMM/COPYING
diff --git a/openair-cn/NAS/MME/EMM/Detach.c b/openair-cn/NAS/MME/EMM/Detach.c
new file mode 100644
index 0000000000..1ba60e5b6d
--- /dev/null
+++ b/openair-cn/NAS/MME/EMM/Detach.c
@@ -0,0 +1,346 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+Source Detach.c
+
+Version 0.1
+
+Date 2013/05/07
+
+Product NAS stack
+
+Subsystem EPS Mobility Management
+
+Author Frederic Maurel
+
+Description Defines the detach related EMM procedure executed by the
+ Non-Access Stratum.
+
+ The detach procedure is used by the UE to detach for EPS servi-
+ ces, to disconnect from the last PDN it is connected to; by the
+ network to inform the UE that it is detached for EPS services
+ or non-EPS services or both, to disconnect the UE from the last
+ PDN to which it is connected and to inform the UE to re-attach
+ to the network and re-establish all PDN connections.
+
+*****************************************************************************/
+
+#include "emm_proc.h"
+#include "nas_log.h"
+#include "nas_timer.h"
+
+#include "emmData.h"
+
+#include "emm_sap.h"
+#include "esm_sap.h"
+#include "msc.h"
+
+#include // free
+
+/****************************************************************************/
+/**************** E X T E R N A L D E F I N I T I O N S ****************/
+/****************************************************************************/
+
+/****************************************************************************/
+/******************* L O C A L D E F I N I T I O N S *******************/
+/****************************************************************************/
+
+/* String representation of the detach type */
+static const char *_emm_detach_type_str[] = {
+ "EPS", "IMSI", "EPS/IMSI",
+ "RE-ATTACH REQUIRED", "RE-ATTACH NOT REQUIRED", "RESERVED"
+};
+
+/*
+ * --------------------------------------------------------------------------
+ * Internal data handled by the detach procedure in the UE
+ * --------------------------------------------------------------------------
+ */
+
+
+/*
+ * --------------------------------------------------------------------------
+ * Internal data handled by the detach procedure in the MME
+ * --------------------------------------------------------------------------
+ */
+
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+/*
+ * --------------------------------------------------------------------------
+ * Detach procedure executed by the UE
+ * --------------------------------------------------------------------------
+ */
+
+/*
+ * --------------------------------------------------------------------------
+ * Detach procedure executed by the MME
+ * --------------------------------------------------------------------------
+ */
+/****************************************************************************
+ ** **
+ ** Name: emm_proc_detach() **
+ ** **
+ ** Description: Initiate the detach procedure to inform the UE that it is **
+ ** detached for EPS services, or to re-attach to the network **
+ ** and re-establish all PDN connections. **
+ ** **
+ ** 3GPP TS 24.301, section 5.5.2.3.1 **
+ ** In state EMM-REGISTERED the network initiates the detach **
+ ** procedure by sending a DETACH REQUEST message to the UE, **
+ ** starting timer T3422 and entering state EMM-DEREGISTERED- **
+ ** INITIATED. **
+ ** **
+ ** Inputs: ueid: UE lower layer identifier **
+ ** type: Type of the requested detach **
+ ** Others: _emm_detach_type_str **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: T3422 **
+ ** **
+ ***************************************************************************/
+int emm_proc_detach(unsigned int ueid, emm_proc_detach_type_t type)
+{
+ LOG_FUNC_IN;
+
+ int rc = RETURNerror;
+
+ LOG_TRACE(INFO, "EMM-PROC - Initiate detach type = %s (%d)",
+ _emm_detach_type_str[type], type);
+
+ /* TODO */
+
+ LOG_FUNC_RETURN(rc);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: emm_proc_detach_request() **
+ ** **
+ ** Description: Performs the UE initiated detach procedure for EPS servi- **
+ ** ces only When the DETACH REQUEST message is received by **
+ ** the network. **
+ ** **
+ ** 3GPP TS 24.301, section 5.5.2.2.2 **
+ ** Upon receiving the DETACH REQUEST message the network **
+ ** shall send a DETACH ACCEPT message to the UE and store **
+ ** the current EPS security context, if the detach type IE **
+ ** does not indicate "switch off". Otherwise, the procedure **
+ ** is completed when the network receives the DETACH REQUEST **
+ ** message. **
+ ** The network shall deactivate the EPS bearer context(s) **
+ ** for this UE locally without peer-to-peer signalling and **
+ ** shall enter state EMM-DEREGISTERED. **
+ ** **
+ ** Inputs: ueid: UE lower layer identifier **
+ ** type: Type of the requested detach **
+ ** switch_off: Indicates whether the detach is required **
+ ** because the UE is switched off or not **
+ ** native_ksi: TRUE if the security context is of type **
+ ** native **
+ ** ksi: The NAS ket sey identifier **
+ ** guti: The GUTI if provided by the UE **
+ ** imsi: The IMSI if provided by the UE **
+ ** imei: The IMEI if provided by the UE **
+ ** Others: _emm_data **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int emm_proc_detach_request(unsigned int ueid, emm_proc_detach_type_t type,
+ int switch_off, int native_ksi, int ksi,
+ GUTI_t *guti, imsi_t *imsi, imei_t *imei)
+{
+ LOG_FUNC_IN;
+
+ int rc;
+ emm_data_context_t *emm_ctx = NULL;
+
+ LOG_TRACE(INFO, "EMM-PROC - Detach type = %s (%d) requested (ueid="NAS_UE_ID_FMT")",
+ _emm_detach_type_str[type], type, ueid);
+
+ /* Get the UE context */
+#if defined(NAS_BUILT_IN_EPC)
+
+ if (ueid > 0) {
+ emm_ctx = emm_data_context_get(&_emm_data, ueid);
+ }
+
+#else
+
+ if (ueid < EMM_DATA_NB_UE_MAX) {
+ emm_ctx = _emm_data.ctx[ueid];
+ }
+
+#endif
+
+ if (emm_ctx == NULL) {
+ LOG_TRACE(WARNING, "No EMM context exists for the UE (ueid="NAS_UE_ID_FMT")", ueid);
+ LOG_FUNC_RETURN(RETURNok);
+ }
+
+ if (switch_off) {
+ MSC_LOG_EVENT(MSC_NAS_EMM_MME,
+ "0 Removing UE context ue id "NAS_UE_ID_FMT" ", ueid);
+ /* The UE is switched off */
+ if (emm_ctx->guti) {
+ free(emm_ctx->guti);
+ }
+
+ if (emm_ctx->imsi) {
+ free(emm_ctx->imsi);
+ }
+
+ if (emm_ctx->imei) {
+ free(emm_ctx->imei);
+ }
+
+ if (emm_ctx->esm_msg.length > 0) {
+ free(emm_ctx->esm_msg.value);
+ }
+
+ /* Release NAS security context */
+ if (emm_ctx->security) {
+ emm_security_context_t *security = emm_ctx->security;
+
+ if (security->kasme.value) {
+ free(security->kasme.value);
+ }
+
+ if (security->knas_enc.value) {
+ free(security->knas_enc.value);
+ }
+
+ if (security->knas_int.value) {
+ free(security->knas_int.value);
+ }
+
+ free(emm_ctx->security);
+ }
+ /* Stop timer T3450 */
+ if (emm_ctx->T3450.id != NAS_TIMER_INACTIVE_ID) {
+ LOG_TRACE(INFO, "EMM-PROC - Stop timer T3450 (%d)", emm_ctx->T3450.id);
+ emm_ctx->T3450.id = nas_timer_stop(emm_ctx->T3450.id);
+ MSC_LOG_EVENT(MSC_NAS_EMM_MME, "0 T3450 stopped UE "NAS_UE_ID_FMT" ", emm_ctx->ueid);
+ }
+ /* Stop timer T3460 */
+ if (emm_ctx->T3460.id != NAS_TIMER_INACTIVE_ID) {
+ LOG_TRACE(INFO, "EMM-PROC - Stop timer T3460 (%d)", emm_ctx->T3460.id);
+ emm_ctx->T3460.id = nas_timer_stop(emm_ctx->T3460.id);
+ MSC_LOG_EVENT(MSC_NAS_EMM_MME, "0 T3460 stopped UE "NAS_UE_ID_FMT" ", emm_ctx->ueid);
+ }
+ /* Stop timer T3470 */
+ if (emm_ctx->T3470.id != NAS_TIMER_INACTIVE_ID) {
+ LOG_TRACE(INFO, "EMM-PROC - Stop timer T3470 (%d)", emm_ctx->T3460.id);
+ emm_ctx->T3470.id = nas_timer_stop(emm_ctx->T3470.id);
+ MSC_LOG_EVENT(MSC_NAS_EMM_MME, "0 T3470 stopped UE "NAS_UE_ID_FMT" ", emm_ctx->ueid);
+ }
+ /* Release the EMM context */
+#if defined(NAS_BUILT_IN_EPC)
+ emm_data_context_remove(&_emm_data, emm_ctx);
+ free(emm_ctx);
+#else
+ free(_emm_data.ctx[ueid]);
+ _emm_data.ctx[ueid] = NULL;
+#endif
+ rc = RETURNok;
+ } else {
+ /* Normal detach without UE switch-off */
+ emm_sap_t emm_sap;
+ emm_as_data_t *emm_as = &emm_sap.u.emm_as.u.data;
+ MSC_LOG_TX_MESSAGE(
+ MSC_NAS_EMM_MME,
+ MSC_NAS_EMM_MME,
+ NULL,0,
+ "0 EMM_AS_NAS_INFO_DETACH ue id "NAS_UE_ID_FMT" ", ueid);
+
+ /* Setup NAS information message to transfer */
+ emm_as->NASinfo = EMM_AS_NAS_INFO_DETACH;
+ emm_as->NASmsg.length = 0;
+ emm_as->NASmsg.value = NULL;
+ /* Set the UE identifier */
+ emm_as->guti = NULL;
+ emm_as->ueid = ueid;
+ /* Setup EPS NAS security data */
+ emm_as_set_security_data(&emm_as->sctx, emm_ctx->security, FALSE, TRUE);
+ /*
+ * Notify EMM-AS SAP that Detach Accept message has to
+ * be sent to the network
+ */
+ emm_sap.primitive = EMMAS_DATA_REQ;
+ rc = emm_sap_send(&emm_sap);
+ }
+
+ if (rc != RETURNerror) {
+ /*
+ * Notify ESM that all EPS bearer contexts allocated for this UE have
+ * to be locally deactivated
+ */
+ MSC_LOG_TX_MESSAGE(
+ MSC_NAS_EMM_MME,
+ MSC_NAS_ESM_MME,
+ NULL,0,
+ "0 ESM_EPS_BEARER_CONTEXT_DEACTIVATE_REQ ue id "NAS_UE_ID_FMT" ", ueid);
+ esm_sap_t esm_sap;
+ esm_sap.primitive = ESM_EPS_BEARER_CONTEXT_DEACTIVATE_REQ;
+ esm_sap.ueid = ueid;
+ esm_sap.ctx = emm_ctx;
+ esm_sap.data.eps_bearer_context_deactivate.ebi = ESM_SAP_ALL_EBI;
+ rc = esm_sap_send(&esm_sap);
+
+ if (rc != RETURNerror) {
+ emm_sap_t emm_sap;
+ /*
+ * Notify EMM that the UE has been implicitly detached
+ */
+ MSC_LOG_TX_MESSAGE(
+ MSC_NAS_EMM_MME,
+ MSC_NAS_EMM_MME,
+ NULL,0,
+ "0 EMMREG_DETACH_REQ ue id "NAS_UE_ID_FMT" ", ueid);
+ emm_sap.primitive = EMMREG_DETACH_REQ;
+ emm_sap.u.emm_reg.ueid = ueid;
+ emm_sap.u.emm_reg.ctx = emm_ctx;
+ rc = emm_sap_send(&emm_sap);
+ }
+ }
+
+ LOG_FUNC_RETURN(rc);
+}
+
+/****************************************************************************/
+/********************* L O C A L F U N C T I O N S *********************/
+/****************************************************************************/
+
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/EmmCommon.c b/openair-cn/NAS/MME/EMM/EmmCommon.c
similarity index 99%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/EmmCommon.c
rename to openair-cn/NAS/MME/EMM/EmmCommon.c
index d142ec405e..a30c7675d8 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/EmmCommon.c
+++ b/openair-cn/NAS/MME/EMM/EmmCommon.c
@@ -53,7 +53,6 @@ Description Defines callback functions executed within EMM common procedures
*****************************************************************************/
-#ifdef NAS_MME
#include "EmmCommon.h"
@@ -513,4 +512,3 @@ static void _emm_common_cleanup(unsigned int ueid)
}
}
}
-#endif // NAS_MME
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/EmmCommon.h b/openair-cn/NAS/MME/EMM/EmmCommon.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/EmmCommon.h
rename to openair-cn/NAS/MME/EMM/EmmCommon.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/EmmStatusHdl.c b/openair-cn/NAS/MME/EMM/EmmStatusHdl.c
similarity index 98%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/EmmStatusHdl.c
rename to openair-cn/NAS/MME/EMM/EmmStatusHdl.c
index 67780db755..fec9f2314f 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/EmmStatusHdl.c
+++ b/openair-cn/NAS/MME/EMM/EmmStatusHdl.c
@@ -140,12 +140,6 @@ int emm_proc_status(unsigned int ueid, int emm_cause)
emm_sap.primitive = EMMAS_STATUS_IND;
emm_sap.u.emm_as.u.status.emm_cause = emm_cause;
emm_sap.u.emm_as.u.status.ueid = ueid;
-
-#ifdef NAS_UE
- emm_sap.u.emm_as.u.status.guti = _emm_data.guti;
- sctx = _emm_data.security;
-#endif
-#ifdef NAS_MME
emm_sap.u.emm_as.u.status.guti = NULL;
# if defined(NAS_BUILT_IN_EPC)
ctx = emm_data_context_get(&_emm_data, ueid);
@@ -157,7 +151,6 @@ int emm_proc_status(unsigned int ueid, int emm_cause)
sctx = ctx->security;
}
-#endif
/* Setup EPS NAS security data */
emm_as_set_security_data(&emm_sap.u.emm_as.u.status.sctx, sctx,
FALSE, TRUE);
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/Identification.c b/openair-cn/NAS/MME/EMM/Identification.c
similarity index 74%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/Identification.c
rename to openair-cn/NAS/MME/EMM/Identification.c
index 988834899d..a4e34f5be3 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/Identification.c
+++ b/openair-cn/NAS/MME/EMM/Identification.c
@@ -73,20 +73,12 @@ static const char *_emm_identity_type_str[] = {
"NOT AVAILABLE", "IMSI", "IMEI", "IMEISV", "TMSI"
};
-/*
- * --------------------------------------------------------------------------
- * Internal data handled by the identification procedure in the UE
- * --------------------------------------------------------------------------
- */
-#ifdef NAS_UE
-#endif // NAS_UE
/*
* --------------------------------------------------------------------------
* Internal data handled by the identification procedure in the MME
* --------------------------------------------------------------------------
*/
-#ifdef NAS_MME
/*
* Timer handlers
*/
@@ -113,147 +105,17 @@ typedef struct {
} identification_data_t;
static int _identification_request(identification_data_t *data);
-#endif // NAS_MME
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
-/*
- * --------------------------------------------------------------------------
- * Identification procedure executed by the UE
- * --------------------------------------------------------------------------
- */
-#ifdef NAS_UE
-/****************************************************************************
- ** **
- ** Name: emm_proc_identification_request() **
- ** **
- ** Description: Performs the MME requested identification procedure. **
- ** **
- ** 3GPP TS 24.301, section 5.4.4.3 **
- ** Upon receiving the IDENTITY REQUEST message, the UE shall **
- ** send an IDENTITY RESPONSE message to the network. The **
- ** IDENTITY RESPONSE message shall contain the identifica- **
- ** tion parameters as requested by the network. **
- ** **
- ** Inputs: type: Type of the requested identity **
- ** Others: None **
- ** **
- ** Outputs: None **
- ** Return: RETURNok, RETURNerror **
- ** Others: None **
- ** **
- ***************************************************************************/
-int emm_proc_identification_request(emm_proc_identity_type_t type)
-{
- LOG_FUNC_IN;
-
- int rc;
- emm_sap_t emm_sap;
-
- LOG_TRACE(INFO, "EMM-PROC - Identification requested type = %s (%d)",
- _emm_identity_type_str[type], type);
-
- /* Setup EMM procedure handler to be executed upon receiving
- * lower layer notification */
- rc = emm_proc_lowerlayer_initialize(NULL, NULL, NULL, NULL);
-
- if (rc != RETURNok) {
- LOG_TRACE(WARNING,
- "EMM-PROC - Failed to initialize EMM procedure handler");
- LOG_FUNC_RETURN (RETURNerror);
- }
-
- emm_sap.u.emm_as.u.security.identType = EMM_IDENT_TYPE_NOT_AVAILABLE;
-
- switch (type) {
- case EMM_IDENT_TYPE_IMSI: {
- imsi_t modified_imsi;
-
- /* International Mobile Subscriber Identity is requested */
- if (_emm_data.imsi) {
- memcpy (&modified_imsi, _emm_data.imsi, sizeof (modified_imsi));
-
- /* LW: Eventually replace the 0xF value set in MNC digit 3 by a 0 to avoid IMSI to be truncated before reaching HSS */
- if (modified_imsi.u.num.digit6 == 0xF) {
- modified_imsi.u.num.digit6 = 0;
- }
-
- emm_sap.u.emm_as.u.security.identType = EMM_IDENT_TYPE_IMSI;
- emm_sap.u.emm_as.u.security.imsi = &modified_imsi;
-
- LOG_TRACE(INFO, "EMM-PROC - IMSI = %u%u%u %u%u%u %u%u%u%u%x%x%x%x%x",
- emm_sap.u.emm_as.u.security.imsi->u.num.digit1,
- emm_sap.u.emm_as.u.security.imsi->u.num.digit2,
- emm_sap.u.emm_as.u.security.imsi->u.num.digit3,
-
- emm_sap.u.emm_as.u.security.imsi->u.num.digit4,
- emm_sap.u.emm_as.u.security.imsi->u.num.digit5,
- emm_sap.u.emm_as.u.security.imsi->u.num.digit6,
-
- emm_sap.u.emm_as.u.security.imsi->u.num.digit7,
- emm_sap.u.emm_as.u.security.imsi->u.num.digit8,
- emm_sap.u.emm_as.u.security.imsi->u.num.digit9,
- emm_sap.u.emm_as.u.security.imsi->u.num.digit10,
- emm_sap.u.emm_as.u.security.imsi->u.num.digit11,
- emm_sap.u.emm_as.u.security.imsi->u.num.digit12,
- emm_sap.u.emm_as.u.security.imsi->u.num.digit13,
- emm_sap.u.emm_as.u.security.imsi->u.num.digit14,
- emm_sap.u.emm_as.u.security.imsi->u.num.digit15);
- }
-
- break;
- }
-
- case EMM_IDENT_TYPE_IMEI:
-
- /* International Mobile Equipment Identity is requested */
- if (_emm_data.imei) {
- emm_sap.u.emm_as.u.security.identType = EMM_IDENT_TYPE_IMEI;
- emm_sap.u.emm_as.u.security.imei = _emm_data.imei;
- }
-
- break;
-
- case EMM_IDENT_TYPE_TMSI:
-
- /* Temporary Mobile Subscriber Identity is requested */
- if (_emm_data.guti) {
- emm_sap.u.emm_as.u.security.identType = EMM_IDENT_TYPE_TMSI;
- emm_sap.u.emm_as.u.security.tmsi = _emm_data.guti->m_tmsi;
- }
-
- break;
-
- default:
- /* Other identities are not available */
- break;
- }
-
- /*
- * Notify EMM-AS SAP that Identity Response message has to be sent
- * to the MME
- */
- emm_sap.primitive = EMMAS_SECURITY_RES;
- emm_sap.u.emm_as.u.security.guti = _emm_data.guti;
- emm_sap.u.emm_as.u.security.ueid = 0;
- emm_sap.u.emm_as.u.security.msgType = EMM_AS_MSG_TYPE_IDENT;
- /* Setup EPS NAS security data */
- emm_as_set_security_data(&emm_sap.u.emm_as.u.security.sctx,
- _emm_data.security, FALSE, TRUE);
- rc = emm_sap_send(&emm_sap);
-
- LOG_FUNC_RETURN (rc);
-}
-#endif // NAS_UE
/*
* --------------------------------------------------------------------------
* Identification procedure executed by the MME
* --------------------------------------------------------------------------
*/
-#ifdef NAS_MME
/********************************************************************
** **
** Name: emm_proc_identification() **
@@ -331,7 +193,7 @@ int emm_proc_identification(unsigned int ueid,
MSC_NAS_EMM_MME,
MSC_NAS_EMM_MME,
NULL,0,
- "0 EMMREG_COMMON_PROC_REQ ue id %06x (identification)", ueid);
+ "0 EMMREG_COMMON_PROC_REQ ue id "NAS_UE_ID_FMT" (identification)", ueid);
emm_sap_t emm_sap;
emm_sap.primitive = EMMREG_COMMON_PROC_REQ;
@@ -367,7 +229,7 @@ int emm_proc_identification(unsigned int ueid,
** **
***************************************************************************/
int emm_proc_identification_complete(unsigned int ueid, const imsi_t *imsi,
- const imei_t *imei, UInt32_t *tmsi)
+ const imei_t *imei, uint32_t *tmsi)
{
int rc = RETURNerror;
emm_sap_t emm_sap;
@@ -376,36 +238,32 @@ int emm_proc_identification_complete(unsigned int ueid, const imsi_t *imsi,
LOG_FUNC_IN;
- LOG_TRACE(INFO, "EMM-PROC - Identification complete (ueid=%u)", ueid);
-
- /* Stop timer T3470 */
- LOG_TRACE(INFO, "EMM-PROC - Stop timer T3470 (%d)", T3470.id);
- T3470.id = nas_timer_stop(T3470.id);
+ LOG_TRACE(INFO, "EMM-PROC - Identification complete (ueid="NAS_UE_ID_FMT")", ueid);
/* Release retransmission timer paramaters */
identification_data_t *data =
(identification_data_t *)(emm_proc_common_get_args(ueid));
-
if (data) {
free(data);
}
/* Get the UE context */
#if defined(NAS_BUILT_IN_EPC)
-
if (ueid > 0) {
emm_ctx = emm_data_context_get(&_emm_data, ueid);
}
-
#else
-
if (ueid < EMM_DATA_NB_UE_MAX) {
emm_ctx = _emm_data.ctx[ueid];
}
-
#endif
if (emm_ctx) {
+ /* Stop timer T3470 */
+ LOG_TRACE(INFO, "EMM-PROC - Stop timer T3470 (%d)", emm_ctx->T3470.id);
+ emm_ctx->T3470.id = nas_timer_stop(emm_ctx->T3470.id);
+ MSC_LOG_EVENT(MSC_NAS_EMM_MME, "0 T3470 stopped UE "NAS_UE_ID_FMT" ", ueid);
+
if (imsi) {
/* Update the IMSI */
if (emm_ctx->imsi == NULL) {
@@ -444,7 +302,7 @@ int emm_proc_identification_complete(unsigned int ueid, const imsi_t *imsi,
MSC_NAS_EMM_MME,
MSC_NAS_EMM_MME,
NULL,0,
- "0 EMMREG_COMMON_PROC_CNF ue id %06x", ueid);
+ "0 EMMREG_COMMON_PROC_CNF ue id "NAS_UE_ID_FMT" ", ueid);
emm_sap.primitive = EMMREG_COMMON_PROC_CNF;
emm_sap.u.emm_reg.ueid = ueid;
@@ -459,7 +317,7 @@ int emm_proc_identification_complete(unsigned int ueid, const imsi_t *imsi,
MSC_NAS_EMM_MME,
MSC_NAS_EMM_MME,
NULL,0,
- "0 EMMREG_COMMON_PROC_REJ ue id %06x", ueid);
+ "0 EMMREG_COMMON_PROC_REJ ue id "NAS_UE_ID_FMT" ", ueid);
emm_sap.primitive = EMMREG_COMMON_PROC_REJ;
emm_sap.u.emm_reg.ueid = ueid;
@@ -471,13 +329,11 @@ int emm_proc_identification_complete(unsigned int ueid, const imsi_t *imsi,
LOG_FUNC_RETURN (rc);
}
-#endif // NAS_MME
/****************************************************************************/
/********************* L O C A L F U N C T I O N S *********************/
/****************************************************************************/
-#ifdef NAS_MME
/*
* --------------------------------------------------------------------------
* Timer handlers
@@ -568,7 +424,7 @@ int _identification_request(identification_data_t *data)
MSC_NAS_EMM_MME,
MSC_NAS_EMM_MME,
NULL,0,
- "0 EMMAS_SECURITY_REQ ue id %06x", data->ueid);
+ "0 EMMAS_SECURITY_REQ ue id "NAS_UE_ID_FMT" ", data->ueid);
emm_sap.primitive = EMMAS_SECURITY_REQ;
emm_sap.u.emm_as.u.security.guti = NULL;
@@ -577,17 +433,13 @@ int _identification_request(identification_data_t *data)
emm_sap.u.emm_as.u.security.identType = data->type;
#if defined(NAS_BUILT_IN_EPC)
-
if (data->ueid > 0) {
emm_ctx = emm_data_context_get(&_emm_data, data->ueid);
}
-
#else
-
if (data->ueid < EMM_DATA_NB_UE_MAX) {
emm_ctx = _emm_data.ctx[data->ueid];
}
-
#endif
/* Setup EPS NAS security data */
emm_as_set_security_data(&emm_sap.u.emm_as.u.security.sctx,
@@ -595,17 +447,19 @@ int _identification_request(identification_data_t *data)
rc = emm_sap_send(&emm_sap);
if (rc != RETURNerror) {
- if (T3470.id != NAS_TIMER_INACTIVE_ID) {
+ if (emm_ctx->T3470.id != NAS_TIMER_INACTIVE_ID) {
/* Re-start T3470 timer */
- T3470.id = nas_timer_restart(T3470.id);
+ emm_ctx->T3470.id = nas_timer_restart(emm_ctx->T3470.id);
+ MSC_LOG_EVENT(MSC_NAS_EMM_MME, "0 T3470 restarted UE "NAS_UE_ID_FMT" ", data->ueid);
} else {
/* Start T3470 timer */
- T3470.id = nas_timer_start(T3470.sec, _identification_t3470_handler,
+ emm_ctx->T3470.id = nas_timer_start(emm_ctx->T3470.sec, _identification_t3470_handler,
data);
+ MSC_LOG_EVENT(MSC_NAS_EMM_MME, "0 T3470 started UE "NAS_UE_ID_FMT" ", data->ueid);
}
LOG_TRACE(INFO,"EMM-PROC - Timer T3470 (%d) expires in %ld seconds",
- T3470.id, T3470.sec);
+ emm_ctx->T3470.id, emm_ctx->T3470.sec);
}
LOG_FUNC_RETURN (rc);
@@ -636,14 +490,25 @@ static int _identification_abort(void *args)
if (data) {
unsigned int ueid = data->ueid;
int notify_failure = data->notify_failure;
-
+ struct emm_data_context_s *emm_ctx = NULL;
+ /* Get the UE context */
+ #if defined(NAS_BUILT_IN_EPC)
+ if (ueid > 0) {
+ emm_ctx = emm_data_context_get(&_emm_data, ueid);
+ }
+ #else
+ if (ueid < EMM_DATA_NB_UE_MAX) {
+ emm_ctx = _emm_data.ctx[ueid];
+ }
+ #endif
LOG_TRACE(WARNING, "EMM-PROC - Abort identification procedure "
- "(ueid=%u)", ueid);
+ "(ueid="NAS_UE_ID_FMT")", ueid);
/* Stop timer T3470 */
- if (T3470.id != NAS_TIMER_INACTIVE_ID) {
- LOG_TRACE(INFO, "EMM-PROC - Stop timer T3470 (%d)", T3470.id);
- T3470.id = nas_timer_stop(T3470.id);
+ if (emm_ctx->T3470.id != NAS_TIMER_INACTIVE_ID) {
+ LOG_TRACE(INFO, "EMM-PROC - Stop timer T3470 (%d)", emm_ctx->T3470.id);
+ emm_ctx->T3470.id = nas_timer_stop(emm_ctx->T3470.id);
+ MSC_LOG_EVENT(MSC_NAS_EMM_MME, "0 T3470 stopped UE "NAS_UE_ID_FMT" ", data->ueid);
}
/* Release retransmission timer paramaters */
@@ -657,7 +522,7 @@ static int _identification_abort(void *args)
MSC_NAS_EMM_MME,
MSC_NAS_EMM_MME,
NULL,0,
- "0 EMMREG_COMMON_PROC_REJ ue id %06x", ueid);
+ "0 EMMREG_COMMON_PROC_REJ ue id "NAS_UE_ID_FMT" ", ueid);
emm_sap_t emm_sap;
emm_sap.primitive = EMMREG_COMMON_PROC_REJ;
emm_sap.u.emm_reg.ueid = ueid;
@@ -670,5 +535,4 @@ static int _identification_abort(void *args)
LOG_FUNC_RETURN(rc);
}
-#endif // NAS_MME
diff --git a/openair3/PMIPv6/pmipv6-daemon-umip/ChangeLog b/openair-cn/NAS/MME/EMM/IdleMode.c
old mode 100755
new mode 100644
similarity index 100%
rename from openair3/PMIPv6/pmipv6-daemon-umip/ChangeLog
rename to openair-cn/NAS/MME/EMM/IdleMode.c
diff --git a/openair-cn/NAS/MME/EMM/IdleMode.h b/openair-cn/NAS/MME/EMM/IdleMode.h
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/openair-cn/NAS/MME/EMM/LowerLayer.c b/openair-cn/NAS/MME/EMM/LowerLayer.c
new file mode 100644
index 0000000000..2012164975
--- /dev/null
+++ b/openair-cn/NAS/MME/EMM/LowerLayer.c
@@ -0,0 +1,384 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+Source LowerLayer.c
+
+Version 0.1
+
+Date 2012/03/14
+
+Product NAS stack
+
+Subsystem EPS Mobility Management
+
+Author Frederic Maurel
+
+Description Defines EMM procedures executed by the Non-Access Stratum
+ upon receiving notifications from lower layers so that data
+ transfer succeed or failed, or NAS signalling connection is
+ released, or ESM unit data has been received from under layer,
+ and to request ESM unit data transfer to under layer.
+
+*****************************************************************************/
+
+#include "LowerLayer.h"
+#include "commonDef.h"
+#include "nas_log.h"
+
+#include "emmData.h"
+
+#include "emm_sap.h"
+#include "esm_sap.h"
+#include "nas_log.h"
+
+#include // memset
+
+/****************************************************************************/
+/**************** E X T E R N A L D E F I N I T I O N S ****************/
+/****************************************************************************/
+
+/****************************************************************************/
+/******************* L O C A L D E F I N I T I O N S *******************/
+/****************************************************************************/
+
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+/*
+ * --------------------------------------------------------------------------
+ * Lower layer notification handlers
+ * --------------------------------------------------------------------------
+ */
+
+/****************************************************************************
+ ** **
+ ** Name: lowerlayer_success() **
+ ** **
+ ** Description: Notify the EPS Mobility Management entity that data have **
+ ** been successfully delivered to the network **
+ ** **
+ ** Inputs: ueid: UE lower layer identifier **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int lowerlayer_success(unsigned int ueid)
+{
+ LOG_FUNC_IN;
+
+ emm_sap_t emm_sap;
+ int rc;
+
+ emm_sap.primitive = EMMREG_LOWERLAYER_SUCCESS;
+ emm_sap.u.emm_reg.ueid = ueid;
+ emm_sap.u.emm_reg.ctx = NULL;
+ rc = emm_sap_send(&emm_sap);
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: lowerlayer_failure() **
+ ** **
+ ** Description: Notify the EPS Mobility Management entity that lower la- **
+ ** yers failed to deliver data to the network **
+ ** **
+ ** Inputs: ueid: UE lower layer identifier **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int lowerlayer_failure(unsigned int ueid)
+{
+ LOG_FUNC_IN;
+
+ emm_sap_t emm_sap;
+ int rc;
+
+ emm_sap.primitive = EMMREG_LOWERLAYER_FAILURE;
+ emm_sap.u.emm_reg.ueid = ueid;
+#if defined(NAS_BUILT_IN_EPC)
+ emm_data_context_t *emm_ctx = NULL;
+ if (ueid > 0) {
+ emm_ctx = emm_data_context_get(&_emm_data, ueid);
+ }
+ emm_sap.u.emm_reg.ctx = emm_ctx;
+#else
+ emm_sap.u.emm_reg.ctx = NULL;
+#endif
+ rc = emm_sap_send(&emm_sap);
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: lowerlayer_establish() **
+ ** **
+ ** Description: Update the EPS connection management status upon recei- **
+ ** ving indication so that the NAS signalling connection is **
+ ** established **
+ ** **
+ ** Inputs: None **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int lowerlayer_establish(void)
+{
+ LOG_FUNC_IN;
+ LOG_FUNC_RETURN (RETURNok);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: lowerlayer_release() **
+ ** **
+ ** Description: Notify the EPS Mobility Management entity that NAS signal-**
+ ** ling connection has been released **
+ ** **
+ ** Inputs: cause: Release cause **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int lowerlayer_release(int cause)
+{
+ LOG_FUNC_IN;
+
+ emm_sap_t emm_sap;
+ int rc;
+
+ emm_sap.primitive = EMMREG_LOWERLAYER_RELEASE;
+ emm_sap.u.emm_reg.ueid = 0;
+ emm_sap.u.emm_reg.ctx = NULL;
+ rc = emm_sap_send(&emm_sap);
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: lowerlayer_data_ind() **
+ ** **
+ ** Description: Notify the EPS Session Management entity that data have **
+ ** been received from lower layers **
+ ** **
+ ** Inputs: ueid: UE lower layer identifier **
+ ** data: Data transfered from lower layers **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int lowerlayer_data_ind(unsigned int ueid, const OctetString *data)
+{
+ esm_sap_t esm_sap;
+ int rc;
+ emm_data_context_t *emm_ctx = NULL;
+
+ LOG_FUNC_IN;
+
+#if defined(NAS_BUILT_IN_EPC)
+ if (ueid > 0) {
+ emm_ctx = emm_data_context_get(&_emm_data, ueid);
+ }
+
+#endif
+
+ esm_sap.primitive = ESM_UNITDATA_IND;
+ esm_sap.is_standalone = TRUE;
+ esm_sap.ueid = ueid;
+ esm_sap.ctx = emm_ctx;
+ esm_sap.recv = data;
+ rc = esm_sap_send(&esm_sap);
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: lowerlayer_data_req() **
+ ** **
+ ** Description: Notify the EPS Mobility Management entity that data have **
+ ** to be transfered to lower layers **
+ ** **
+ ** Inputs: ueid: UE lower layer identifier **
+ ** data: Data to be transfered to lower layers **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int lowerlayer_data_req(unsigned int ueid, const OctetString *data)
+{
+ LOG_FUNC_IN;
+
+ int rc;
+ emm_sap_t emm_sap;
+ emm_security_context_t *sctx = NULL;
+ struct emm_data_context_s *ctx = NULL;
+
+ emm_sap.primitive = EMMAS_DATA_REQ;
+ emm_sap.u.emm_as.u.data.guti = NULL;
+ emm_sap.u.emm_as.u.data.ueid = ueid;
+# if defined(NAS_BUILT_IN_EPC)
+
+ if (ueid > 0) {
+ ctx = emm_data_context_get(&_emm_data, ueid);
+ }
+
+# else
+
+ if (ueid < EMM_DATA_NB_UE_MAX) {
+ ctx = _emm_data.ctx[ueid];
+ }
+
+# endif
+
+ if (ctx) {
+ sctx = ctx->security;
+ }
+ emm_sap.u.emm_as.u.data.NASinfo = 0;
+ emm_sap.u.emm_as.u.data.NASmsg.length = data->length;
+ emm_sap.u.emm_as.u.data.NASmsg.value = data->value;
+ /* Setup EPS NAS security data */
+ emm_as_set_security_data(&emm_sap.u.emm_as.u.data.sctx, sctx, FALSE, TRUE);
+ rc = emm_sap_send(&emm_sap);
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/*
+ * --------------------------------------------------------------------------
+ * EMM procedure handlers
+ * --------------------------------------------------------------------------
+ */
+
+/****************************************************************************
+ ** **
+ ** Name: emm_as_set_security_data() **
+ ** **
+ ** Description: Setup security data according to the given EPS security **
+ ** context when data transfer to lower layers is requested **
+ ** **
+ ** Inputs: args: EPS security context currently in use **
+ ** is_new: Indicates whether a new security context **
+ ** has just been taken into use **
+ ** is_ciphered: Indicates whether the NAS message has to **
+ ** be sent ciphered **
+ ** Others: None **
+ ** **
+ ** Outputs: data: EPS NAS security data to be setup **
+ ** Return: None **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+void emm_as_set_security_data(emm_as_security_data_t *data, const void *args,
+ int is_new, int is_ciphered)
+{
+ LOG_FUNC_IN;
+
+ const emm_security_context_t *context = (emm_security_context_t *)(args);
+
+ memset(data, 0, sizeof(emm_as_security_data_t));
+
+ if ( context && (context->type != EMM_KSI_NOT_AVAILABLE) ) {
+ /* 3GPP TS 24.301, sections 5.4.3.3 and 5.4.3.4
+ * Once a valid EPS security context exists and has been taken
+ * into use, UE and MME shall cipher and integrity protect all
+ * NAS signalling messages with the selected NAS ciphering and
+ * NAS integrity algorithms */
+ LOG_TRACE(INFO,
+ "EPS security context exists is new %u KSI %u SQN %u count %u",
+ is_new,
+ context->eksi,
+ context->ul_count.seq_num,
+ *(uint32_t *)(&context->ul_count));
+ LOG_TRACE(INFO,
+ "knas_int %s",dump_octet_string(&context->knas_int));
+ LOG_TRACE(INFO,
+ "knas_enc %s",dump_octet_string(&context->knas_enc));
+ LOG_TRACE(INFO,
+ "kasme %s",dump_octet_string(&context->kasme));
+
+ data->is_new = is_new;
+ data->ksi = context->eksi;
+ data->sqn = context->dl_count.seq_num;
+ // LG data->count = *(uint32_t *)(&context->ul_count);
+ data->count = 0x00000000 | (context->dl_count.overflow << 8 ) | context->dl_count.seq_num;
+ /* NAS integrity and cyphering keys may not be available if the
+ * current security context is a partial EPS security context
+ * and not a full native EPS security context */
+ data->k_int = &context->knas_int;
+
+ if (is_ciphered) {
+ /* 3GPP TS 24.301, sections 4.4.5
+ * When the UE establishes a new NAS signalling connection,
+ * it shall send initial NAS messages integrity protected
+ * and unciphered */
+ /* 3GPP TS 24.301, section 5.4.3.2
+ * The MME shall send the SECURITY MODE COMMAND message integrity
+ * protected and unciphered */
+ LOG_TRACE(WARNING,
+ "EPS security context exists knas_enc");
+ data->k_enc = &context->knas_enc;
+ }
+ } else {
+ LOG_TRACE(WARNING, "EMM_AS_NO_KEY_AVAILABLE");
+ /* No valid EPS security context exists */
+ data->ksi = EMM_AS_NO_KEY_AVAILABLE;
+ }
+
+ LOG_FUNC_OUT;
+}
+
+/****************************************************************************/
+/********************* L O C A L F U N C T I O N S *********************/
+/****************************************************************************/
+
diff --git a/openair-cn/NAS/MME/EMM/LowerLayer.h b/openair-cn/NAS/MME/EMM/LowerLayer.h
new file mode 100644
index 0000000000..a0cef2582b
--- /dev/null
+++ b/openair-cn/NAS/MME/EMM/LowerLayer.h
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+Source lowerlayer.h
+
+Version 0.1
+
+Date 2013/06/19
+
+Product NAS stack
+
+Subsystem EPS Mobility Management
+
+Author Frederic Maurel
+
+Description Defines EMM procedures executed by the Non-Access Stratum
+ upon receiving notifications from lower layers so that data
+ transfer succeed or failed, or NAS signalling connection is
+ released, or ESM unit data has been received from under layer,
+ and to request ESM unit data transfer to under layer.
+
+*****************************************************************************/
+#ifndef __LOWERLAYER_H__
+#define __LOWERLAYER_H__
+
+#include "OctetString.h"
+
+/****************************************************************************/
+/********************* G L O B A L C O N S T A N T S *******************/
+/****************************************************************************/
+
+
+/****************************************************************************/
+/************************ G L O B A L T Y P E S ************************/
+/****************************************************************************/
+
+/****************************************************************************/
+/******************** G L O B A L V A R I A B L E S ********************/
+/****************************************************************************/
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+int lowerlayer_success(unsigned int ueid);
+int lowerlayer_failure(unsigned int ueid);
+int lowerlayer_establish(void);
+int lowerlayer_release(int cause);
+
+int lowerlayer_data_ind(unsigned int ueid, const OctetString *data);
+int lowerlayer_data_req(unsigned int ueid, const OctetString *data);
+
+#endif /* __LOWERLAYER_H__*/
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/Makefile b/openair-cn/NAS/MME/EMM/Makefile
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/Makefile
rename to openair-cn/NAS/MME/EMM/Makefile
diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/network/COPYING b/openair-cn/NAS/MME/EMM/SAP/COPYING
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/api/network/COPYING
rename to openair-cn/NAS/MME/EMM/SAP/COPYING
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmCommonProcedureInitiated.c b/openair-cn/NAS/MME/EMM/SAP/EmmCommonProcedureInitiated.c
similarity index 99%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmCommonProcedureInitiated.c
rename to openair-cn/NAS/MME/EMM/SAP/EmmCommonProcedureInitiated.c
index 98495f7c43..91fad0d62f 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmCommonProcedureInitiated.c
+++ b/openair-cn/NAS/MME/EMM/SAP/EmmCommonProcedureInitiated.c
@@ -49,7 +49,6 @@ Description Implements the EPS Mobility Management procedures executed
*****************************************************************************/
-#ifdef NAS_MME
#include "emm_fsm.h"
#include "commonDef.h"
@@ -185,4 +184,3 @@ int EmmCommonProcedureInitiated(const emm_reg_t *evt)
/********************* L O C A L F U N C T I O N S *********************/
/****************************************************************************/
-#endif
diff --git a/openair-cn/NAS/MME/EMM/SAP/EmmDeregistered.c b/openair-cn/NAS/MME/EMM/SAP/EmmDeregistered.c
new file mode 100644
index 0000000000..627986ba14
--- /dev/null
+++ b/openair-cn/NAS/MME/EMM/SAP/EmmDeregistered.c
@@ -0,0 +1,157 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+
+Source EmmDeregistered.c
+
+Version 0.1
+
+Date 2012/10/03
+
+Product NAS stack
+
+Subsystem EPS Mobility Management
+
+Author Frederic Maurel
+
+Description Implements the EPS Mobility Management procedures executed
+ when the EMM-SAP is in EMM-DEREGISTERED state.
+
+ In EMM-DEREGISTERED state, no EMM context has been established
+ or the EMM context is marked as detached.
+ The UE shall start the attach or combined attach procedure to
+ establish an EMM context.
+
+ The MME may answer to an attach or a combined attach procedure
+ initiated by the UE. It may also answer to a tracking area
+ updating procedure or combined tracking area updating procedure
+ initiated by a UE if the EMM context is marked as detached.
+
+*****************************************************************************/
+
+#include "emm_fsm.h"
+#include "commonDef.h"
+#include "networkDef.h"
+#include "nas_log.h"
+
+#include "emm_proc.h"
+
+#include
+
+/****************************************************************************/
+/**************** E X T E R N A L D E F I N I T I O N S ****************/
+/****************************************************************************/
+
+/****************************************************************************/
+/******************* L O C A L D E F I N I T I O N S *******************/
+/****************************************************************************/
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+/****************************************************************************
+ ** **
+ ** Name: EmmDeregistered() **
+ ** **
+ ** Description: Handles the behaviour of the UE and the MME while the **
+ ** EMM-SAP is in EMM-DEREGISTERED state. **
+ ** **
+ ** 3GPP TS 24.301, section 5.2.2.2 **
+ ** **
+ ** Inputs: evt: The received EMM-SAP event **
+ ** Others: emm_fsm_status **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: emm_fsm_status **
+ ** **
+ ***************************************************************************/
+int EmmDeregistered(const emm_reg_t *evt)
+{
+ LOG_FUNC_IN;
+
+ int rc = RETURNerror;
+
+ assert(emm_fsm_get_status(evt->ueid, evt->ctx) == EMM_DEREGISTERED);
+
+ switch (evt->primitive) {
+
+ case _EMMREG_PROC_ABORT:
+ /*
+ * Ongoing EMM procedure aborted
+ */
+ rc = RETURNok;
+ break;
+
+ case _EMMREG_COMMON_PROC_REQ:
+ /*
+ * An EMM common procedure has been initiated;
+ * enter state EMM-COMMON-PROCEDURE-INITIATED.
+ */
+ rc = emm_fsm_set_status(evt->ueid, evt->ctx, EMM_COMMON_PROCEDURE_INITIATED);
+ break;
+
+ case _EMMREG_ATTACH_CNF:
+ /*
+ * Attach procedure successful and default EPS bearer
+ * context activated;
+ * enter state EMM-REGISTERED.
+ */
+ rc = emm_fsm_set_status(evt->ueid, evt->ctx, EMM_REGISTERED);
+ break;
+
+ case _EMMREG_LOWERLAYER_SUCCESS:
+ /*
+ * Data successfully delivered to the network
+ */
+ rc = RETURNok;
+ break;
+
+ case _EMMREG_LOWERLAYER_FAILURE:
+ /*
+ * Data failed to be delivered to the network
+ */
+ rc = RETURNok;
+ break;
+
+ default:
+ LOG_TRACE(ERROR, "EMM-FSM - Primitive is not valid (%d)",
+ evt->primitive);
+ break;
+ }
+
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************/
+/********************* L O C A L F U N C T I O N S *********************/
+/****************************************************************************/
+
diff --git a/openair-cn/NAS/MME/EMM/SAP/EmmDeregisteredAttachNeeded.c b/openair-cn/NAS/MME/EMM/SAP/EmmDeregisteredAttachNeeded.c
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/openair-cn/NAS/MME/EMM/SAP/EmmDeregisteredAttemptingToAttach.c b/openair-cn/NAS/MME/EMM/SAP/EmmDeregisteredAttemptingToAttach.c
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/openair-cn/NAS/MME/EMM/SAP/EmmDeregisteredInitiated.c b/openair-cn/NAS/MME/EMM/SAP/EmmDeregisteredInitiated.c
new file mode 100644
index 0000000000..74cb43fbb5
--- /dev/null
+++ b/openair-cn/NAS/MME/EMM/SAP/EmmDeregisteredInitiated.c
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+Source EmmDeregisteredInitiated.c
+
+Version 0.1
+
+Date 2012/10/03
+
+Product NAS stack
+
+Subsystem EPS Mobility Management
+
+Author Frederic Maurel
+
+Description Implements the EPS Mobility Management procedures executed
+ when the EMM-SAP is in EMM-DEREGISTERED-INITIATED state.
+
+ In EMM-DEREGISTERED-INITIATED state, the UE has requested
+ release of the EMM context by starting the detach or combined
+ detach procedure and is waiting for a response from the MME.
+ The MME has started a detach procedure and is waiting for a
+ response from the UE.
+
+*****************************************************************************/
+
+#include "emm_fsm.h"
+#include "commonDef.h"
+#include "nas_log.h"
+
+#include "emm_proc.h"
+
+#include
+
+/****************************************************************************/
+/**************** E X T E R N A L D E F I N I T I O N S ****************/
+/****************************************************************************/
+
+/****************************************************************************/
+/******************* L O C A L D E F I N I T I O N S *******************/
+/****************************************************************************/
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+/****************************************************************************
+ ** **
+ ** Name: EmmDeregisteredInitiated() **
+ ** **
+ ** Description: Handles the behaviour of the UE and the MME while the **
+ ** EMM-SAP is in EMM-DEREGISTERED-INITIATED state. **
+ ** **
+ ** Inputs: evt: The received EMM-SAP event **
+ ** Others: emm_fsm_status **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: emm_fsm_status **
+ ** **
+ ***************************************************************************/
+int EmmDeregisteredInitiated(const emm_reg_t *evt)
+{
+ LOG_FUNC_IN;
+
+ int rc = RETURNerror;
+
+ assert(emm_fsm_get_status(evt->ueid, evt->ctx) == EMM_DEREGISTERED_INITIATED);
+
+ switch (evt->primitive) {
+
+ default:
+ LOG_TRACE(ERROR, "EMM-FSM - Primitive is not valid (%d)",
+ evt->primitive);
+ break;
+ }
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************/
+/********************* L O C A L F U N C T I O N S *********************/
+/****************************************************************************/
+
diff --git a/openair-cn/NAS/MME/EMM/SAP/EmmDeregisteredLimitedService.c b/openair-cn/NAS/MME/EMM/SAP/EmmDeregisteredLimitedService.c
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/openair-cn/NAS/MME/EMM/SAP/EmmDeregisteredNoCellAvailable.c b/openair-cn/NAS/MME/EMM/SAP/EmmDeregisteredNoCellAvailable.c
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/openair-cn/NAS/MME/EMM/SAP/EmmDeregisteredNoImsi.c b/openair-cn/NAS/MME/EMM/SAP/EmmDeregisteredNoImsi.c
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/openair-cn/NAS/MME/EMM/SAP/EmmDeregisteredNormalService.c b/openair-cn/NAS/MME/EMM/SAP/EmmDeregisteredNormalService.c
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/openair-cn/NAS/MME/EMM/SAP/EmmDeregisteredPlmnSearch.c b/openair-cn/NAS/MME/EMM/SAP/EmmDeregisteredPlmnSearch.c
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/openair-cn/NAS/MME/EMM/SAP/EmmNull.c b/openair-cn/NAS/MME/EMM/SAP/EmmNull.c
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/openair-cn/NAS/MME/EMM/SAP/EmmRegistered.c b/openair-cn/NAS/MME/EMM/SAP/EmmRegistered.c
new file mode 100644
index 0000000000..5c311dc8ee
--- /dev/null
+++ b/openair-cn/NAS/MME/EMM/SAP/EmmRegistered.c
@@ -0,0 +1,153 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+Source EmmRegistered.c
+
+Version 0.1
+
+Date 2012/10/03
+
+Product NAS stack
+
+Subsystem EPS Mobility Management
+
+Author Frederic Maurel
+
+Description Implements the EPS Mobility Management procedures executed
+ when the EMM-SAP is in EMM-REGISTERED state.
+
+ In EMM-REGISTERED state, an EMM context has been established
+ and a default EPS bearer context has been activated in the UE
+ and the MME.
+ The UE may initiate sending and receiving user data and signal-
+ ling information and reply to paging. Additionally, tracking
+ area updating or combined tracking area updating procedure is
+ performed.
+
+*****************************************************************************/
+
+#include "emm_fsm.h"
+#include "commonDef.h"
+#include "networkDef.h"
+#include "nas_log.h"
+
+#include "emm_proc.h"
+
+#include
+
+/****************************************************************************/
+/**************** E X T E R N A L D E F I N I T I O N S ****************/
+/****************************************************************************/
+
+/****************************************************************************/
+/******************* L O C A L D E F I N I T I O N S *******************/
+/****************************************************************************/
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+/****************************************************************************
+ ** **
+ ** Name: EmmRegistered() **
+ ** **
+ ** Description: Handles the behaviour of the UE and the MME while the **
+ ** EMM-SAP is in EMM-REGISTERED state. **
+ ** **
+ ** Inputs: evt: The received EMM-SAP event **
+ ** Others: emm_fsm_status **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: emm_fsm_status **
+ ** **
+ ***************************************************************************/
+int EmmRegistered(const emm_reg_t *evt)
+{
+ LOG_FUNC_IN;
+
+ int rc = RETURNerror;
+
+ assert(emm_fsm_get_status(evt->ueid, evt->ctx) == EMM_REGISTERED);
+
+ switch (evt->primitive) {
+
+
+
+ case _EMMREG_DETACH_REQ:
+ /*
+ * Network detach has been requested (implicit detach);
+ * enter state EMM-DEREGISTERED
+ */
+ rc = emm_fsm_set_status(evt->ueid, evt->ctx, EMM_DEREGISTERED);
+ break;
+
+ case _EMMREG_COMMON_PROC_REQ:
+ /*
+ * An EMM common procedure has been initiated;
+ * enter state EMM-COMMON-PROCEDURE-INITIATED.
+ */
+ rc = emm_fsm_set_status(evt->ueid, evt->ctx, EMM_COMMON_PROCEDURE_INITIATED);
+ break;
+
+ case _EMMREG_TAU_REJ:
+ /*
+ * TODO: Tracking Area Update has been rejected
+ */
+ LOG_TRACE(ERROR, "EMM-FSM - Tracking Area Update procedure "
+ "is not implemented");
+ break;
+
+ case _EMMREG_LOWERLAYER_SUCCESS:
+ /*
+ * Data successfully delivered to the network
+ */
+ rc = RETURNok;
+ break;
+
+ case _EMMREG_LOWERLAYER_FAILURE:
+ /*
+ * Data failed to be delivered to the network
+ */
+ rc = RETURNok;
+ break;
+
+ default:
+ LOG_TRACE(ERROR, "EMM-FSM - Primitive is not valid (%d)",
+ evt->primitive);
+ break;
+ }
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************/
+/********************* L O C A L F U N C T I O N S *********************/
+/****************************************************************************/
+
diff --git a/openair-cn/NAS/MME/EMM/SAP/EmmRegisteredAttemptingToUpdate.c b/openair-cn/NAS/MME/EMM/SAP/EmmRegisteredAttemptingToUpdate.c
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/openair-cn/NAS/MME/EMM/SAP/EmmRegisteredImsiDetachInitiated.c b/openair-cn/NAS/MME/EMM/SAP/EmmRegisteredImsiDetachInitiated.c
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/openair-cn/NAS/MME/EMM/SAP/EmmRegisteredInitiated.c b/openair-cn/NAS/MME/EMM/SAP/EmmRegisteredInitiated.c
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/openair-cn/NAS/MME/EMM/SAP/EmmRegisteredLimitedService.c b/openair-cn/NAS/MME/EMM/SAP/EmmRegisteredLimitedService.c
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/openair-cn/NAS/MME/EMM/SAP/EmmRegisteredNoCellAvailable.c b/openair-cn/NAS/MME/EMM/SAP/EmmRegisteredNoCellAvailable.c
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/openair-cn/NAS/MME/EMM/SAP/EmmRegisteredNormalService.c b/openair-cn/NAS/MME/EMM/SAP/EmmRegisteredNormalService.c
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/openair-cn/NAS/MME/EMM/SAP/EmmRegisteredPlmnSearch.c b/openair-cn/NAS/MME/EMM/SAP/EmmRegisteredPlmnSearch.c
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/openair-cn/NAS/MME/EMM/SAP/EmmRegisteredUpdateNeeded.c b/openair-cn/NAS/MME/EMM/SAP/EmmRegisteredUpdateNeeded.c
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/openair-cn/NAS/MME/EMM/SAP/EmmServiceRequestInitiated.c b/openair-cn/NAS/MME/EMM/SAP/EmmServiceRequestInitiated.c
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/openair-cn/NAS/MME/EMM/SAP/EmmTrackingAreaUpdatingInitiated.c b/openair-cn/NAS/MME/EMM/SAP/EmmTrackingAreaUpdatingInitiated.c
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/Makefile b/openair-cn/NAS/MME/EMM/SAP/Makefile
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/sap/Makefile
rename to openair-cn/NAS/MME/EMM/SAP/Makefile
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_as.c b/openair-cn/NAS/MME/EMM/SAP/emm_as.c
similarity index 74%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_as.c
rename to openair-cn/NAS/MME/EMM/SAP/emm_as.c
index 12f1874e6c..882c9e800e 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_as.c
+++ b/openair-cn/NAS/MME/EMM/SAP/emm_as.c
@@ -63,7 +63,7 @@ Description Defines the EMMAS Service Access Point that provides
#include // memset
#include // malloc, free
-#if (defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(NAS_BUILT_IN_UE) && defined(NAS_UE))
+#if defined(NAS_BUILT_IN_EPC)
# include "nas_itti_messaging.h"
#endif
#include "msc.h"
@@ -72,9 +72,6 @@ Description Defines the EMMAS Service Access Point that provides
/**************** E X T E R N A L D E F I N I T I O N S ****************/
/****************************************************************************/
-#ifdef NAS_UE
-extern int emm_proc_plmn_selection_end(int found, tac_t tac, ci_t ci, AcT_t rat);
-#endif
extern int emm_proc_status(unsigned int ueid, int emm_cause);
@@ -111,20 +108,10 @@ static const char *_emm_as_primitive_str[] = {
static int _emm_as_recv(unsigned int ueid, const char *msg, int len,
int *emm_cause);
-#ifdef NAS_UE
-static int _emm_as_establish_cnf(const emm_as_establish_t *msg, int *emm_cause);
-static int _emm_as_establish_rej(void);
-static int _emm_as_release_ind(const emm_as_release_t *msg);
-static int _emm_as_page_ind(const emm_as_page_t *msg);
-#endif
-#ifdef NAS_MME
static int _emm_as_establish_req(const emm_as_establish_t *msg, int *emm_cause);
-#endif
-
static int _emm_as_cell_info_res(const emm_as_cell_info_t *msg);
static int _emm_as_cell_info_ind(const emm_as_cell_info_t *msg);
-
static int _emm_as_data_ind(const emm_as_data_t *msg, int *emm_cause);
/*
@@ -149,14 +136,6 @@ static int _emm_as_encrypt(
static int _emm_as_send(const emm_as_t *msg);
-#ifdef NAS_UE
-static int _emm_as_security_res(const emm_as_security_t *,
- ul_info_transfer_req_t *);
-static int _emm_as_establish_req(const emm_as_establish_t *,
- nas_establish_req_t *);
-#endif
-
-#ifdef NAS_MME
static int _emm_as_security_req(const emm_as_security_t *,
dl_info_transfer_req_t *);
static int _emm_as_security_rej(const emm_as_security_t *,
@@ -166,7 +145,6 @@ static int _emm_as_establish_cnf(const emm_as_establish_t *,
static int _emm_as_establish_rej(const emm_as_establish_t *,
nas_establish_rsp_t *);
static int _emm_as_page_ind(const emm_as_page_t *, paging_req_t *);
-#endif
static int _emm_as_cell_info_req(const emm_as_cell_info_t *, cell_info_req_t *);
@@ -223,7 +201,7 @@ int emm_as_send(const emm_as_t *msg)
int emm_cause = EMM_CAUSE_SUCCESS;
emm_as_primitive_t primitive = msg->primitive;
- UInt32_t ueid = 0;
+ uint32_t ueid = 0;
LOG_TRACE(INFO, "EMMAS-SAP - Received primitive %s (%d)",
_emm_as_primitive_str[primitive - _EMMAS_START - 1], primitive);
@@ -234,31 +212,10 @@ int emm_as_send(const emm_as_t *msg)
ueid = msg->u.data.ueid;
break;
-#ifdef NAS_UE
-
- case _EMMAS_ESTABLISH_CNF:
- rc = _emm_as_establish_cnf(&msg->u.establish, &emm_cause);
- break;
-
- case _EMMAS_ESTABLISH_REJ:
- rc = _emm_as_establish_rej();
- break;
-
- case _EMMAS_RELEASE_IND:
- rc = _emm_as_release_ind(&msg->u.release);
- break;
-
- case _EMMAS_PAGE_IND:
- rc = _emm_as_page_ind(&msg->u.page);
- break;
-#endif
-#ifdef NAS_MME
-
case _EMMAS_ESTABLISH_REQ:
rc = _emm_as_establish_req(&msg->u.establish, &emm_cause);
ueid = msg->u.establish.ueid;
break;
-#endif
case _EMMAS_CELL_INFO_RES:
rc = _emm_as_cell_info_res(&msg->u.cell_info);
@@ -356,7 +313,6 @@ static int _emm_as_recv(unsigned int ueid, const char *msg, int len,
memset(&nas_msg, 0 , sizeof(nas_message_t));
emm_security_context_t *security = NULL; /* Current EPS NAS security context */
-#if defined(NAS_MME)
#if defined(NAS_BUILT_IN_EPC)
emm_data_context_t *emm_ctx = NULL;
#endif
@@ -378,9 +334,6 @@ static int _emm_as_recv(unsigned int ueid, const char *msg, int len,
}
}
-#endif
-#else /* NAS_MME */
- security = _emm_data.security;
#endif
/* Decode the received message */
@@ -401,50 +354,6 @@ static int _emm_as_recv(unsigned int ueid, const char *msg, int len,
rc = emm_recv_status(ueid, &emm_msg->emm_status, emm_cause);
break;
-#ifdef NAS_UE
-
- case IDENTITY_REQUEST:
- rc = emm_recv_identity_request(&emm_msg->identity_request,
- emm_cause);
- break;
-
- case AUTHENTICATION_REQUEST:
- rc = emm_recv_authentication_request(
- &emm_msg->authentication_request,
- emm_cause);
- break;
-
- case AUTHENTICATION_REJECT:
- rc = emm_recv_authentication_reject(
- &emm_msg->authentication_reject,
- emm_cause);
- break;
-
- case SECURITY_MODE_COMMAND:
- rc = emm_recv_security_mode_command(
- &emm_msg->security_mode_command,
- emm_cause);
- break;
-
- case DETACH_ACCEPT:
- rc = emm_recv_detach_accept(&emm_msg->detach_accept, emm_cause);
- break;
-#endif
-
-#ifdef NAS_UE
-
- case TRACKING_AREA_UPDATE_ACCEPT:
- case TRACKING_AREA_UPDATE_REJECT:
- case SERVICE_REJECT:
- case GUTI_REALLOCATION_COMMAND:
- case EMM_INFORMATION:
- case DOWNLINK_NAS_TRANSPORT:
- case CS_SERVICE_NOTIFICATION:
- /* TODO */
- break;
-#endif
-#ifdef NAS_MME
-
case ATTACH_REQUEST:
rc = emm_recv_attach_request(
ueid,
@@ -501,7 +410,6 @@ static int _emm_as_recv(unsigned int ueid, const char *msg, int len,
rc = emm_recv_detach_request(ueid, &emm_msg->detach_request,
emm_cause);
break;
-#endif
default:
LOG_TRACE(WARNING, "EMMAS-SAP - EMM message 0x%x is not valid",
@@ -537,7 +445,7 @@ static int _emm_as_data_ind(const emm_as_data_t *msg, int *emm_cause)
int rc = RETURNerror;
LOG_TRACE(INFO, "EMMAS-SAP - Received AS data transfer indication "
- "(ueid=%u, delivered=%s, length=%d)", msg->ueid,
+ "(ueid="NAS_UE_ID_FMT", delivered=%s, length=%d)", msg->ueid,
(msg->delivered)? "TRUE" : "FALSE", msg->NASmsg.length);
if (msg->delivered) {
@@ -551,7 +459,6 @@ static int _emm_as_data_ind(const emm_as_data_t *msg, int *emm_cause)
memset(&header, 0, sizeof(header));
/* Decrypt the received security protected message */
-#if defined(NAS_MME)
emm_data_context_t *emm_ctx = NULL;
#if defined(NAS_BUILT_IN_EPC)
@@ -573,9 +480,6 @@ static int _emm_as_data_ind(const emm_as_data_t *msg, int *emm_cause)
}
}
-#endif
-#else
- security = _emm_data.security;
#endif
int bytes = nas_message_decrypt((char *)(msg->NASmsg.value),
plain_msg,
@@ -613,184 +517,6 @@ static int _emm_as_data_ind(const emm_as_data_t *msg, int *emm_cause)
LOG_FUNC_RETURN (rc);
}
-#ifdef NAS_UE
-/****************************************************************************
- ** **
- ** Name: _emm_as_establish_cnf() **
- ** **
- ** Description: Processes the EMMAS-SAP connection establish confirmation **
- ** primitive **
- ** **
- ** EMMAS-SAP - AS->EMM: ESTABLISH_CNF - NAS signalling connection **
- ** **
- ** Inputs: msg: The EMMAS-SAP primitive to process **
- ** Others: None **
- ** **
- ** Outputs: emm_cause: EMM cause code **
- ** Return: RETURNok, RETURNerror **
- ** Others: None **
- ** **
- ***************************************************************************/
-static int _emm_as_establish_cnf(const emm_as_establish_t *msg,
- int *emm_cause)
-{
- LOG_FUNC_IN;
-
- int decoder_rc;
- int rc = RETURNerror;
-
- LOG_TRACE(INFO, "EMMAS-SAP - Received AS connection establish confirm");
-
- if (msg->NASmsg.length > 0) {
- /* The NAS signalling connection is established */
- (void) lowerlayer_establish();
- } else {
- /* The initial NAS message has been successfully delivered to
- * lower layers */
- rc = lowerlayer_success(0);
- LOG_FUNC_RETURN (rc);
- }
-
- nas_message_t nas_msg;
- memset(&nas_msg, 0 , sizeof(nas_message_t));
-
- /* Decode initial NAS message */
- decoder_rc = nas_message_decode((char *)(msg->NASmsg.value),
- &nas_msg,
- msg->NASmsg.length,
- _emm_data.security);
-
- if (decoder_rc < 0) {
- LOG_TRACE(WARNING, "EMMAS-SAP - Failed to decode initial NAS message"
- "(err=%d)", decoder_rc);
- *emm_cause = EMM_CAUSE_PROTOCOL_ERROR;
- LOG_FUNC_RETURN (decoder_rc);
- }
-
- /* Process initial NAS message */
- EMM_msg *emm_msg = &nas_msg.plain.emm;
-
- switch (emm_msg->header.message_type) {
- case ATTACH_ACCEPT:
- rc = emm_recv_attach_accept(&emm_msg->attach_accept, emm_cause);
- break;
-
- case ATTACH_REJECT:
- rc = emm_recv_attach_reject(&emm_msg->attach_reject, emm_cause);
- break;
-
- case DETACH_ACCEPT:
- break;
-
- case TRACKING_AREA_UPDATE_ACCEPT:
- break;
-
- default:
- LOG_TRACE(WARNING, "EMMAS-SAP - Initial NAS message 0x%x is "
- "not valid", emm_msg->header.message_type);
- *emm_cause = EMM_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE;
- break;
- }
-
- LOG_FUNC_RETURN (rc);
-}
-
-/****************************************************************************
- ** **
- ** Name: _emm_as_establish_rej() **
- ** **
- ** Description: Processes the EMMAS-SAP connection establish reject **
- ** primitive **
- ** **
- ** EMMAS-SAP - AS->EMM: ESTABLISH_REJ - NAS signalling connection **
- ** **
- ** Inputs: None **
- ** Others: None **
- ** **
- ** Outputs: None **
- ** Return: RETURNok, RETURNerror **
- ** Others: None **
- ** **
- ***************************************************************************/
-static int _emm_as_establish_rej(void)
-{
- LOG_FUNC_IN;
-
- int rc;
-
- LOG_TRACE(INFO, "EMMAS-SAP - Received AS initial NAS message transmission "
- "failure");
-
- /* Process lower layer transmission failure of initial NAS message */
- rc = lowerlayer_failure(0);
-
- LOG_FUNC_RETURN (rc);
-}
-
-/****************************************************************************
- ** **
- ** Name: _emm_as_release_ind() **
- ** **
- ** Description: Processes the EMMAS-SAP connection release indication **
- ** primitive **
- ** **
- ** EMMAS-SAP - AS->EMM: RELEASE_IND - NAS signalling release procedure **
- ** **
- ** Inputs: msg: The EMMAS-SAP primitive to process **
- ** Others: None **
- ** **
- ** Outputs: None **
- ** Return: RETURNok, RETURNerror **
- ** Others: None **
- ** **
- ***************************************************************************/
-static int _emm_as_release_ind(const emm_as_release_t *msg)
-{
- LOG_FUNC_IN;
-
- int rc = RETURNok;
-
- LOG_TRACE(INFO, "EMMAS-SAP - Received AS connection release indication "
- "(cause=%d)", msg->cause);
-
- /* Process NAS signalling connection release indication */
- rc = lowerlayer_release(msg->cause);
-
- LOG_FUNC_RETURN (rc);
-}
-
-/****************************************************************************
- ** **
- ** Name: _emm_as_page_ind() **
- ** **
- ** Description: Processes the EMMAS-SAP paging data indication primitive **
- ** **
- ** EMMAS-SAP - AS->EMM: PAGE_IND - Paging data procedure **
- ** **
- ** Inputs: msg: The EMMAS-SAP primitive to process **
- ** Others: None **
- ** **
- ** Outputs: None **
- ** Return: RETURNok, RETURNerror **
- ** Others: None **
- ** **
- ***************************************************************************/
-static int _emm_as_page_ind(const emm_as_page_t *msg)
-{
- LOG_FUNC_IN;
-
- int rc = RETURNok;
-
- LOG_TRACE(INFO, "EMMAS-SAP - Received AS paging data indication");
-
- /* TODO */
-
- LOG_FUNC_RETURN (rc);
-}
-
-#endif
-
-#ifdef NAS_MME
/****************************************************************************
** **
** Name: _emm_as_establish_req() **
@@ -825,7 +551,6 @@ static int _emm_as_establish_req(const emm_as_establish_t *msg, int *emm_cause)
nas_message_t nas_msg;
memset(&nas_msg, 0 , sizeof(nas_message_t));
-#if defined(NAS_MME)
#if defined(NAS_BUILT_IN_EPC)
emm_ctx = emm_data_context_get(&_emm_data, msg->ueid);
#else
@@ -840,11 +565,6 @@ static int _emm_as_establish_req(const emm_as_establish_t *msg, int *emm_cause)
emm_security_context = emm_ctx->security;
}
-#else /* NAS_MME */
- security = _emm_data.security;
-#endif
-
-
/* Decode initial NAS message */
decoder_rc = nas_message_decode(
(char *)(msg->NASmsg.value),
@@ -900,7 +620,6 @@ static int _emm_as_establish_req(const emm_as_establish_t *msg, int *emm_cause)
LOG_FUNC_RETURN (rc);
}
-#endif
/****************************************************************************
** **
@@ -931,23 +650,7 @@ static int _emm_as_cell_info_res(const emm_as_cell_info_t *msg)
LOG_TRACE(INFO, "EMMAS-SAP - Received AS cell information response");
-#ifdef NAS_UE
- int AcT = NET_ACCESS_EUTRAN;
- if (msg->found == TRUE) {
- /* Get the first supported access technology */
- while (AcT != NET_ACCESS_UNAVAILABLE) {
- if (msg->rat & (1 << AcT)) {
- break;
- }
-
- AcT -= 1;
- }
- }
-
- /* Notify EMM that a cell has been found */
- rc = emm_proc_plmn_selection_end(msg->found, msg->tac, msg->cellID, AcT);
-#endif
LOG_FUNC_RETURN (rc);
}
@@ -1216,23 +919,6 @@ static int _emm_as_send(const emm_as_t *msg)
&as_msg.msg.nas_release_req);
break;
-#ifdef NAS_UE
-
- case _EMMAS_SECURITY_RES:
- as_msg.msgID = _emm_as_security_res(
- &msg->u.security,
- &as_msg.msg.ul_info_transfer_req);
- break;
-
- case _EMMAS_ESTABLISH_REQ:
- as_msg.msgID = _emm_as_establish_req(
- &msg->u.establish,
- &as_msg.msg.nas_establish_req);
- break;
-
-#endif
-#ifdef NAS_MME
-
case _EMMAS_SECURITY_REQ:
as_msg.msgID = _emm_as_security_req(
&msg->u.security,
@@ -1262,7 +948,6 @@ static int _emm_as_send(const emm_as_t *msg)
&as_msg.msg.paging_req);
break;
-#endif
case _EMMAS_CELL_INFO_REQ:
as_msg.msgID = _emm_as_cell_info_req(&msg->u.cell_info,
@@ -1280,7 +965,7 @@ static int _emm_as_send(const emm_as_t *msg)
/* Send the message to the Access Stratum or S1AP in case of MME */
if (as_msg.msgID > 0) {
-#if defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)
+#if defined(NAS_BUILT_IN_EPC)
LOG_TRACE(DEBUG, "EMMAS-SAP - "
"Sending msg with id 0x%x, primitive %s (%d) to S1AP layer for transmission",
as_msg.msgID,
@@ -1307,7 +992,7 @@ static int _emm_as_send(const emm_as_t *msg)
LOG_FUNC_RETURN (RETURNok);
} else {
LOG_TRACE(DEBUG, "EMMAS-SAP - "
- "Sending nas_itti_establish_cnf to S1AP UE ID %d"
+ "Sending nas_itti_establish_cnf to S1AP UE ID 0x%x"
" selected_encryption_algorithm 0x%04X",
" selected_integrity_algorithm 0x%04X",
as_msg.msg.nas_establish_rsp.UEid,
@@ -1330,65 +1015,6 @@ static int _emm_as_send(const emm_as_t *msg)
break;
}
-#else
-# if defined(NAS_BUILT_IN_UE) && defined(NAS_UE)
- LOG_TRACE(DEBUG, "EMMAS-SAP - "
- "Sending msg with id 0x%x, primitive %s (%d) to RRC layer for transmission",
- as_msg.msgID,
- _emm_as_primitive_str[msg->primitive - _EMMAS_START - 1],
- msg->primitive);
-
- switch (as_msg.msgID) {
- case AS_CELL_INFO_REQ: {
- nas_itti_cell_info_req(
- as_msg.msg.cell_info_req.plmnID,
- as_msg.msg.cell_info_req.rat);
- LOG_FUNC_RETURN (RETURNok);
- }
- break;
-
- case AS_NAS_ESTABLISH_REQ: {
- nas_itti_nas_establish_req(
- as_msg.msg.nas_establish_req.cause,
- as_msg.msg.nas_establish_req.type,
- as_msg.msg.nas_establish_req.s_tmsi,
- as_msg.msg.nas_establish_req.plmnID,
- as_msg.msg.nas_establish_req.initialNasMsg.data,
- as_msg.msg.nas_establish_req.initialNasMsg.length);
- LOG_FUNC_RETURN (RETURNok);
- }
- break;
-
- case AS_UL_INFO_TRANSFER_REQ: {
- nas_itti_ul_data_req(
- as_msg.msg.ul_info_transfer_req.UEid,
- as_msg.msg.ul_info_transfer_req.nasMsg.data,
- as_msg.msg.ul_info_transfer_req.nasMsg.length);
- LOG_FUNC_RETURN (RETURNok);
- }
- break;
-
- case AS_RAB_ESTABLISH_RSP: {
- nas_itti_rab_establish_rsp(
- as_msg.msg.rab_establish_rsp.s_tmsi,
- as_msg.msg.rab_establish_rsp.rabID,
- as_msg.msg.rab_establish_rsp.errCode);
- LOG_FUNC_RETURN (RETURNok);
- }
- break;
-
- default:
- break;
- }
-
-# else
- int bytes = as_message_send(&as_msg);
-
- if (bytes > 0) {
- LOG_FUNC_RETURN (RETURNok);
- }
-
-# endif
#endif
}
@@ -1438,23 +1064,10 @@ static int _emm_as_data_req(const emm_as_data_t *msg,
/* Setup the NAS information message */
if (emm_msg != NULL) switch (msg->NASinfo) {
-#ifdef NAS_UE
-
- case EMM_AS_NAS_DATA_ATTACH:
- size = emm_send_attach_complete(msg, &emm_msg->attach_complete);
- break;
-
- case EMM_AS_NAS_DATA_DETACH:
- size = emm_send_detach_request(msg, &emm_msg->detach_request);
- break;
-#endif
-
-#ifdef NAS_MME
case EMM_AS_NAS_DATA_DETACH:
size = emm_send_detach_accept(msg, &emm_msg->detach_accept);
break;
-#endif
default:
/* Send other NAS messages as already encoded ESM messages */
@@ -1466,7 +1079,6 @@ static int _emm_as_data_req(const emm_as_data_t *msg,
if (size > 0) {
int bytes;
emm_security_context_t *emm_security_context = NULL;
-#if defined(NAS_MME)
struct emm_data_context_s *emm_ctx = NULL;
#if defined(NAS_BUILT_IN_EPC)
emm_ctx = emm_data_context_get(&_emm_data, msg->ueid);
@@ -1482,16 +1094,10 @@ static int _emm_as_data_req(const emm_as_data_t *msg,
emm_security_context = emm_ctx->security;
}
-#else
- emm_security_context = _emm_data.security;
-#endif
+
if (emm_security_context) {
-#ifdef NAS_MME
nas_msg.header.sequence_number = emm_security_context->dl_count.seq_num;
-#else
- nas_msg.header.sequence_number = emm_security_context->ul_count.seq_num;
-#endif
LOG_TRACE(DEBUG,
"Set nas_msg.header.sequence_number -> %u",
nas_msg.header.sequence_number);
@@ -1513,12 +1119,7 @@ static int _emm_as_data_req(const emm_as_data_t *msg,
}
if (bytes > 0) {
-#ifdef NAS_UE
- LOG_FUNC_RETURN (AS_UL_INFO_TRANSFER_REQ);
-#endif
-#ifdef NAS_MME
LOG_FUNC_RETURN (AS_DL_INFO_TRANSFER_REQ);
-#endif
}
}
@@ -1572,7 +1173,6 @@ static int _emm_as_status_ind(const emm_as_status_t *msg,
if (size > 0) {
emm_security_context_t *emm_security_context = NULL;
-#if defined(NAS_MME)
struct emm_data_context_s *emm_ctx = NULL;
#if defined(NAS_BUILT_IN_EPC)
emm_ctx = emm_data_context_get(&_emm_data, msg->ueid);
@@ -1588,16 +1188,8 @@ static int _emm_as_status_ind(const emm_as_status_t *msg,
emm_security_context = emm_ctx->security;
}
-#else
- emm_security_context = _emm_data.security;
-#endif
-
if (emm_security_context) {
-#ifdef NAS_MME
nas_msg.header.sequence_number = emm_security_context->dl_count.seq_num;
-#else
- nas_msg.header.sequence_number = emm_security_context->ul_count.seq_num;
-#endif
LOG_TRACE(DEBUG,
"Set nas_msg.header.sequence_number -> %u",
nas_msg.header.sequence_number);
@@ -1611,12 +1203,7 @@ static int _emm_as_status_ind(const emm_as_status_t *msg,
emm_security_context);
if (bytes > 0) {
-#ifdef NAS_UE
- LOG_FUNC_RETURN (AS_UL_INFO_TRANSFER_REQ);
-#endif
-#ifdef NAS_MME
LOG_FUNC_RETURN (AS_DL_INFO_TRANSFER_REQ);
-#endif
}
}
@@ -1664,193 +1251,7 @@ static int _emm_as_release_req(const emm_as_release_t *msg,
LOG_FUNC_RETURN (AS_NAS_RELEASE_REQ);
}
-#ifdef NAS_UE
-/****************************************************************************
- ** **
- ** Name: _emm_as_security_res() **
- ** **
- ** Description: Processes the EMMAS-SAP security response primitive **
- ** **
- ** EMMAS-SAP - EMM->AS: SECURITY_RES - Security mode control procedure **
- ** **
- ** Inputs: msg: The EMMAS-SAP primitive to process **
- ** Others: None **
- ** **
- ** Outputs: as_msg: The message to send to the AS **
- ** Return: The identifier of the AS message **
- ** Others: None **
- ** **
- ***************************************************************************/
-static int _emm_as_security_res(const emm_as_security_t *msg,
- ul_info_transfer_req_t *as_msg)
-{
- LOG_FUNC_IN;
- int size = 0;
-
- LOG_TRACE(INFO, "EMMAS-SAP - Send AS security response");
-
- nas_message_t nas_msg;
- memset(&nas_msg, 0 , sizeof(nas_message_t));
-
- /* Setup the AS message */
- if (msg->guti) {
- as_msg->s_tmsi.MMEcode = msg->guti->gummei.MMEcode;
- as_msg->s_tmsi.m_tmsi = msg->guti->m_tmsi;
- }
-
- /* Setup the NAS security header */
- EMM_msg *emm_msg = _emm_as_set_header(&nas_msg, &msg->sctx);
-
- /* Setup the NAS security message */
- if (emm_msg != NULL) switch (msg->msgType) {
- case EMM_AS_MSG_TYPE_IDENT:
- size = emm_send_identity_response(
- msg,
- &emm_msg->identity_response);
- break;
-
- case EMM_AS_MSG_TYPE_AUTH:
- if (msg->emm_cause != EMM_CAUSE_SUCCESS) {
- size = emm_send_authentication_failure(
- msg,
- &emm_msg->authentication_failure);
- } else {
- size = emm_send_authentication_response(
- msg,
- &emm_msg->authentication_response);
- }
-
- break;
-
- case EMM_AS_MSG_TYPE_SMC:
- if (msg->emm_cause != EMM_CAUSE_SUCCESS) {
- size = emm_send_security_mode_reject(
- msg,
- &emm_msg->security_mode_reject);
- } else {
- size = emm_send_security_mode_complete(
- msg,
- &emm_msg->security_mode_complete);
- }
-
- break;
-
- default:
- LOG_TRACE(WARNING, "EMMAS-SAP - Type of NAS security "
- "message 0x%.2x is not valid", msg->msgType);
- }
-
- if (size > 0) {
- /* Encode the NAS security message */
- int bytes = _emm_as_encode(&as_msg->nasMsg,
- &nas_msg,
- size,
- _emm_data.security);
-
- if (bytes > 0) {
- LOG_FUNC_RETURN (AS_UL_INFO_TRANSFER_REQ);
- }
- }
-
- LOG_FUNC_RETURN (0);
-}
-
-/****************************************************************************
- ** **
- ** Name: _emm_as_establish_req() **
- ** **
- ** Description: Processes the EMMAS-SAP connection establish request **
- ** primitive **
- ** **
- ** EMMAS-SAP - EMM->AS: ESTABLISH_REQ - NAS signalling connection **
- ** The NAS requests the AS to establish signalling connection **
- ** to tranfer initial NAS message to the network. **
- ** **
- ** Inputs: msg: The EMMAS-SAP primitive to process **
- ** Others: None **
- ** **
- ** Outputs: as_msg: The message to send to the AS **
- ** Return: The identifier of the AS message **
- ** Others: None **
- ** **
- ***************************************************************************/
-static int _emm_as_establish_req(const emm_as_establish_t *msg,
- nas_establish_req_t *as_msg)
-{
- LOG_FUNC_IN;
-
- int size = 0;
-
- LOG_TRACE(INFO, "EMMAS-SAP - Send AS connection establish request");
-
- nas_message_t nas_msg;
- memset(&nas_msg, 0 , sizeof(nas_message_t));
-
- /* Setup the AS message */
- as_msg->cause = msg->RRCcause;
- as_msg->type = msg->RRCtype;
- as_msg->plmnID = *msg->plmnID;
-
- /* Derive the S-TMSI from the GUTI, if valid */
- if (msg->UEid.guti) {
- as_msg->s_tmsi.MMEcode = msg->UEid.guti->gummei.MMEcode;
- as_msg->s_tmsi.m_tmsi = msg->UEid.guti->m_tmsi;
- }
-
- /* Setup the NAS security header */
- EMM_msg *emm_msg = _emm_as_set_header(&nas_msg, &msg->sctx);
-
- /* Setup the initial NAS information message */
- if (emm_msg != NULL) switch (msg->NASinfo) {
- case EMM_AS_NAS_INFO_ATTACH:
- size = emm_send_attach_request(msg, &emm_msg->attach_request);
- break;
-
- case EMM_AS_NAS_INFO_DETACH:
- size = emm_send_initial_detach_request(msg,
- &emm_msg->detach_request);
- break;
-
- case EMM_AS_NAS_INFO_TAU:
- size = emm_send_initial_tau_request(msg,
- &emm_msg->tracking_area_update_request);
- break;
-
- case EMM_AS_NAS_INFO_SR:
- size = emm_send_initial_sr_request(msg,
- &emm_msg->service_request);
- break;
-
- case EMM_AS_NAS_INFO_EXTSR:
- size = emm_send_initial_extsr_request(msg,
- &emm_msg->extended_service_request);
- break;
-
- default:
- LOG_TRACE(WARNING, "EMMAS-SAP - Type of initial NAS "
- "message 0x%.2x is not valid", msg->NASinfo);
- break;
- }
-
- if (size > 0) {
- /* Encode the initial NAS information message */
- int bytes = _emm_as_encode(
- &as_msg->initialNasMsg,
- &nas_msg,
- size,
- _emm_data.security);
-
- if (bytes > 0) {
- LOG_FUNC_RETURN (AS_NAS_ESTABLISH_REQ);
- }
- }
-
- LOG_FUNC_RETURN (0);
-}
-#endif // NAS_UE
-
-#ifdef NAS_MME
/****************************************************************************
** **
** Name: _emm_as_security_req() **
@@ -1894,9 +1295,9 @@ static int _emm_as_security_req(const emm_as_security_t *msg,
if (emm_msg != NULL) switch (msg->msgType) {
case EMM_AS_MSG_TYPE_IDENT:
if (msg->guti) {
- MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send IDENTITY_REQUEST to s_TMSI %u.%u ", as_msg->s_tmsi.MMEcode, as_msg->s_tmsi.m_tmsi);
+ MSC_LOG_EVENT(MSC_NAS_EMM_MME, "0 send IDENTITY_REQUEST to s_TMSI %u.%u ", as_msg->s_tmsi.MMEcode, as_msg->s_tmsi.m_tmsi);
} else {
- MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send IDENTITY_REQUEST to ue id %u ", as_msg->UEid);
+ MSC_LOG_EVENT(MSC_NAS_EMM_MME, "0 send IDENTITY_REQUEST to ue id "NAS_UE_ID_FMT" ", as_msg->UEid);
}
size = emm_send_identity_request(msg,
&emm_msg->identity_request);
@@ -1904,9 +1305,9 @@ static int _emm_as_security_req(const emm_as_security_t *msg,
case EMM_AS_MSG_TYPE_AUTH:
if (msg->guti) {
- MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send AUTHENTICATION_REQUEST to s_TMSI %u.%u ", as_msg->s_tmsi.MMEcode, as_msg->s_tmsi.m_tmsi);
+ MSC_LOG_EVENT(MSC_NAS_EMM_MME, "0 send AUTHENTICATION_REQUEST to s_TMSI %u.%u ", as_msg->s_tmsi.MMEcode, as_msg->s_tmsi.m_tmsi);
} else {
- MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send AUTHENTICATION_REQUEST to ue id %u ", as_msg->UEid);
+ MSC_LOG_EVENT(MSC_NAS_EMM_MME, "0 send AUTHENTICATION_REQUEST to ue id "NAS_UE_ID_FMT" ", as_msg->UEid);
}
size = emm_send_authentication_request(msg,
&emm_msg->authentication_request);
@@ -1914,9 +1315,9 @@ static int _emm_as_security_req(const emm_as_security_t *msg,
case EMM_AS_MSG_TYPE_SMC:
if (msg->guti) {
- MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send SECURITY_MODE_COMMAND to s_TMSI %u.%u ", as_msg->s_tmsi.MMEcode, as_msg->s_tmsi.m_tmsi);
+ MSC_LOG_EVENT(MSC_NAS_EMM_MME, "0 send SECURITY_MODE_COMMAND to s_TMSI %u.%u ", as_msg->s_tmsi.MMEcode, as_msg->s_tmsi.m_tmsi);
} else {
- MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send SECURITY_MODE_COMMAND to ue id %u ", as_msg->UEid);
+ MSC_LOG_EVENT(MSC_NAS_EMM_MME, "0 send SECURITY_MODE_COMMAND to ue id "NAS_UE_ID_FMT" ", as_msg->UEid);
}
size = emm_send_security_mode_command(msg,
&emm_msg->security_mode_command);
@@ -2009,9 +1410,9 @@ static int _emm_as_security_rej(const emm_as_security_t *msg,
if (emm_msg != NULL) switch (msg->msgType) {
case EMM_AS_MSG_TYPE_AUTH:
if (msg->guti) {
- MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send AUTHENTICATION_REJECT to s_TMSI %u.%u ", as_msg->s_tmsi.MMEcode, as_msg->s_tmsi.m_tmsi);
+ MSC_LOG_EVENT(MSC_NAS_EMM_MME, "0 send AUTHENTICATION_REJECT to s_TMSI %u.%u ", as_msg->s_tmsi.MMEcode, as_msg->s_tmsi.m_tmsi);
} else {
- MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send AUTHENTICATION_REJECT to ue id %x ", as_msg->UEid);
+ MSC_LOG_EVENT(MSC_NAS_EMM_MME, "0 send AUTHENTICATION_REJECT to ue id "NAS_UE_ID_FMT" ", as_msg->UEid);
}
size = emm_send_authentication_reject(
&emm_msg->authentication_reject);
@@ -2115,7 +1516,7 @@ static int _emm_as_establish_cnf(const emm_as_establish_t *msg,
"EMMAS-SAP - emm_as_establish.nasMSG.length=%d",
msg->NASmsg.length);
- MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send ATTACH_ACCEPT to s_TMSI %u.%u ", as_msg->s_tmsi.MMEcode, as_msg->s_tmsi.m_tmsi);
+ MSC_LOG_EVENT(MSC_NAS_EMM_MME, "0 send ATTACH_ACCEPT to s_TMSI %u.%u ", as_msg->s_tmsi.MMEcode, as_msg->s_tmsi.m_tmsi);
size = emm_send_attach_accept(msg, &emm_msg->attach_accept);
break;
@@ -2231,18 +1632,18 @@ static int _emm_as_establish_rej(const emm_as_establish_t *msg,
if (emm_msg != NULL) switch (msg->NASinfo) {
case EMM_AS_NAS_INFO_ATTACH:
if (msg->UEid.guti) {
- MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send ATTACH_REJECT to s_TMSI %u.%u ", as_msg->s_tmsi.MMEcode, as_msg->s_tmsi.m_tmsi);
+ MSC_LOG_EVENT(MSC_NAS_EMM_MME, "0 send ATTACH_REJECT to s_TMSI %u.%u ", as_msg->s_tmsi.MMEcode, as_msg->s_tmsi.m_tmsi);
} else {
- MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send ATTACH_REJECT to ue id 0x%06"PRIX32" ", as_msg->UEid);
+ MSC_LOG_EVENT(MSC_NAS_EMM_MME, "0 send ATTACH_REJECT to ue id "NAS_UE_ID_FMT" ", as_msg->UEid);
}
size = emm_send_attach_reject(msg, &emm_msg->attach_reject);
break;
case EMM_AS_NAS_INFO_TAU:
if (msg->UEid.guti) {
- MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send TRACKING_AREA_UPDATE_REJECT to s_TMSI %u.%u ", as_msg->s_tmsi.MMEcode, as_msg->s_tmsi.m_tmsi);
+ MSC_LOG_EVENT(MSC_NAS_EMM_MME, "0 send TRACKING_AREA_UPDATE_REJECT to s_TMSI %u.%u ", as_msg->s_tmsi.MMEcode, as_msg->s_tmsi.m_tmsi);
} else {
- MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send TRACKING_AREA_UPDATE_REJECT to ue id 0x%06"PRIX32" ", as_msg->UEid);
+ MSC_LOG_EVENT(MSC_NAS_EMM_MME, "0 send TRACKING_AREA_UPDATE_REJECT to ue id "NAS_UE_ID_FMT" ", as_msg->UEid);
}
size = emm_send_tracking_area_update_reject(msg,
&emm_msg->tracking_area_update_reject);
@@ -2327,7 +1728,6 @@ static int _emm_as_page_ind(const emm_as_page_t *msg, paging_req_t *as_msg)
LOG_FUNC_RETURN (0);
}
-#endif // NAS_MME
/****************************************************************************
** **
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_as.h b/openair-cn/NAS/MME/EMM/SAP/emm_as.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_as.h
rename to openair-cn/NAS/MME/EMM/SAP/emm_as.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_asDef.h b/openair-cn/NAS/MME/EMM/SAP/emm_asDef.h
similarity index 79%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_asDef.h
rename to openair-cn/NAS/MME/EMM/SAP/emm_asDef.h
index ddc98e9b4c..fbd2a6b38e 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_asDef.h
+++ b/openair-cn/NAS/MME/EMM/SAP/emm_asDef.h
@@ -58,7 +58,7 @@ Description Defines the EMM primitives available at the EMMAS Service
/*
* EMMAS-SAP primitives
*/
-typedef enum {
+typedef enum emm_as_primitive_u {
_EMMAS_START = 200,
_EMMAS_SECURITY_REQ, /* EMM->AS: Security request */
_EMMAS_SECURITY_IND, /* AS->EMM: Security indication */
@@ -80,12 +80,12 @@ typedef enum {
} emm_as_primitive_t;
/* Data used to setup EPS NAS security */
-typedef struct {
- UInt8_t is_new; /* New security data indicator */
+typedef struct emm_as_security_data_s {
+ uint8_t is_new; /* New security data indicator */
#define EMM_AS_NO_KEY_AVAILABLE 0xff
- UInt8_t ksi; /* NAS key set identifier */
- UInt8_t sqn; /* Sequence number */
- UInt32_t count; /* NAS counter */
+ uint8_t ksi; /* NAS key set identifier */
+ uint8_t sqn; /* Sequence number */
+ uint32_t count; /* NAS counter */
const OctetString *k_enc; /* NAS cyphering key */
const OctetString *k_int; /* NAS integrity key */
} emm_as_security_data_t;
@@ -98,22 +98,22 @@ typedef struct {
* EMMAS primitive for security
* ----------------------------
*/
-typedef struct {
- UInt32_t ueid; /* UE lower layer identifier */
+typedef struct emm_as_security_s {
+ uint32_t ueid; /* UE lower layer identifier */
const GUTI_t *guti; /* GUTI temporary mobile identity */
emm_as_security_data_t sctx;/* EPS NAS security context */
int emm_cause; /* EMM failure cause code */
/*
* Identity request/response
*/
- UInt8_t identType; /* Type of requested UE's identity */
+ uint8_t identType; /* Type of requested UE's identity */
const imsi_t *imsi; /* The requested IMSI of the UE */
const imei_t *imei; /* The requested IMEI of the UE */
- UInt32_t tmsi; /* The requested TMSI of the UE */
+ uint32_t tmsi; /* The requested TMSI of the UE */
/*
* Authentication request/response
*/
- UInt8_t ksi; /* NAS key set identifier */
+ uint8_t ksi; /* NAS key set identifier */
const OctetString *rand; /* Random challenge number */
const OctetString *autn; /* Authentication token */
const OctetString *res; /* Authentication response */
@@ -121,30 +121,30 @@ typedef struct {
/*
* Security Mode Command
*/
- UInt8_t eea; /* Replayed EPS encryption algorithms */
- UInt8_t eia; /* Replayed EPS integrity algorithms */
- UInt8_t uea; /* Replayed UMTS encryption algorithms */
+ uint8_t eea; /* Replayed EPS encryption algorithms */
+ uint8_t eia; /* Replayed EPS integrity algorithms */
+ uint8_t uea; /* Replayed UMTS encryption algorithms */
uint8_t ucs2;
- UInt8_t uia; /* Replayed UMTS integrity algorithms */
- UInt8_t gea; /* Replayed GPRS encryption algorithms */
- UInt8_t umts_present;
- UInt8_t gprs_present;
+ uint8_t uia; /* Replayed UMTS integrity algorithms */
+ uint8_t gea; /* Replayed GPRS encryption algorithms */
+ uint8_t umts_present;
+ uint8_t gprs_present;
// Added by LG
- UInt8_t selected_eea; /* Selected EPS encryption algorithms */
- UInt8_t selected_eia; /* Selected EPS integrity algorithms */
+ uint8_t selected_eea; /* Selected EPS encryption algorithms */
+ uint8_t selected_eia; /* Selected EPS integrity algorithms */
#define EMM_AS_MSG_TYPE_IDENT 0x01 /* Identification message */
#define EMM_AS_MSG_TYPE_AUTH 0x02 /* Authentication message */
#define EMM_AS_MSG_TYPE_SMC 0x03 /* Security Mode Command */
- UInt8_t msgType; /* Type of NAS security message to transfer */
+ uint8_t msgType; /* Type of NAS security message to transfer */
} emm_as_security_t;
/*
* EMMAS primitive for connection establishment
* --------------------------------------------
*/
-typedef struct {
+typedef struct emm_as_EPS_identity_s {
const GUTI_t *guti; /* The GUTI, if valid */
const tai_t *tai; /* The last visited registered Tracking
* Area Identity, if available */
@@ -152,18 +152,18 @@ typedef struct {
const imei_t *imei; /* UE's IMEI for emergency bearer services */
} emm_as_EPS_identity_t;
-typedef struct {
- UInt32_t ueid; /* UE lower layer identifier */
+typedef struct emm_as_establish_s {
+ uint32_t ueid; /* UE lower layer identifier */
emm_as_EPS_identity_t UEid; /* UE's EPS mobile identity */
emm_as_security_data_t sctx;/* EPS NAS security context */
int switch_off; /* TRUE if the UE is switched off */
- UInt8_t type; /* Network attach/detach type */
- UInt8_t RRCcause; /* Connection establishment cause */
- UInt8_t RRCtype; /* Associated call type */
+ uint8_t type; /* Network attach/detach type */
+ uint8_t RRCcause; /* Connection establishment cause */
+ uint8_t RRCtype; /* Associated call type */
const plmn_t *plmnID; /* Identifier of the selected PLMN */
- UInt8_t ksi; /* NAS key set identifier */
- UInt8_t encryption:4; /* Ciphering algorithm */
- UInt8_t integrity:4; /* Integrity protection algorithm */
+ uint8_t ksi; /* NAS key set identifier */
+ uint8_t encryption:4; /* Ciphering algorithm */
+ uint8_t integrity:4; /* Integrity protection algorithm */
int emm_cause; /* EMM failure cause code */
const GUTI_t *new_guti; /* New GUTI, if re-allocated */
int n_tacs; /* Number of concecutive tracking areas
@@ -175,7 +175,7 @@ typedef struct {
#define EMM_AS_NAS_INFO_TAU 0x03 /* Tracking Area Update request */
#define EMM_AS_NAS_INFO_SR 0x04 /* Service Request */
#define EMM_AS_NAS_INFO_EXTSR 0x05 /* Extended Service Request */
- UInt8_t NASinfo; /* Type of initial NAS information to transfer */
+ uint8_t NASinfo; /* Type of initial NAS information to transfer */
OctetString NASmsg; /* NAS message to be transfered within
* initial NAS information message */
} emm_as_establish_t;
@@ -184,28 +184,28 @@ typedef struct {
* EMMAS primitive for connection release
* --------------------------------------
*/
-typedef struct {
- UInt32_t ueid; /* UE lower layer identifier */
+typedef struct emm_as_release_s {
+ uint32_t ueid; /* UE lower layer identifier */
const GUTI_t *guti; /* GUTI temporary mobile identity */
#define EMM_AS_CAUSE_AUTHENTICATION 0x01 /* Authentication failure */
#define EMM_AS_CAUSE_DETACH 0x02 /* Detach requested */
- UInt8_t cause; /* Release cause */
+ uint8_t cause; /* Release cause */
} emm_as_release_t;
/*
* EMMAS primitive for data transfer
* ---------------------------------
*/
-typedef struct {
- UInt32_t ueid; /* UE lower layer identifier */
+typedef struct emm_as_data_s {
+ uint32_t ueid; /* UE lower layer identifier */
const GUTI_t *guti; /* GUTI temporary mobile identity */
emm_as_security_data_t sctx;/* EPS NAS security context */
int switch_off; /* TRUE if the UE is switched off */
- UInt8_t type; /* Network detach type */
- UInt8_t delivered; /* Data message delivery indicator */
+ uint8_t type; /* Network detach type */
+ uint8_t delivered; /* Data message delivery indicator */
#define EMM_AS_NAS_DATA_ATTACH 0x01 /* Attach complete */
#define EMM_AS_NAS_DATA_DETACH 0x02 /* Detach request */
- UInt8_t NASinfo; /* Type of NAS information to transfer */
+ uint8_t NASinfo; /* Type of NAS information to transfer */
OctetString NASmsg; /* NAS message to be transfered */
} emm_as_data_t;
@@ -213,14 +213,14 @@ typedef struct {
* EMMAS primitive for paging
* --------------------------
*/
-typedef struct {} emm_as_page_t;
+typedef struct emm_as_page_s {} emm_as_page_t;
/*
* EMMAS primitive for status indication
* -------------------------------------
*/
-typedef struct {
- UInt32_t ueid; /* UE lower layer identifier */
+typedef struct emm_as_status_s {
+ uint32_t ueid; /* UE lower layer identifier */
const GUTI_t *guti; /* GUTI temporary mobile identity */
emm_as_security_data_t sctx;/* EPS NAS security context */
int emm_cause; /* EMM failure cause code */
@@ -230,8 +230,8 @@ typedef struct {
* EMMAS primitive for cell information
* ------------------------------------
*/
-typedef struct {
- UInt8_t found; /* Indicates whether a suitable cell is found */
+typedef struct emm_as_cell_info_s {
+ uint8_t found; /* Indicates whether a suitable cell is found */
#define EMM_AS_PLMN_LIST_SIZE 6
PLMN_LIST_T(EMM_AS_PLMN_LIST_SIZE) plmnIDs;
/* List of identifiers of available PLMNs */
@@ -245,7 +245,7 @@ typedef struct {
* Structure of EMMAS-SAP primitive
* --------------------------------
*/
-typedef struct {
+typedef struct emm_as_s {
emm_as_primitive_t primitive;
union {
emm_as_security_t security;
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_cn.c b/openair-cn/NAS/MME/EMM/SAP/emm_cn.c
similarity index 78%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_cn.c
rename to openair-cn/NAS/MME/EMM/SAP/emm_cn.c
index abb2d3e1ff..603e849c14 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_cn.c
+++ b/openair-cn/NAS/MME/EMM/SAP/emm_cn.c
@@ -105,7 +105,7 @@ static int _emm_cn_authentication_res(const emm_cn_auth_res_t *msg)
if (emm_ctx == NULL) {
LOG_TRACE(ERROR, "EMM-PROC - "
- "Failed to find UE associated to id %u...", msg->ue_id);
+ "Failed to find UE associated to id "NAS_UE_ID_FMT"...", msg->ue_id);
LOG_FUNC_RETURN (rc);
}
@@ -166,13 +166,13 @@ static int _emm_cn_authentication_fail(const emm_cn_auth_fail_t *msg)
LOG_FUNC_RETURN (rc);
}
-static int _emm_cn_deregister_ue(const UInt32_t ue_id)
+static int _emm_cn_deregister_ue(const uint32_t ue_id)
{
int rc = RETURNok;
LOG_FUNC_IN;
LOG_TRACE(WARNING, "EMM-PROC - "
- "TODO deregister UE %u, following procedure is a test");
+ "TODO deregister UE "NAS_UE_ID_FMT", following procedure is a test", ue_id);
emm_proc_detach_request(ue_id, EMM_DETACH_TYPE_EPS /* ??? emm_proc_detach_type_t*/,
1 /*switch_off*/, 0 /*native_ksi*/, 0 /*ksi*/,
NULL /*guti*/, NULL /*imsi*/, NULL /*imei*/);
@@ -181,26 +181,33 @@ static int _emm_cn_deregister_ue(const UInt32_t ue_id)
static int _emm_cn_pdn_connectivity_res(const emm_cn_pdn_res_t *msg_pP)
{
- int rc = RETURNok;
- struct emm_data_context_s *emm_ctx_p = NULL;
- esm_proc_pdn_type_t esm_pdn_type = ESM_PDN_TYPE_IPV4;
- esm_proc_data_t *esm_proc_data_p = NULL;
- ESM_msg esm_msg;
- EpsQualityOfService qos;
- OctetString rsp = { 0, NULL};
- int is_standalone = 0; // warning hardcoded
- int triggered_by_ue = 1; // warning hardcoded
- attach_data_t *data_p = NULL;
- int esm_cause = ESM_CAUSE_SUCCESS;
- int pid = 0;
- unsigned int new_ebi = 0;
+ int rc = RETURNok;
+ struct emm_data_context_s *emm_ctx_p = NULL;
+ esm_proc_pdn_type_t esm_pdn_type = ESM_PDN_TYPE_IPV4;
+ esm_proc_data_t *esm_proc_data_p = NULL;
+ ESM_msg esm_msg;
+ EpsQualityOfService qos;
+ ProtocolConfigurationOptions pco;
+ unsigned int pco_in_index = 0;
+ signed int length_in_pco = 0;
+ uint16_t pi_or_ci = 0; // protocol identifier or container identifier;
+ uint8_t length_pi_or_ci = 0;
+
+ OctetString rsp = { 0, NULL};
+ int is_standalone = 0; // warning hardcoded
+ int triggered_by_ue = 1; // warning hardcoded
+ attach_data_t *data_p = NULL;
+ int esm_cause = ESM_CAUSE_SUCCESS;
+ int pid = 0;
+ unsigned int new_ebi = 0;
+
LOG_FUNC_IN;
emm_ctx_p = emm_data_context_get(&_emm_data, msg_pP->ue_id);
if (emm_ctx_p == NULL) {
LOG_TRACE(ERROR, "EMMCN-SAP - "
- "Failed to find UE associated to id %u...", msg_pP->ue_id);
+ "Failed to find UE associated to id "NAS_UE_ID_FMT"...", msg_pP->ue_id);
LOG_FUNC_RETURN (rc);
}
@@ -247,7 +254,44 @@ static int _emm_cn_pdn_connectivity_res(const emm_cn_pdn_res_t *msg_pP)
qos.bitRatesExt.guarBitRateForUL = 0;
qos.bitRatesExt.guarBitRateForDL = 0;
+ //--------------------------------------------------------------------------
+ // PCO processing
+ //--------------------------------------------------------------------------
+ memset(&pco, 0, sizeof(ProtocolConfigurationOptions));
+ length_in_pco = msg_pP->pco.byte[1];
+ if ((length_in_pco+1+1) != msg_pP->pco.length) {
+ LOG_TRACE(WARNING, "PCO: mismatch in lengths length_pco+1+1 %u != msg_pP->pco.length %u\n",
+ length_in_pco+1+1, msg_pP->pco.length);
+ }
+ pco.configurationprotol = msg_pP->pco.byte[2] & 0x07;
+ for (int i = 0; i < msg_pP->pco.length; i++) {
+ LOG_TRACE(WARNING, "EMMCN_PDN_CONNECTIVITY_RES.pco.byte[%u] = 0x%x", i, msg_pP->pco.byte[i]);
+ }
+
+
+ if ((length_in_pco > 0) && (msg_pP->pco.byte[2] & 0x80)) {
+ pco_in_index = PCO_MIN_LENGTH;
+ while (length_in_pco >= 3) {
+ pi_or_ci = (((uint16_t)msg_pP->pco.byte[pco_in_index]) << 8) | (uint16_t)msg_pP->pco.byte[pco_in_index+1];
+ pco_in_index += 2;
+ length_pi_or_ci = msg_pP->pco.byte[pco_in_index++];
+ pco.protocolid[pco.num_protocol_id_or_container_id] = pi_or_ci;
+ pco.lengthofprotocolid[pco.num_protocol_id_or_container_id] = length_pi_or_ci;
+ pco.protocolidcontents[pco.num_protocol_id_or_container_id].value = malloc(length_pi_or_ci);
+ pco.protocolidcontents[pco.num_protocol_id_or_container_id].length = length_pi_or_ci;
+ memcpy(pco.protocolidcontents[pco.num_protocol_id_or_container_id].value,
+ &msg_pP->pco.byte[pco_in_index],
+ length_pi_or_ci);
+
+ LOG_TRACE(WARNING, "PCO: Found pi_or_ci 0x%x length %u content %s\n",
+ pi_or_ci, length_pi_or_ci, dump_octet_string(&pco.protocolidcontents[pco.num_protocol_id_or_container_id]));
+ pco.num_protocol_id_or_container_id++;
+ pco_in_index += length_pi_or_ci;
+
+ length_in_pco = length_in_pco - (length_pi_or_ci + 2 + 1);
+ } // while (length_in_pco >= 3) {
+ } // if ((length_in_pco > 0) && (msg_pP->pco.byte[2] & 0x80)) {
/*************************************************************************/
/* CODE THAT WAS IN esm_recv.c/esm_recv_pdn_connectivity_request() */
/*************************************************************************/
@@ -294,6 +338,7 @@ static int _emm_cn_pdn_connectivity_res(const emm_cn_pdn_res_t *msg_pP)
new_ebi, //msg_pP->ebi,
&esm_msg.activate_default_eps_bearer_context_request,
&msg_pP->apn,
+ &pco,
esm_pdn_type,
&msg_pP->pdn_addr,
&qos,
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_cn.h b/openair-cn/NAS/MME/EMM/SAP/emm_cn.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_cn.h
rename to openair-cn/NAS/MME/EMM/SAP/emm_cn.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_cnDef.h b/openair-cn/NAS/MME/EMM/SAP/emm_cnDef.h
similarity index 99%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_cnDef.h
rename to openair-cn/NAS/MME/EMM/SAP/emm_cnDef.h
index d5a88b9923..738871e5eb 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_cnDef.h
+++ b/openair-cn/NAS/MME/EMM/SAP/emm_cnDef.h
@@ -70,7 +70,7 @@ typedef nas_pdn_connectivity_rsp_t emm_cn_pdn_res_t;
typedef nas_pdn_connectivity_fail_t emm_cn_pdn_fail_t;
typedef struct emm_cn_deregister_ue_s {
- UInt32_t UEid;
+ uint32_t UEid;
} emm_cn_deregister_ue_t;
typedef struct emm_mme_ul_s {
diff --git a/openair-cn/NAS/MME/EMM/SAP/emm_esm.c b/openair-cn/NAS/MME/EMM/SAP/emm_esm.c
new file mode 100644
index 0000000000..2a7af5c780
--- /dev/null
+++ b/openair-cn/NAS/MME/EMM/SAP/emm_esm.c
@@ -0,0 +1,147 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+Source emm_esm.c
+
+Version 0.1
+
+Date 2012/10/16
+
+Product NAS stack
+
+Subsystem EPS Mobility Management
+
+Author Frederic Maurel
+
+Description Defines the EMMESM Service Access Point that provides
+ interlayer services to the EPS Session Management sublayer
+ for service registration and activate/deactivate PDN
+ connections.
+
+*****************************************************************************/
+
+#include "emm_esm.h"
+#include "commonDef.h"
+#include "nas_log.h"
+
+#include "LowerLayer.h"
+
+
+/****************************************************************************/
+/**************** E X T E R N A L D E F I N I T I O N S ****************/
+/****************************************************************************/
+
+/****************************************************************************/
+/******************* L O C A L D E F I N I T I O N S *******************/
+/****************************************************************************/
+
+/*
+ * String representation of EMMESM-SAP primitives
+ */
+static const char *_emm_esm_primitive_str[] = {
+ "EMMESM_RELEASE_IND",
+ "EMMESM_UNITDATA_REQ",
+ "EMMESM_UNITDATA_IND",
+};
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+/****************************************************************************
+ ** **
+ ** Name: emm_esm_initialize() **
+ ** **
+ ** Description: Initializes the EMMESM Service Access Point **
+ ** **
+ ** Inputs: None **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: None **
+ ** Others: NONE **
+ ** **
+ ***************************************************************************/
+void emm_esm_initialize(void)
+{
+ LOG_FUNC_IN;
+
+ /* TODO: Initialize the EMMESM-SAP */
+
+ LOG_FUNC_OUT;
+}
+
+/****************************************************************************
+ ** **
+ ** Name: emm_esm_send() **
+ ** **
+ ** Description: Processes the EMMESM Service Access Point primitive **
+ ** **
+ ** Inputs: msg: The EMMESM-SAP primitive to process **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int emm_esm_send(const emm_esm_t *msg)
+{
+ LOG_FUNC_IN;
+
+ int rc = RETURNerror;
+ emm_esm_primitive_t primitive = msg->primitive;
+
+ LOG_TRACE(INFO, "EMMESM-SAP - Received primitive %s (%d)",
+ _emm_esm_primitive_str[primitive - _EMMESM_START - 1], primitive);
+
+ switch (primitive) {
+
+ case _EMMESM_UNITDATA_REQ:
+ /* ESM requests EMM to transfer ESM data unit to lower layer */
+ rc = lowerlayer_data_req(msg->ueid, &msg->u.data.msg);
+ break;
+
+ default:
+ break;
+
+ }
+
+ if (rc != RETURNok) {
+ LOG_TRACE(WARNING, "EMMESM-SAP - Failed to process primitive %s (%d)",
+ _emm_esm_primitive_str[primitive - _EMMESM_START - 1],
+ primitive);
+ }
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************/
+/********************* L O C A L F U N C T I O N S *********************/
+/****************************************************************************/
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_esm.h b/openair-cn/NAS/MME/EMM/SAP/emm_esm.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_esm.h
rename to openair-cn/NAS/MME/EMM/SAP/emm_esm.h
diff --git a/openair-cn/NAS/MME/EMM/SAP/emm_esmDef.h b/openair-cn/NAS/MME/EMM/SAP/emm_esmDef.h
new file mode 100644
index 0000000000..3fbc035bdf
--- /dev/null
+++ b/openair-cn/NAS/MME/EMM/SAP/emm_esmDef.h
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+Source emm_esmDef.h
+
+Version 0.1
+
+Date 2012/10/16
+
+Product NAS stack
+
+Subsystem EPS Mobility Management
+
+Author Frederic Maurel
+
+Description Defines the EMMESM Service Access Point that provides
+ interlayer services to the EPS Session Management sublayer
+ for service registration and activate/deactivate PDN
+ connections.
+
+*****************************************************************************/
+#ifndef __EMM_ESMDEF_H__
+#define __EMM_ESMDEF_H__
+
+#include "OctetString.h"
+#include "emmData.h"
+
+/****************************************************************************/
+/********************* G L O B A L C O N S T A N T S *******************/
+/****************************************************************************/
+
+/*
+ * EMMESM-SAP primitives
+ */
+typedef enum {
+ _EMMESM_START = 100,
+ _EMMESM_RELEASE_IND,
+ _EMMESM_UNITDATA_REQ,
+ _EMMESM_UNITDATA_IND,
+ _EMMESM_END
+} emm_esm_primitive_t;
+
+/****************************************************************************/
+/************************ G L O B A L T Y P E S ************************/
+/****************************************************************************/
+
+/*
+ * EMMESM primitive for connection establishment
+ * ---------------------------------------------
+ */
+typedef struct {
+ int is_emergency; /* Indicates whether the PDN connection is established
+ * for emergency bearer services only */
+ int is_attached; /* Indicates whether the UE remains attached to the
+ * network */
+} emm_esm_establish_t;
+
+/*
+ * EMMESM primitive for data transfer
+ * ----------------------------------
+ */
+typedef struct {
+ OctetString msg; /* ESM message to be transfered */
+} emm_esm_data_t;
+
+/*
+ * ---------------------------------
+ * Structure of EMMESM-SAP primitive
+ * ---------------------------------
+ */
+typedef struct {
+ emm_esm_primitive_t primitive;
+ unsigned int ueid;
+ emm_data_context_t *ctx;
+ union {
+ emm_esm_establish_t establish;
+ emm_esm_data_t data;
+ } u;
+ /* TODO: complete emm_esm_t structure definition */
+} emm_esm_t;
+
+/****************************************************************************/
+/******************** G L O B A L V A R I A B L E S ********************/
+/****************************************************************************/
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+#endif /* __EMM_ESMDEF_H__*/
diff --git a/openair-cn/NAS/MME/EMM/SAP/emm_fsm.c b/openair-cn/NAS/MME/EMM/SAP/emm_fsm.c
new file mode 100644
index 0000000000..bbbace861b
--- /dev/null
+++ b/openair-cn/NAS/MME/EMM/SAP/emm_fsm.c
@@ -0,0 +1,328 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+
+Source emm_fsm.c
+
+Version 0.1
+
+Date 2012/10/03
+
+Product NAS stack
+
+Subsystem EPS Mobility Management
+
+Author Frederic Maurel
+
+Description Defines the EPS Mobility Management procedures executed at
+ the EMMREG Service Access Point.
+
+*****************************************************************************/
+
+#include "emm_fsm.h"
+#include "commonDef.h"
+#include "nas_log.h"
+
+#include "mme_api.h"
+#include "emmData.h"
+
+#if defined(NAS_BUILT_IN_EPC)
+# include "assertions.h"
+#endif
+# include "msc.h"
+
+/****************************************************************************/
+/**************** E X T E R N A L D E F I N I T I O N S ****************/
+/****************************************************************************/
+
+
+#define EMM_FSM_NB_UE_MAX (MME_API_NB_UE_MAX + 1)
+
+/****************************************************************************/
+/******************* L O C A L D E F I N I T I O N S *******************/
+/****************************************************************************/
+
+/*
+ * -----------------------------------------------------------------------------
+ * Data used for trace logging
+ * -----------------------------------------------------------------------------
+ */
+
+/* String representation of EMM events */
+static const char *_emm_fsm_event_str[] = {
+ "COMMON_PROC_REQ",
+ "COMMON_PROC_CNF",
+ "COMMON_PROC_REJ",
+ "PROC_ABORT",
+ "ATTACH_CNF",
+ "ATTACH_REJ",
+ "DETACH_INIT",
+ "DETACH_REQ",
+ "DETACH_FAILED",
+ "DETACH_CNF",
+ "TAU_REQ",
+ "TAU_CNF",
+ "TAU_REJ",
+ "SERVICE_REQ",
+ "SERVICE_CNF",
+ "SERVICE_REJ",
+ "LOWERLAYER_SUCCESS",
+ "LOWERLAYER_FAILURE",
+ "LOWERLAYER_RELEASE",
+};
+
+/* String representation of EMM status */
+static const char *_emm_fsm_status_str[EMM_STATE_MAX] = {
+ "INVALID",
+ "DEREGISTERED",
+ "REGISTERED",
+ "DEREGISTERED-INITIATED",
+ "COMMON-PROCEDURE-INITIATED",
+};
+
+/*
+ * -----------------------------------------------------------------------------
+ * EPS Mobility Management state machine handlers
+ * -----------------------------------------------------------------------------
+ */
+
+/* Type of the EPS Mobility Management state machine handler */
+typedef int(*emm_fsm_handler_t)(const emm_reg_t *);
+
+int EmmDeregistered(const emm_reg_t *);
+int EmmRegistered(const emm_reg_t *);
+int EmmDeregisteredInitiated(const emm_reg_t *);
+int EmmCommonProcedureInitiated(const emm_reg_t *);
+
+/* EMM state machine handlers */
+static const emm_fsm_handler_t _emm_fsm_handlers[EMM_STATE_MAX] = {
+ NULL,
+ EmmDeregistered,
+ EmmRegistered,
+ EmmDeregisteredInitiated,
+ EmmCommonProcedureInitiated,
+};
+
+/*
+ * -----------------------------------------------------------------------------
+ * Current EPS Mobility Management status
+ * -----------------------------------------------------------------------------
+ */
+
+#if !defined(NAS_BUILT_IN_EPC)
+emm_fsm_state_t _emm_fsm_status[EMM_FSM_NB_UE_MAX];
+#endif
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+/****************************************************************************
+ ** **
+ ** Name: emm_fsm_initialize() **
+ ** **
+ ** Description: Initializes the EMM state machine **
+ ** **
+ ** Inputs: None **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: None **
+ ** Others: _emm_fsm_status **
+ ** **
+ ***************************************************************************/
+void emm_fsm_initialize(void)
+{
+ int ueid;
+ LOG_FUNC_IN;
+
+
+#if !defined(NAS_BUILT_IN_EPC)
+
+ for (ueid = 0; ueid < EMM_FSM_NB_UE_MAX; ueid++) {
+ _emm_fsm_status[ueid] = EMM_DEREGISTERED;
+ }
+
+#endif
+
+ LOG_FUNC_OUT;
+}
+
+/****************************************************************************
+ ** **
+ ** Name: emm_fsm_set_status() **
+ ** **
+ ** Description: Set the EPS Mobility Management status to the given state **
+ ** **
+ ** Inputs: ueid: Lower layers UE identifier **
+ ** status: The new EMM status **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: _emm_fsm_status **
+ ** **
+ ***************************************************************************/
+int emm_fsm_set_status(
+ unsigned int ueid,
+ void *ctx,
+ emm_fsm_state_t status)
+{
+ LOG_FUNC_IN;
+
+#if defined(NAS_BUILT_IN_EPC)
+ emm_data_context_t *emm_ctx = (emm_data_context_t *)ctx;
+
+ DevAssert(emm_ctx != NULL);
+
+ if ((status < EMM_STATE_MAX) && (ueid > 0)) {
+
+ if (status != emm_ctx->_emm_fsm_status) {
+ LOG_TRACE(INFO, "EMM-FSM - Status changed: %s ===> %s",
+ _emm_fsm_status_str[emm_ctx->_emm_fsm_status],
+ _emm_fsm_status_str[status]);
+ MSC_LOG_EVENT(MSC_NAS_EMM_MME, "0 EMM state %s ", _emm_fsm_status_str[status]);
+ emm_ctx->_emm_fsm_status = status;
+ }
+
+ LOG_FUNC_RETURN (RETURNok);
+ }
+
+#else
+
+ if ( (status < EMM_STATE_MAX) && (ueid < EMM_FSM_NB_UE_MAX) ) {
+ if (status != _emm_fsm_status[ueid]) {
+ LOG_TRACE(INFO, "EMM-FSM - Status changed: %s ===> %s",
+ _emm_fsm_status_str[_emm_fsm_status[ueid]],
+ _emm_fsm_status_str[status]);
+
+ _emm_fsm_status[ueid] = status;
+ }
+
+ LOG_FUNC_RETURN (RETURNok);
+ }
+
+#endif
+
+ LOG_FUNC_RETURN (RETURNerror);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: emm_fsm_get_status() **
+ ** **
+ ** Description: Get the current value of the EPS Mobility Management **
+ ** status **
+ ** **
+ ** Inputs: ueid: Lower layers UE identifier **
+ ** Others: _emm_fsm_status **
+ ** **
+ ** Outputs: None **
+ ** Return: The current value of the EMM status **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+emm_fsm_state_t emm_fsm_get_status(unsigned int ueid, void *ctx)
+{
+# if defined(NAS_BUILT_IN_EPC)
+ emm_data_context_t *emm_ctx = (emm_data_context_t *)ctx;
+ if (emm_ctx == NULL) {
+ LOG_TRACE(INFO, "EMM-FSM - try again get context ueid "NAS_UE_ID_FMT" ",
+ ueid);
+ emm_ctx = emm_data_context_get(&_emm_data, ueid);
+ }
+ if (emm_ctx != NULL) {
+ return emm_ctx->_emm_fsm_status;
+ }
+
+# else
+
+ if (ueid < EMM_FSM_NB_UE_MAX) {
+ return (_emm_fsm_status[ueid]);
+ }
+#endif
+ return EMM_STATE_MAX;
+}
+
+/****************************************************************************
+ ** **
+ ** Name: emm_fsm_process() **
+ ** **
+ ** Description: Executes the EMM state machine **
+ ** **
+ ** Inputs: evt: The EMMREG-SAP event to process **
+ ** Others: _emm_fsm_status **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int emm_fsm_process(const emm_reg_t *evt)
+{
+ int rc;
+ emm_fsm_state_t status;
+ emm_reg_primitive_t primitive;
+
+ LOG_FUNC_IN;
+
+ primitive = evt->primitive;
+
+# if defined(NAS_BUILT_IN_EPC)
+ emm_data_context_t *emm_ctx = (emm_data_context_t *)evt->ctx;
+ DevAssert(emm_ctx != NULL);
+
+ status = emm_fsm_get_status(0, emm_ctx);
+# else
+
+ if (evt->ueid >= EMM_FSM_NB_UE_MAX) {
+ LOG_FUNC_RETURN (RETURNerror);
+ }
+
+ status = _emm_fsm_status[evt->ueid];
+# endif
+
+ LOG_TRACE(INFO, "EMM-FSM - Received event %s (%d) in state %s",
+ _emm_fsm_event_str[primitive - _EMMREG_START - 1], primitive,
+ _emm_fsm_status_str[status]);
+
+#if defined(NAS_BUILT_IN_EPC)
+ DevAssert(status != EMM_INVALID);
+#endif
+
+ /* Execute the EMM state machine */
+ rc = (_emm_fsm_handlers[status])(evt);
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************/
+/********************* L O C A L F U N C T I O N S *********************/
+/****************************************************************************/
+
diff --git a/openair-cn/NAS/MME/EMM/SAP/emm_fsm.h b/openair-cn/NAS/MME/EMM/SAP/emm_fsm.h
new file mode 100644
index 0000000000..15ca989cc5
--- /dev/null
+++ b/openair-cn/NAS/MME/EMM/SAP/emm_fsm.h
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+
+Source emm_fsm.h
+
+Version 0.1
+
+Date 2012/10/03
+
+Product NAS stack
+
+Subsystem EPS Mobility Management
+
+Author Frederic Maurel
+
+Description Defines the EPS Mobility Management procedures executed at
+ the EMMREG Service Access Point.
+
+*****************************************************************************/
+#ifndef __EMM_FSM_H__
+#define __EMM_FSM_H__
+
+#include "emm_regDef.h"
+
+/****************************************************************************/
+/********************* G L O B A L C O N S T A N T S *******************/
+/****************************************************************************/
+
+/****************************************************************************/
+/************************ G L O B A L T Y P E S ************************/
+/****************************************************************************/
+
+/*
+ * States of the EPS Mobility Management sublayer
+ * ----------------------------------------------
+ * The EMM protocol of the UE and the network is described by means of two
+ * different state machines.
+ */
+typedef enum {
+ EMM_INVALID,
+ EMM_DEREGISTERED,
+ EMM_REGISTERED,
+ EMM_DEREGISTERED_INITIATED,
+ EMM_COMMON_PROCEDURE_INITIATED,
+ EMM_STATE_MAX
+} emm_fsm_state_t;
+
+/****************************************************************************/
+/******************** G L O B A L V A R I A B L E S ********************/
+/****************************************************************************/
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+void emm_fsm_initialize(void);
+
+//LG 2015-03-13 struct emm_data_context_t;
+int emm_fsm_set_status(unsigned int ueid, void *ctx, emm_fsm_state_t status);
+emm_fsm_state_t emm_fsm_get_status(unsigned int ueid, void *ctx);
+
+int emm_fsm_process(const emm_reg_t *evt);
+
+#endif /* __EMM_FSM_H__*/
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_recv.c b/openair-cn/NAS/MME/EMM/SAP/emm_recv.c
similarity index 68%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_recv.c
rename to openair-cn/NAS/MME/EMM/SAP/emm_recv.c
index d37de4fc90..2f0d944679 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_recv.c
+++ b/openair-cn/NAS/MME/EMM/SAP/emm_recv.c
@@ -113,385 +113,11 @@ int emm_recv_status(unsigned int ueid, emm_status_msg *msg, int *emm_cause)
LOG_FUNC_RETURN (rc);
}
-/*
- * --------------------------------------------------------------------------
- * Functions executed by the UE upon receiving EMM message from the network
- * --------------------------------------------------------------------------
- */
-#ifdef NAS_UE
-/****************************************************************************
- ** **
- ** Name: emm_recv_attach_accept() **
- ** **
- ** Description: Processes Attach Accept message **
- ** **
- ** Inputs: msg: The received EMM message **
- ** Others: None **
- ** **
- ** Outputs: emm_cause: EMM cause code **
- ** Return: RETURNok, RETURNerror **
- ** Others: None **
- ** **
- ***************************************************************************/
-int emm_recv_attach_accept(attach_accept_msg *msg, int *emm_cause)
-{
- LOG_FUNC_IN;
-
- int rc;
- int i;
-
- LOG_TRACE(INFO, "EMMAS-SAP - Received Attach Accept message");
-
- /*
- * Message checking
- */
- if (msg->tailist.typeoflist !=
- TRACKING_AREA_IDENTITY_LIST_ONE_PLMN_CONSECUTIVE_TACS) {
- /* Only list of TACs belonging to one PLMN with consecutive
- * TAC values is supported */
- *emm_cause = EMM_CAUSE_IE_NOT_IMPLEMENTED;
- } else if ( (msg->presencemask & ATTACH_ACCEPT_GUTI_PRESENT) &&
- (msg->guti.guti.typeofidentity != EPS_MOBILE_IDENTITY_GUTI) ) {
- /* The only supported type of EPS mobile identity is GUTI */
- *emm_cause = EMM_CAUSE_IE_NOT_IMPLEMENTED;
- }
-
- /* Handle message checking error */
- if (*emm_cause != EMM_CAUSE_SUCCESS) {
- LOG_FUNC_RETURN (RETURNerror);
- }
-
- /*
- * Message processing
- */
- /* Compute timers value */
- long T3412, T3402 = -1, T3423 = -1;
- T3412 = gprs_timer_value(&msg->t3412value);
-
- if (msg->presencemask & ATTACH_ACCEPT_T3402_VALUE_PRESENT) {
- T3402 = gprs_timer_value(&msg->t3402value);
- }
-
- if (msg->presencemask & ATTACH_ACCEPT_T3423_VALUE_PRESENT) {
- T3423 = gprs_timer_value(&msg->t3423value);
- }
-
- /* Get the tracking area list the UE is registered to */
-
- /* LW: number of elements is coded as N-1 (0 -> 1 element, 1 -> 2 elements...),
- * see 3GPP TS 24.301, section 9.9.3.33.1 */
- int n_tais = msg->tailist.numberofelements + 1;
- tai_t tai[n_tais];
-
- for (i = 0; i < n_tais; i++) {
- tai[i].plmn.MCCdigit1 = msg->tailist.mccdigit1;
- tai[i].plmn.MCCdigit2 = msg->tailist.mccdigit2;
- tai[i].plmn.MCCdigit3 = msg->tailist.mccdigit3;
- tai[i].plmn.MNCdigit1 = msg->tailist.mncdigit1;
- tai[i].plmn.MNCdigit2 = msg->tailist.mncdigit2;
- tai[i].plmn.MNCdigit3 = msg->tailist.mncdigit3;
- tai[i].tac = msg->tailist.tac + i;
- }
-
- /* Get the GUTI */
- GUTI_t *pguti = NULL;
- GUTI_t guti;
-
- if (msg->presencemask & ATTACH_ACCEPT_GUTI_PRESENT) {
- pguti = &guti;
- guti.gummei.plmn.MCCdigit1 = msg->guti.guti.mccdigit1;
- guti.gummei.plmn.MCCdigit2 = msg->guti.guti.mccdigit2;
- guti.gummei.plmn.MCCdigit3 = msg->guti.guti.mccdigit3;
- guti.gummei.plmn.MNCdigit1 = msg->guti.guti.mncdigit1;
- guti.gummei.plmn.MNCdigit2 = msg->guti.guti.mncdigit2;
- guti.gummei.plmn.MNCdigit3 = msg->guti.guti.mncdigit3;
- guti.gummei.MMEgid = msg->guti.guti.mmegroupid;
- guti.gummei.MMEcode = msg->guti.guti.mmecode;
- guti.m_tmsi = msg->guti.guti.mtmsi;
- }
-
- /* Get the list of equivalent PLMNs */
- int n_eplmns = 0;
- plmn_t eplmn;
-
- if (msg->presencemask & ATTACH_ACCEPT_EQUIVALENT_PLMNS_PRESENT) {
- n_eplmns = 1;
- eplmn.MCCdigit1 = msg->equivalentplmns.mccdigit1;
- eplmn.MCCdigit2 = msg->equivalentplmns.mccdigit2;
- eplmn.MCCdigit3 = msg->equivalentplmns.mccdigit3;
- eplmn.MNCdigit1 = msg->equivalentplmns.mncdigit1;
- eplmn.MNCdigit2 = msg->equivalentplmns.mncdigit2;
- eplmn.MNCdigit3 = msg->equivalentplmns.mncdigit3;
- }
-
- /* Execute attach procedure accepted by the network */
- rc = emm_proc_attach_accept(T3412, T3402, T3423, n_tais, tai, pguti,
- n_eplmns, &eplmn,
- &msg->esmmessagecontainer.esmmessagecontainercontents);
-
- LOG_FUNC_RETURN (rc);
-}
-
-/****************************************************************************
- ** **
- ** Name: emm_recv_attach_reject() **
- ** **
- ** Description: Processes Attach Reject message **
- ** **
- ** Inputs: msg: The received EMM message **
- ** Others: None **
- ** **
- ** Outputs: emm_cause: EMM cause code **
- ** Return: RETURNok, RETURNerror **
- ** Others: None **
- ** **
- ***************************************************************************/
-int emm_recv_attach_reject(attach_reject_msg *msg, int *emm_cause)
-{
- LOG_FUNC_IN;
-
- int rc;
-
- LOG_TRACE(INFO, "EMMAS-SAP - Received Attach Reject message (cause=%d)",
- msg->emmcause);
-
- /*
- * Message checking
- */
- if ( (msg->emmcause == EMM_CAUSE_ESM_FAILURE) &&
- !(msg->presencemask & ATTACH_REJECT_ESM_MESSAGE_CONTAINER_PRESENT) ) {
- /* The ATTACH REJECT message shall be combined with a PDN
- * CONNECTIVITY REJECT message contained in the ESM message
- * container information element */
- *emm_cause = EMM_CAUSE_INVALID_MANDATORY_INFO;
- }
-
- /* Handle message checking error */
- if (*emm_cause != EMM_CAUSE_SUCCESS) {
- LOG_FUNC_RETURN (RETURNerror);
- }
-
- /*
- * Message processing
- */
- if (msg->presencemask & ATTACH_REJECT_ESM_MESSAGE_CONTAINER_PRESENT) {
- /* Execute attach procedure rejected by the network */
- rc = emm_proc_attach_reject(msg->emmcause,
- &msg->esmmessagecontainer.esmmessagecontainercontents);
- } else {
- /* Execute attach procedure rejected by the network */
- rc = emm_proc_attach_reject(msg->emmcause, NULL);
- }
-
- LOG_FUNC_RETURN (rc);
-}
-
-/****************************************************************************
- ** **
- ** Name: emm_recv_detach_accept() **
- ** **
- ** Description: Processes Detach Accept message **
- ** **
- ** Inputs: msg: The received EMM message **
- ** Others: None **
- ** **
- ** Outputs: emm_cause: EMM cause code **
- ** Return: RETURNok, RETURNerror **
- ** Others: None **
- ** **
- ***************************************************************************/
-int emm_recv_detach_accept(detach_accept_msg *msg, int *emm_cause)
-{
- LOG_FUNC_IN;
-
- int rc;
-
- LOG_TRACE(INFO, "EMMAS-SAP - Received Detach Accept message");
-
- /*
- * Message processing
- */
- /* Execute the UE initiated detach procedure completion by the UE */
- rc = emm_proc_detach_accept();
-
- LOG_FUNC_RETURN (rc);
-}
-
-/****************************************************************************
- ** **
- ** Name: emm_recv_identity_request() **
- ** **
- ** Description: Processes Identity Request message **
- ** **
- ** Inputs: msg: The received EMM message **
- ** Others: None **
- ** **
- ** Outputs: emm_cause: EMM cause code **
- ** Return: RETURNok, RETURNerror **
- ** Others: None **
- ** **
- ***************************************************************************/
-int emm_recv_identity_request(identity_request_msg *msg, int *emm_cause)
-{
- LOG_FUNC_IN;
-
- int rc;
-
- LOG_TRACE(INFO, "EMMAS-SAP - Received Identity Request message");
-
- /*
- * Message processing
- */
- /* Get the requested identity type */
- emm_proc_identity_type_t type;
-
- if (msg->identitytype == IDENTITY_TYPE_2_IMSI) {
- type = EMM_IDENT_TYPE_IMSI;
- } else if (msg->identitytype == IDENTITY_TYPE_2_IMEI) {
- type = EMM_IDENT_TYPE_IMEI;
- } else if (msg->identitytype == IDENTITY_TYPE_2_IMEISV) {
- type = EMM_IDENT_TYPE_IMEISV;
- } else if (msg->identitytype == IDENTITY_TYPE_2_TMSI) {
- type = EMM_IDENT_TYPE_TMSI;
- } else {
- /* All other values are interpreted as IMSI */
- type = EMM_IDENT_TYPE_IMSI;
- }
-
- /* Execute the identification procedure initiated by the network */
- rc = emm_proc_identification_request(type);
-
- LOG_FUNC_RETURN (rc);
-}
-
-/****************************************************************************
- ** **
- ** Name: emm_recv_authentication_request() **
- ** **
- ** Description: Processes Authentication Request message **
- ** **
- ** Inputs: msg: The received EMM message **
- ** Others: None **
- ** **
- ** Outputs: emm_cause: EMM cause code **
- ** Return: RETURNok, RETURNerror **
- ** Others: None **
- ** **
- ***************************************************************************/
-int emm_recv_authentication_request(authentication_request_msg *msg,
- int *emm_cause)
-{
- LOG_FUNC_IN;
-
- int rc;
-
- LOG_TRACE(INFO, "EMMAS-SAP - Received Authentication Request message");
-
- /*
- * Message checking
- */
- if ( (msg->authenticationparameterrand.rand.length == 0) ||
- (msg->authenticationparameterautn.autn.length == 0) ) {
- /* RAND and AUTN parameters shall not be null */
- *emm_cause = EMM_CAUSE_INVALID_MANDATORY_INFO;
- }
-
- /* Handle message checking error */
- if (*emm_cause != EMM_CAUSE_SUCCESS) {
- LOG_FUNC_RETURN (RETURNerror);
- }
-
- /*
- * Message processing
- */
- /* Execute the authentication procedure initiated by the network */
- rc = emm_proc_authentication_request(
- msg->naskeysetidentifierasme.tsc != NAS_KEY_SET_IDENTIFIER_MAPPED,
- msg->naskeysetidentifierasme.naskeysetidentifier,
- &msg->authenticationparameterrand.rand,
- &msg->authenticationparameterautn.autn);
-
- LOG_FUNC_RETURN (rc);
-}
-
-/****************************************************************************
- ** **
- ** Name: emm_recv_authentication_reject() **
- ** **
- ** Description: Processes Authentication Reject message **
- ** **
- ** Inputs: msg: The received EMM message **
- ** Others: None **
- ** **
- ** Outputs: emm_cause: EMM cause code **
- ** Return: RETURNok, RETURNerror **
- ** Others: None **
- ** **
- ***************************************************************************/
-int emm_recv_authentication_reject(authentication_reject_msg *msg,
- int *emm_cause)
-{
- LOG_FUNC_IN;
-
- int rc;
-
- LOG_TRACE(INFO, "EMMAS-SAP - Received Authentication Reject message");
-
- /*
- * Message processing
- */
- /* Execute the authentication procedure not accepted by the network */
- rc = emm_proc_authentication_reject();
-
- LOG_FUNC_RETURN (rc);
-}
-
-/****************************************************************************
- ** **
- ** Name: emm_recv_security_mode_command() **
- ** **
- ** Description: Processes Security Mode Command message **
- ** **
- ** Inputs: msg: The received EMM message **
- ** Others: None **
- ** **
- ** Outputs: emm_cause: EMM cause code **
- ** Return: RETURNok, RETURNerror **
- ** Others: None **
- ** **
- ***************************************************************************/
-int emm_recv_security_mode_command(security_mode_command_msg *msg,
- int *emm_cause)
-{
- LOG_FUNC_IN;
-
- int rc;
-
- LOG_TRACE(INFO, "EMMAS-SAP - Received Security Mode Command message");
-
- /*
- * Message processing
- */
- /* Execute the security mode control procedure initiated by the network */
- rc = emm_proc_security_mode_command(
- msg->naskeysetidentifier.tsc != NAS_KEY_SET_IDENTIFIER_MAPPED,
- msg->naskeysetidentifier.naskeysetidentifier,
- msg->selectednassecurityalgorithms.typeofcipheringalgorithm,
- msg->selectednassecurityalgorithms.typeofintegrityalgorithm,
- msg->replayeduesecuritycapabilities.eea,
- msg->replayeduesecuritycapabilities.eia);
-
- LOG_FUNC_RETURN (rc);
-}
-
-#endif // NAS_UE
-
/*
* --------------------------------------------------------------------------
* Functions executed by the MME upon receiving EMM message from the UE
* --------------------------------------------------------------------------
*/
-#ifdef NAS_MME
/****************************************************************************
** **
** Name: emm_recv_attach_request() **
@@ -936,7 +562,7 @@ int emm_recv_identity_response(unsigned int ueid, identity_response_msg *msg,
/* Execute the identification completion procedure */
rc = emm_proc_identification_complete(ueid, p_imsi, p_imei,
- (UInt32_t *)(p_tmsi));
+ (uint32_t *)(p_tmsi));
LOG_FUNC_RETURN (rc);
}
@@ -1120,4 +746,3 @@ int emm_recv_security_mode_reject(unsigned int ueid,
LOG_FUNC_RETURN (rc);
}
-#endif // NAS_MME
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_recv.h b/openair-cn/NAS/MME/EMM/SAP/emm_recv.h
similarity index 82%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_recv.h
rename to openair-cn/NAS/MME/EMM/SAP/emm_recv.h
index 2141396207..6b59722c54 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_recv.h
+++ b/openair-cn/NAS/MME/EMM/SAP/emm_recv.h
@@ -53,23 +53,7 @@ Description Defines functions executed at the EMMAS Service Access
#include "DetachRequest.h"
#include "DetachAccept.h"
-#ifdef NAS_UE
-#include "AttachAccept.h"
-#include "AttachReject.h"
-#include "TrackingAreaUpdateAccept.h"
-#include "TrackingAreaUpdateReject.h"
-#include "ServiceReject.h"
-#include "GutiReallocationCommand.h"
-#include "AuthenticationRequest.h"
-#include "AuthenticationReject.h"
-#include "IdentityRequest.h"
-#include "NASSecurityModeCommand.h"
-#include "EmmInformation.h"
-#include "DownlinkNasTransport.h"
-#include "CsServiceNotification.h"
-#endif
-#ifdef NAS_MME
#include "AttachRequest.h"
#include "AttachComplete.h"
#include "TrackingAreaUpdateRequest.h"
@@ -83,7 +67,6 @@ Description Defines functions executed at the EMMAS Service Access
#include "NASSecurityModeComplete.h"
#include "SecurityModeReject.h"
#include "UplinkNasTransport.h"
-#endif
/****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/
@@ -113,27 +96,13 @@ int emm_recv_status(unsigned int ueid, emm_status_msg *msg, int *emm_cause);
* Functions executed by the UE upon receiving EMM message from the network
* --------------------------------------------------------------------------
*/
-#ifdef NAS_UE
-int emm_recv_attach_accept(attach_accept_msg *msg, int *emm_cause);
-int emm_recv_attach_reject(attach_reject_msg *msg, int *emm_cause);
-int emm_recv_detach_accept(detach_accept_msg *msg, int *emm_cause);
-
-int emm_recv_identity_request(identity_request_msg *msg, int *emm_cause);
-int emm_recv_authentication_request(authentication_request_msg *msg,
- int *emm_cause);
-int emm_recv_authentication_reject(authentication_reject_msg *msg,
- int *emm_cause);
-int emm_recv_security_mode_command(security_mode_command_msg *msg,
- int *emm_cause);
-#endif
/*
* --------------------------------------------------------------------------
* Functions executed by the MME upon receiving EMM message from the UE
* --------------------------------------------------------------------------
*/
-#ifdef NAS_MME
int emm_recv_attach_request(unsigned int ueid, const attach_request_msg *msg,
int *emm_cause);
int emm_recv_attach_complete(unsigned int ueid, const attach_complete_msg *msg,
@@ -156,6 +125,5 @@ int emm_recv_security_mode_complete(unsigned int ueid,
security_mode_complete_msg *msg, int *emm_cause);
int emm_recv_security_mode_reject(unsigned int ueid,
security_mode_reject_msg *msg, int *emm_cause);
-#endif
#endif /* __EMM_RECV_H__*/
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_reg.c b/openair-cn/NAS/MME/EMM/SAP/emm_reg.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_reg.c
rename to openair-cn/NAS/MME/EMM/SAP/emm_reg.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_reg.h b/openair-cn/NAS/MME/EMM/SAP/emm_reg.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_reg.h
rename to openair-cn/NAS/MME/EMM/SAP/emm_reg.h
diff --git a/openair-cn/NAS/MME/EMM/SAP/emm_regDef.h b/openair-cn/NAS/MME/EMM/SAP/emm_regDef.h
new file mode 100644
index 0000000000..801e107fe1
--- /dev/null
+++ b/openair-cn/NAS/MME/EMM/SAP/emm_regDef.h
@@ -0,0 +1,138 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+
+Source emm_regDef.h
+
+Version 0.1
+
+Date 2012/10/16
+
+Product NAS stack
+
+Subsystem EPS Mobility Management
+
+Author Frederic Maurel
+
+Description Defines the EMMREG Service Access Point that provides
+ registration services for location updating and attach/detach
+ procedures.
+
+*****************************************************************************/
+#ifndef __EMM_REGDEF_H__
+#define __EMM_REGDEF_H__
+
+#include "commonDef.h"
+
+/****************************************************************************/
+/********************* G L O B A L C O N S T A N T S *******************/
+/****************************************************************************/
+
+/*
+ * EMMREG-SAP primitives
+ */
+typedef enum {
+ _EMMREG_START = 0,
+ _EMMREG_COMMON_PROC_REQ, /* EMM common procedure requested */
+ _EMMREG_COMMON_PROC_CNF, /* EMM common procedure successful */
+ _EMMREG_COMMON_PROC_REJ, /* EMM common procedure failed */
+ _EMMREG_PROC_ABORT, /* EMM procedure aborted */
+ _EMMREG_ATTACH_CNF, /* EPS network attach accepted */
+ _EMMREG_ATTACH_REJ, /* EPS network attach rejected */
+ _EMMREG_DETACH_INIT, /* Network detach initiated */
+ _EMMREG_DETACH_REQ, /* Network detach requested */
+ _EMMREG_DETACH_FAILED, /* Network detach attempt failed */
+ _EMMREG_DETACH_CNF, /* Network detach accepted */
+ _EMMREG_TAU_REQ,
+ _EMMREG_TAU_CNF,
+ _EMMREG_TAU_REJ,
+ _EMMREG_SERVICE_REQ,
+ _EMMREG_SERVICE_CNF,
+ _EMMREG_SERVICE_REJ,
+ _EMMREG_LOWERLAYER_SUCCESS, /* Data successfully delivered */
+ _EMMREG_LOWERLAYER_FAILURE, /* Lower layer failure indication */
+ _EMMREG_LOWERLAYER_RELEASE, /* NAS signalling connection released */
+ _EMMREG_END
+} emm_reg_primitive_t;
+
+/****************************************************************************/
+/************************ G L O B A L T Y P E S ************************/
+/****************************************************************************/
+
+
+/*
+ * EMMREG primitive for attach procedure
+ * -------------------------------------
+ */
+typedef struct {
+ int is_emergency; /* TRUE if the UE was attempting to register to
+ * the network for emergency services only */
+} emm_reg_attach_t;
+
+/*
+ * EMMREG primitive for detach procedure
+ * -------------------------------------
+ */
+typedef struct {
+ int switch_off; /* TRUE if the UE is switched off */
+ int type; /* Network detach type */
+} emm_reg_detach_t;
+
+/*
+ * EMMREG primitive for EMM common procedures
+ * ------------------------------------------
+ */
+typedef struct {
+ int is_attached; /* UE context attach indicator */
+} emm_reg_common_t;
+
+/*
+ * Structure of EMMREG-SAP primitive
+ */
+typedef struct {
+ emm_reg_primitive_t primitive;
+ unsigned int ueid;
+ void *ctx;
+
+ union {
+ emm_reg_attach_t attach;
+ emm_reg_detach_t detach;
+ emm_reg_common_t common;
+ } u;
+} emm_reg_t;
+
+/****************************************************************************/
+/******************** G L O B A L V A R I A B L E S ********************/
+/****************************************************************************/
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+#endif /* __EMM_REGDEF_H__*/
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_sap.c b/openair-cn/NAS/MME/EMM/SAP/emm_sap.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_sap.c
rename to openair-cn/NAS/MME/EMM/SAP/emm_sap.c
diff --git a/openair-cn/NAS/MME/EMM/SAP/emm_sap.h b/openair-cn/NAS/MME/EMM/SAP/emm_sap.h
new file mode 100644
index 0000000000..7cee702e60
--- /dev/null
+++ b/openair-cn/NAS/MME/EMM/SAP/emm_sap.h
@@ -0,0 +1,171 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+
+Source emm_sap.h
+
+Version 0.1
+
+Date 2012/10/01
+
+Product NAS stack
+
+Subsystem EPS Mobility Management
+
+Author Frederic Maurel
+
+Description Defines the EMM Service Access Points at which the EPS
+ Mobility Management sublayer provides procedures for the
+ control of security and mobility when the User Equipment
+ is using the Evolved UTRA Network.
+
+*****************************************************************************/
+#ifndef __EMM_SAP_H__
+#define __EMM_SAP_H__
+
+#include "emmData.h"
+#include "emm_regDef.h"
+#include "emm_esmDef.h"
+#include "emm_asDef.h"
+#include "emm_cnDef.h"
+
+/****************************************************************************/
+/********************* G L O B A L C O N S T A N T S *******************/
+/****************************************************************************/
+
+/*
+ * EPS Mobility Management primitives
+ * ----------------------------------
+ * EMMREG-SAP provides registration services for location updating and
+ * attach/detach procedures;
+ * EMMESM-SAP provides interlayer services to the EPS Session Management
+ * sublayer for service registration and activate/deactivate PDP context;
+ * EMMAS-SAP provides services to the Access Stratum sublayer for NAS message
+ * transfer;
+ */
+typedef enum {
+ /* EMMREG-SAP */
+ EMMREG_COMMON_PROC_REQ = _EMMREG_COMMON_PROC_REQ,
+ EMMREG_COMMON_PROC_CNF = _EMMREG_COMMON_PROC_CNF,
+ EMMREG_COMMON_PROC_REJ = _EMMREG_COMMON_PROC_REJ,
+ EMMREG_PROC_ABORT = _EMMREG_PROC_ABORT,
+ EMMREG_ATTACH_CNF = _EMMREG_ATTACH_CNF,
+ EMMREG_ATTACH_REJ = _EMMREG_ATTACH_REJ,
+ EMMREG_DETACH_INIT = _EMMREG_DETACH_INIT,
+ EMMREG_DETACH_REQ = _EMMREG_DETACH_REQ,
+ EMMREG_DETACH_FAILED = _EMMREG_DETACH_FAILED,
+ EMMREG_DETACH_CNF = _EMMREG_DETACH_CNF,
+ EMMREG_TAU_REQ = _EMMREG_TAU_REQ,
+ EMMREG_TAU_CNF = _EMMREG_TAU_CNF,
+ EMMREG_TAU_REJ = _EMMREG_TAU_REJ,
+ EMMREG_SERVICE_REQ = _EMMREG_SERVICE_REQ,
+ EMMREG_SERVICE_CNF = _EMMREG_SERVICE_CNF,
+ EMMREG_SERVICE_REJ = _EMMREG_SERVICE_REJ,
+ EMMREG_LOWERLAYER_SUCCESS = _EMMREG_LOWERLAYER_SUCCESS,
+ EMMREG_LOWERLAYER_FAILURE = _EMMREG_LOWERLAYER_FAILURE,
+ EMMREG_LOWERLAYER_RELEASE = _EMMREG_LOWERLAYER_RELEASE,
+ /* EMMESM-SAP */
+ EMMESM_RELEASE_IND = _EMMESM_RELEASE_IND,
+ EMMESM_UNITDATA_REQ = _EMMESM_UNITDATA_REQ,
+ EMMESM_UNITDATA_IND = _EMMESM_UNITDATA_IND,
+ /* EMMAS-SAP */
+ EMMAS_SECURITY_REQ = _EMMAS_SECURITY_REQ,
+ EMMAS_SECURITY_IND = _EMMAS_SECURITY_IND,
+ EMMAS_SECURITY_RES = _EMMAS_SECURITY_RES,
+ EMMAS_SECURITY_REJ = _EMMAS_SECURITY_REJ,
+ EMMAS_ESTABLISH_REQ = _EMMAS_ESTABLISH_REQ,
+ EMMAS_ESTABLISH_CNF = _EMMAS_ESTABLISH_CNF,
+ EMMAS_ESTABLISH_REJ = _EMMAS_ESTABLISH_REJ,
+ EMMAS_RELEASE_REQ = _EMMAS_RELEASE_REQ,
+ EMMAS_RELEASE_IND = _EMMAS_RELEASE_IND,
+ EMMAS_DATA_REQ = _EMMAS_DATA_REQ,
+ EMMAS_DATA_IND = _EMMAS_DATA_IND,
+ EMMAS_PAGE_IND = _EMMAS_PAGE_IND,
+ EMMAS_STATUS_IND = _EMMAS_STATUS_IND,
+ EMMAS_CELL_INFO_REQ = _EMMAS_CELL_INFO_REQ,
+ EMMAS_CELL_INFO_RES = _EMMAS_CELL_INFO_RES,
+ EMMAS_CELL_INFO_IND = _EMMAS_CELL_INFO_IND,
+
+#ifdef NAS_BUILT_IN_EPC
+ EMMCN_AUTHENTICATION_PARAM_RES = _EMMCN_AUTHENTICATION_PARAM_RES,
+ EMMCN_AUTHENTICATION_PARAM_FAIL = _EMMCN_AUTHENTICATION_PARAM_FAIL,
+ EMMCN_DEREGISTER_UE = _EMMCN_DEREGISTER_UE,
+ EMMCN_PDN_CONNECTIVITY_RES = _EMMCN_PDN_CONNECTIVITY_RES,
+ EMMCN_PDN_CONNECTIVITY_FAIL = _EMMCN_PDN_CONNECTIVITY_FAIL
+#endif
+} emm_primitive_t;
+
+/*
+ * Minimal identifier for EMM-SAP primitives
+ */
+#define EMMREG_PRIMITIVE_MIN _EMMREG_START
+#define EMMESM_PRIMITIVE_MIN _EMMESM_START
+#define EMMAS_PRIMITIVE_MIN _EMMAS_START
+#define EMMCN_PRIMITIVE_MIN _EMMCN_START
+
+/*
+ * Maximal identifier for EMM-SAP primitives
+ */
+#define EMMREG_PRIMITIVE_MAX _EMMREG_END
+#define EMMESM_PRIMITIVE_MAX _EMMESM_END
+#define EMMAS_PRIMITIVE_MAX _EMMAS_END
+#define EMMCN_PRIMITIVE_MAX _EMMCN_END
+
+/****************************************************************************/
+/************************ G L O B A L T Y P E S ************************/
+/****************************************************************************/
+
+/*
+ * Structure of EPS Mobility Management primitive
+ */
+typedef struct emm_sap_s {
+ emm_primitive_t primitive;
+ union {
+ emm_reg_t emm_reg; /* EMMREG-SAP primitives */
+ emm_esm_t emm_esm; /* EMMESM-SAP primitives */
+ emm_as_t emm_as; /* EMMAS-SAP primitives */
+#if defined(NAS_BUILT_IN_EPC)
+ emm_cn_t emm_cn; /* EMMCN-SAP primitives */
+#endif
+ } u;
+} emm_sap_t;
+
+/****************************************************************************/
+/******************** G L O B A L V A R I A B L E S ********************/
+/****************************************************************************/
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+void emm_sap_initialize(void);
+
+int emm_sap_send(emm_sap_t *msg);
+
+#endif /* __EMM_SAP_H__*/
diff --git a/openair-cn/NAS/MME/EMM/SAP/emm_send.c b/openair-cn/NAS/MME/EMM/SAP/emm_send.c
new file mode 100644
index 0000000000..3dac6eb7e0
--- /dev/null
+++ b/openair-cn/NAS/MME/EMM/SAP/emm_send.c
@@ -0,0 +1,509 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+
+Source emm_send.c
+
+Version 0.1
+
+Date 2013/01/30
+
+Product NAS stack
+
+Subsystem EPS Mobility Management
+
+Author Frederic Maurel
+
+Description Defines functions executed at the EMMAS Service Access
+ Point to send EPS Mobility Management messages to the
+ Access Stratum sublayer.
+
+*****************************************************************************/
+
+#include "emm_send.h"
+#include "commonDef.h"
+#include "nas_log.h"
+
+#include "emm_msgDef.h"
+#include "emm_proc.h"
+
+#include // strlen
+
+/****************************************************************************/
+/**************** E X T E R N A L D E F I N I T I O N S ****************/
+/****************************************************************************/
+
+/****************************************************************************/
+/******************* L O C A L D E F I N I T I O N S *******************/
+/****************************************************************************/
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+/*
+ * --------------------------------------------------------------------------
+ * Functions executed by both the UE and the MME to send EMM messages
+ * --------------------------------------------------------------------------
+ */
+/****************************************************************************
+ ** **
+ ** Name: emm_send_status() **
+ ** **
+ ** Description: Builds EMM status message **
+ ** **
+ ** The EMM status message is sent by the UE or the network **
+ ** at any time to report certain error conditions. **
+ ** **
+ ** Inputs: emm_cause: EMM cause code **
+ ** Others: None **
+ ** **
+ ** Outputs: emm_msg: The EMM message to be sent **
+ ** Return: The size of the EMM message **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int emm_send_status(const emm_as_status_t *msg, emm_status_msg *emm_msg)
+{
+ LOG_FUNC_IN;
+
+ int size = EMM_HEADER_MAXIMUM_LENGTH;
+
+ LOG_TRACE(WARNING, "EMMAS-SAP - Send EMM Status message (cause=%d)",
+ msg->emm_cause);
+
+ /* Mandatory - Message type */
+ emm_msg->messagetype = EMM_STATUS;
+
+ /* Mandatory - EMM cause */
+ size += EMM_CAUSE_MAXIMUM_LENGTH;
+ emm_msg->emmcause = msg->emm_cause;
+
+ LOG_FUNC_RETURN (size);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: emm_send_detach_accept() **
+ ** **
+ ** Description: Builds Detach Accept message **
+ ** **
+ ** The Detach Accept message is sent by the UE or the net- **
+ ** work to indicate that the detach procedure has been com- **
+ ** pleted. **
+ ** **
+ ** Inputs: msg: The EMMAS-SAP primitive to process **
+ ** Others: None **
+ ** **
+ ** Outputs: emm_msg: The EMM message to be sent **
+ ** Return: The size of the EMM message **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int emm_send_detach_accept(const emm_as_data_t *msg,
+ detach_accept_msg *emm_msg)
+{
+ LOG_FUNC_IN;
+
+ int size = EMM_HEADER_MAXIMUM_LENGTH;
+
+ LOG_TRACE(INFO, "EMMAS-SAP - Send Detach Accept message");
+
+ /* Mandatory - Message type */
+ emm_msg->messagetype = DETACH_ACCEPT;
+
+ LOG_FUNC_RETURN (size);
+}
+
+
+/*
+ * --------------------------------------------------------------------------
+ * Functions executed by the MME to send EMM messages to the UE
+ * --------------------------------------------------------------------------
+ */
+/****************************************************************************
+ ** **
+ ** Name: emm_send_attach_accept() **
+ ** **
+ ** Description: Builds Attach Accept message **
+ ** **
+ ** The Attach Accept message is sent by the network to the **
+ ** UE to indicate that the corresponding attach request has **
+ ** been accepted. **
+ ** **
+ ** Inputs: msg: The EMMAS-SAP primitive to process **
+ ** Others: None **
+ ** **
+ ** Outputs: emm_msg: The EMM message to be sent **
+ ** Return: The size of the EMM message **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int emm_send_attach_accept(const emm_as_establish_t *msg,
+ attach_accept_msg *emm_msg)
+{
+ LOG_FUNC_IN;
+
+ int size = EMM_HEADER_MAXIMUM_LENGTH;
+
+ LOG_TRACE(INFO, "EMMAS-SAP - Send Attach Accept message");
+ LOG_TRACE(INFO, "EMMAS-SAP - size = EMM_HEADER_MAXIMUM_LENGTH(%d)",
+ size);
+
+ /* Mandatory - Message type */
+ emm_msg->messagetype = ATTACH_ACCEPT;
+
+ /* Mandatory - EPS attach result */
+ size += EPS_ATTACH_RESULT_MAXIMUM_LENGTH;
+ emm_msg->epsattachresult = EPS_ATTACH_RESULT_EPS;
+
+ /* Mandatory - T3412 value */
+ size += GPRS_TIMER_MAXIMUM_LENGTH;
+ emm_msg->t3412value.unit = GPRS_TIMER_UNIT_0S;
+ LOG_TRACE(INFO, "EMMAS-SAP - size += GPRS_TIMER_MAXIMUM_LENGTH(%d) (%d)",
+ GPRS_TIMER_MAXIMUM_LENGTH, size);
+
+ /* Mandatory - Tracking area identity list */
+ size += TRACKING_AREA_IDENTITY_LIST_MINIMUM_LENGTH;
+ emm_msg->tailist.typeoflist =
+ TRACKING_AREA_IDENTITY_LIST_ONE_PLMN_CONSECUTIVE_TACS;
+ emm_msg->tailist.numberofelements = msg->n_tacs;
+ emm_msg->tailist.mccdigit1 = msg->UEid.guti->gummei.plmn.MCCdigit1;
+ emm_msg->tailist.mccdigit2 = msg->UEid.guti->gummei.plmn.MCCdigit2;
+ emm_msg->tailist.mccdigit3 = msg->UEid.guti->gummei.plmn.MCCdigit3;
+ emm_msg->tailist.mncdigit1 = msg->UEid.guti->gummei.plmn.MNCdigit1;
+ emm_msg->tailist.mncdigit2 = msg->UEid.guti->gummei.plmn.MNCdigit2;
+ emm_msg->tailist.mncdigit3 = msg->UEid.guti->gummei.plmn.MNCdigit3;
+ emm_msg->tailist.tac = msg->tac;
+ LOG_TRACE(INFO,
+ "EMMAS-SAP - size += "\
+ "TRACKING_AREA_IDENTITY_LIST_MINIMUM_LENGTH(%d) (%d)",
+ TRACKING_AREA_IDENTITY_LIST_MINIMUM_LENGTH,
+ size);
+
+ /* Mandatory - ESM message container */
+ size += ESM_MESSAGE_CONTAINER_MINIMUM_LENGTH + msg->NASmsg.length;
+ emm_msg->esmmessagecontainer.esmmessagecontainercontents = msg->NASmsg;
+ LOG_TRACE(INFO,
+ "EMMAS-SAP - size += "\
+ "ESM_MESSAGE_CONTAINER_MINIMUM_LENGTH(%d) (%d)",
+ ESM_MESSAGE_CONTAINER_MINIMUM_LENGTH,
+ size);
+
+ /* Optional - GUTI */
+ if (msg->new_guti) {
+ size += EPS_MOBILE_IDENTITY_MAXIMUM_LENGTH;
+ emm_msg->presencemask |= ATTACH_ACCEPT_GUTI_PRESENT;
+ emm_msg->guti.guti.typeofidentity = EPS_MOBILE_IDENTITY_GUTI;
+ emm_msg->guti.guti.oddeven = EPS_MOBILE_IDENTITY_EVEN;
+ emm_msg->guti.guti.mmegroupid = msg->new_guti->gummei.MMEgid;
+ emm_msg->guti.guti.mmecode = msg->new_guti->gummei.MMEcode;
+ emm_msg->guti.guti.mtmsi = msg->new_guti->m_tmsi;
+ emm_msg->guti.guti.mccdigit1 = msg->new_guti->gummei.plmn.MCCdigit1;
+ emm_msg->guti.guti.mccdigit2 = msg->new_guti->gummei.plmn.MCCdigit2;
+ emm_msg->guti.guti.mccdigit3 = msg->new_guti->gummei.plmn.MCCdigit3;
+ emm_msg->guti.guti.mncdigit1 = msg->new_guti->gummei.plmn.MNCdigit1;
+ emm_msg->guti.guti.mncdigit2 = msg->new_guti->gummei.plmn.MNCdigit2;
+ emm_msg->guti.guti.mncdigit3 = msg->new_guti->gummei.plmn.MNCdigit3;
+ LOG_TRACE(INFO,
+ "EMMAS-SAP - size += "\
+ "EPS_MOBILE_IDENTITY_MAXIMUM_LENGTH(%d) (%d)",
+ EPS_MOBILE_IDENTITY_MAXIMUM_LENGTH,
+ size);
+ }
+
+ LOG_FUNC_RETURN (size);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: emm_send_attach_reject() **
+ ** **
+ ** Description: Builds Attach Reject message **
+ ** **
+ ** The Attach Reject message is sent by the network to the **
+ ** UE to indicate that the corresponding attach request has **
+ ** been rejected. **
+ ** **
+ ** Inputs: msg: The EMMAS-SAP primitive to process **
+ ** Others: None **
+ ** **
+ ** Outputs: emm_msg: The EMM message to be sent **
+ ** Return: The size of the EMM message **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int emm_send_attach_reject(const emm_as_establish_t *msg,
+ attach_reject_msg *emm_msg)
+{
+ LOG_FUNC_IN;
+
+ int size = EMM_HEADER_MAXIMUM_LENGTH;
+
+ LOG_TRACE(INFO, "EMMAS-SAP - Send Attach Reject message (cause=%d)",
+ msg->emm_cause);
+
+ /* Mandatory - Message type */
+ emm_msg->messagetype = ATTACH_REJECT;
+
+ /* Mandatory - EMM cause */
+ size += EMM_CAUSE_MAXIMUM_LENGTH;
+ emm_msg->emmcause = msg->emm_cause;
+
+ /* Optional - ESM message container */
+ if (msg->NASmsg.length > 0) {
+ size += ESM_MESSAGE_CONTAINER_MINIMUM_LENGTH + msg->NASmsg.length;
+ emm_msg->presencemask |= ATTACH_REJECT_ESM_MESSAGE_CONTAINER_PRESENT;
+ emm_msg->esmmessagecontainer.esmmessagecontainercontents = msg->NASmsg;
+ }
+
+ LOG_FUNC_RETURN (size);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: emm_send_tracking_area_update_reject() **
+ ** **
+ ** Description: Builds Tracking Area Update Reject message **
+ ** **
+ ** The Tracking Area Update Reject message is sent by the **
+ ** network to the UE to indicate that the corresponding **
+ ** tracking area update has been rejected. **
+ ** **
+ ** Inputs: msg: The EMMAS-SAP primitive to process **
+ ** Others: None **
+ ** **
+ ** Outputs: emm_msg: The EMM message to be sent **
+ ** Return: The size of the EMM message **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int emm_send_tracking_area_update_reject(const emm_as_establish_t *msg,
+ tracking_area_update_reject_msg *emm_msg)
+{
+ LOG_FUNC_IN;
+
+ int size = EMM_HEADER_MAXIMUM_LENGTH;
+
+ LOG_TRACE(INFO, "EMMAS-SAP - Send Tracking Area Update Reject message (cause=%d)",
+ msg->emm_cause);
+
+ /* Mandatory - Message type */
+ emm_msg->messagetype = TRACKING_AREA_UPDATE_REJECT;
+
+ /* Mandatory - EMM cause */
+ size += EMM_CAUSE_MAXIMUM_LENGTH;
+ emm_msg->emmcause = msg->emm_cause;
+
+ LOG_FUNC_RETURN (size);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: emm_send_identity_request() **
+ ** **
+ ** Description: Builds Identity Request message **
+ ** **
+ ** The Identity Request message is sent by the network to **
+ ** the UE to request the UE to provide the specified identi- **
+ ** ty. **
+ ** **
+ ** Inputs: msg: The EMMAS-SAP primitive to process **
+ ** Others: None **
+ ** **
+ ** Outputs: emm_msg: The EMM message to be sent **
+ ** Return: The size of the EMM message **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int emm_send_identity_request(const emm_as_security_t *msg,
+ identity_request_msg *emm_msg)
+{
+ LOG_FUNC_IN;
+
+ int size = EMM_HEADER_MAXIMUM_LENGTH;
+
+ LOG_TRACE(INFO, "EMMAS-SAP - Send Identity Request message");
+
+ /* Mandatory - Message type */
+ emm_msg->messagetype = IDENTITY_REQUEST;
+
+ /* Mandatory - Identity type 2 */
+ size += IDENTITY_TYPE_2_MAXIMUM_LENGTH;
+
+ if (msg->identType == EMM_IDENT_TYPE_IMSI) {
+ emm_msg->identitytype = IDENTITY_TYPE_2_IMSI;
+ } else if (msg->identType == EMM_IDENT_TYPE_TMSI) {
+ emm_msg->identitytype = IDENTITY_TYPE_2_TMSI;
+ } else if (msg->identType == EMM_IDENT_TYPE_IMEI) {
+ emm_msg->identitytype = IDENTITY_TYPE_2_IMEI;
+ } else {
+ /* All other values are interpreted as "IMSI" */
+ emm_msg->identitytype = IDENTITY_TYPE_2_IMSI;
+ }
+
+ LOG_FUNC_RETURN (size);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: emm_send_authentication_request() **
+ ** **
+ ** Description: Builds Authentication Request message **
+ ** **
+ ** The Authentication Request message is sent by the network **
+ ** to the UE to initiate authentication of the UE identity. **
+ ** **
+ ** Inputs: msg: The EMMAS-SAP primitive to process **
+ ** Others: None **
+ ** **
+ ** Outputs: emm_msg: The EMM message to be sent **
+ ** Return: The size of the EMM message **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int emm_send_authentication_request(const emm_as_security_t *msg,
+ authentication_request_msg *emm_msg)
+{
+ LOG_FUNC_IN;
+
+ int size = EMM_HEADER_MAXIMUM_LENGTH;
+
+ LOG_TRACE(INFO, "EMMAS-SAP - Send Authentication Request message");
+
+ /* Mandatory - Message type */
+ emm_msg->messagetype = AUTHENTICATION_REQUEST;
+
+ /* Mandatory - NAS key set identifier */
+ size += NAS_KEY_SET_IDENTIFIER_MAXIMUM_LENGTH;
+ emm_msg->naskeysetidentifierasme.tsc = NAS_KEY_SET_IDENTIFIER_NATIVE;
+ emm_msg->naskeysetidentifierasme.naskeysetidentifier = msg->ksi;
+
+ /* Mandatory - Authentication parameter RAND */
+ size += AUTHENTICATION_PARAMETER_RAND_MAXIMUM_LENGTH;
+ emm_msg->authenticationparameterrand.rand = *msg->rand;
+
+ /* Mandatory - Authentication parameter AUTN */
+ size += AUTHENTICATION_PARAMETER_AUTN_MAXIMUM_LENGTH;
+ emm_msg->authenticationparameterautn.autn = *msg->autn;
+
+ LOG_FUNC_RETURN (size);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: emm_send_authentication_reject() **
+ ** **
+ ** Description: Builds Authentication Reject message **
+ ** **
+ ** The Authentication Reject message is sent by the network **
+ ** to the UE to indicate that the authentication procedure **
+ ** has failed and that the UE shall abort all activities. **
+ ** **
+ ** Inputs: None **
+ ** Others: None **
+ ** **
+ ** Outputs: emm_msg: The EMM message to be sent **
+ ** Return: The size of the EMM message **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int emm_send_authentication_reject(authentication_reject_msg *emm_msg)
+{
+ LOG_FUNC_IN;
+
+ int size = EMM_HEADER_MAXIMUM_LENGTH;
+
+ LOG_TRACE(INFO, "EMMAS-SAP - Send Authentication Reject message");
+
+ /* Mandatory - Message type */
+ emm_msg->messagetype = AUTHENTICATION_REJECT;
+
+ LOG_FUNC_RETURN (size);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: emm_send_security_mode_command() **
+ ** **
+ ** Description: Builds Security Mode Command message **
+ ** **
+ ** The Security Mode Command message is sent by the network **
+ ** to the UE to establish NAS signalling security. **
+ ** **
+ ** Inputs: msg: The EMMAS-SAP primitive to process **
+ ** Others: None **
+ ** **
+ ** Outputs: emm_msg: The EMM message to be sent **
+ ** Return: The size of the EMM message **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int emm_send_security_mode_command(const emm_as_security_t *msg,
+ security_mode_command_msg *emm_msg)
+{
+ LOG_FUNC_IN;
+
+ int size = EMM_HEADER_MAXIMUM_LENGTH;
+
+ LOG_TRACE(INFO, "EMMAS-SAP - Send Security Mode Command message");
+
+ /* Mandatory - Message type */
+ emm_msg->messagetype = SECURITY_MODE_COMMAND;
+
+ /* Selected NAS security algorithms */
+ size += NAS_SECURITY_ALGORITHMS_MAXIMUM_LENGTH;
+ emm_msg->selectednassecurityalgorithms.typeofcipheringalgorithm =
+ msg->selected_eea;
+ emm_msg->selectednassecurityalgorithms.typeofintegrityalgorithm =
+ msg->selected_eia;
+
+ /* NAS key set identifier */
+ size += NAS_KEY_SET_IDENTIFIER_MAXIMUM_LENGTH;
+ emm_msg->naskeysetidentifier.tsc = NAS_KEY_SET_IDENTIFIER_NATIVE;
+ emm_msg->naskeysetidentifier.naskeysetidentifier = msg->ksi;
+
+ /* Replayed UE security capabilities */
+ size += UE_SECURITY_CAPABILITY_MAXIMUM_LENGTH;
+ emm_msg->replayeduesecuritycapabilities.eea = msg->eea;
+ emm_msg->replayeduesecuritycapabilities.eia = msg->eia;
+ emm_msg->replayeduesecuritycapabilities.umts_present = msg->umts_present;
+ emm_msg->replayeduesecuritycapabilities.gprs_present = msg->gprs_present;
+
+ emm_msg->replayeduesecuritycapabilities.uea = msg->uea;
+ emm_msg->replayeduesecuritycapabilities.uia = msg->uia;
+ emm_msg->replayeduesecuritycapabilities.gea = msg->gea;
+
+ LOG_FUNC_RETURN (size);
+}
+
+
+/****************************************************************************/
+/********************* L O C A L F U N C T I O N S *********************/
+/****************************************************************************/
diff --git a/openair-cn/NAS/MME/EMM/SAP/emm_send.h b/openair-cn/NAS/MME/EMM/SAP/emm_send.h
new file mode 100644
index 0000000000..16c9c5f9d5
--- /dev/null
+++ b/openair-cn/NAS/MME/EMM/SAP/emm_send.h
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+
+Source emm_send.h
+
+Version 0.1
+
+Date 2013/01/30
+
+Product NAS stack
+
+Subsystem EPS Mobility Management
+
+Author Frederic Maurel
+
+Description Defines functions executed at the EMMAS Service Access
+ Point to send EPS Mobility Management messages to the
+ Access Stratum sublayer.
+
+*****************************************************************************/
+#ifndef __EMM_SEND_H__
+#define __EMM_SEND_H__
+
+#include "EmmStatus.h"
+
+#include "DetachRequest.h"
+#include "DetachAccept.h"
+
+#include "AttachAccept.h"
+#include "AttachReject.h"
+#include "TrackingAreaUpdateAccept.h"
+#include "TrackingAreaUpdateReject.h"
+#include "ServiceReject.h"
+#include "GutiReallocationCommand.h"
+#include "AuthenticationRequest.h"
+#include "AuthenticationReject.h"
+#include "IdentityRequest.h"
+#include "NASSecurityModeCommand.h"
+#include "EmmInformation.h"
+#include "DownlinkNasTransport.h"
+#include "CsServiceNotification.h"
+
+#include "emm_asDef.h"
+
+/****************************************************************************/
+/********************* G L O B A L C O N S T A N T S *******************/
+/****************************************************************************/
+
+/****************************************************************************/
+/************************ G L O B A L T Y P E S ************************/
+/****************************************************************************/
+
+/****************************************************************************/
+/******************** G L O B A L V A R I A B L E S ********************/
+/****************************************************************************/
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+/*
+ * --------------------------------------------------------------------------
+ * Functions executed by both the UE and the MME to send EMM messages
+ * --------------------------------------------------------------------------
+ */
+int emm_send_status(const emm_as_status_t *, emm_status_msg *);
+
+int emm_send_detach_accept(const emm_as_data_t *, detach_accept_msg *);
+
+/*
+ * --------------------------------------------------------------------------
+ * Functions executed by the UE to send EMM messages to the network
+ * --------------------------------------------------------------------------
+ */
+
+
+/*
+ * --------------------------------------------------------------------------
+ * Functions executed by the MME to send EMM messages to the UE
+ * --------------------------------------------------------------------------
+ */
+int emm_send_attach_accept(const emm_as_establish_t *, attach_accept_msg *);
+int emm_send_attach_reject(const emm_as_establish_t *, attach_reject_msg *);
+
+int emm_send_tracking_area_update_reject(const emm_as_establish_t *msg,
+ tracking_area_update_reject_msg *emm_msg);
+
+int emm_send_identity_request(const emm_as_security_t *, identity_request_msg *);
+int emm_send_authentication_request(const emm_as_security_t *,
+ authentication_request_msg *);
+int emm_send_authentication_reject(authentication_reject_msg *);
+int emm_send_security_mode_command(const emm_as_security_t *,
+ security_mode_command_msg *);
+
+#endif /* __EMM_SEND_H__*/
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/SecurityModeControl.c b/openair-cn/NAS/MME/EMM/SecurityModeControl.c
similarity index 58%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/SecurityModeControl.c
rename to openair-cn/NAS/MME/EMM/SecurityModeControl.c
index eaceb2fd17..bd04316ee2 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/SecurityModeControl.c
+++ b/openair-cn/NAS/MME/EMM/SecurityModeControl.c
@@ -87,33 +87,12 @@ Description Defines the security mode control EMM procedure executed by the
* Internal data handled by the security mode control procedure in the UE
* --------------------------------------------------------------------------
*/
-#ifdef NAS_UE
-static int _security_kdf(const OctetString *kasme, OctetString *key,
- UInt8_t algo_dist, UInt8_t algo_id);
-
-static int _security_knas_enc(const OctetString *kasme, OctetString *knas_enc,
- UInt8_t eia);
-static int _security_knas_int(const OctetString *kasme, OctetString *knas_int,
- UInt8_t eea);
-static int _security_kenb(const OctetString *kasme, OctetString *kenb,
- UInt32_t count);
-
-/*
- * Internal data used for security mode control procedure
- */
-static struct {
- OctetString kenb; /* eNodeB security key */
-} _security_data;
-
-static void _security_release(emm_security_context_t *ctx);
-#endif // NAS_UE
/*
* --------------------------------------------------------------------------
* Internal data handled by the security mode control procedure in the MME
* --------------------------------------------------------------------------
*/
-#ifdef NAS_MME
/*
* Timer handlers
*/
@@ -154,245 +133,17 @@ typedef struct {
} security_data_t;
static int _security_request(security_data_t *data, int is_new);
-#endif // NAS_MME
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
-/*
- * --------------------------------------------------------------------------
- * Security mode control procedure executed by the UE
- * --------------------------------------------------------------------------
- */
-#ifdef NAS_UE
-/****************************************************************************
- ** **
- ** Name: emm_proc_security_mode_command() **
- ** **
- ** Description: Performs the MME requested security mode control proce- **
- ** dure. **
- ** **
- ** 3GPP TS 24.301, section 5.4.3.3 **
- ** Upon receiving the SECURITY MODE COMMAND message, the UE **
- ** shall check whether the message can be accepted or not. **
- ** If accepted the UE shall send a SECURITY MODE COMPLETE **
- ** message integrity protected with the selected NAS inte- **
- ** grity algorithm and ciphered with the selected NAS ciphe- **
- ** ring algorithm. **
- ** **
- ** Inputs: native_ksi: TRUE if the security context is of type **
- ** native (for KSIASME) **
- ** ksi: The NAS ket sey identifier **
- ** seea: Selected EPS cyphering algorithm **
- ** seia: Selected EPS integrity algorithm **
- ** reea: Replayed EPS cyphering algorithm **
- ** reia: Replayed EPS integrity algorithm **
- ** Others: None **
- ** **
- ** Outputs: None **
- ** Return: RETURNok, RETURNerror **
- ** Others: None **
- ** **
- ***************************************************************************/
-int emm_proc_security_mode_command(int native_ksi, int ksi,
- int seea, int seia, int reea, int reia)
-{
- LOG_FUNC_IN;
-
- int rc = RETURNerror;
- int emm_cause = EMM_CAUSE_SUCCESS;
- int security_context_is_new = FALSE;
-
- LOG_TRACE(INFO, "EMM-PROC - Security mode control requested (ksi=%d)",
- ksi);
-
- /* Delete any previously stored RAND and RES and stop timer T3416 */
- (void) emm_proc_authentication_delete();
-
- /*
- * Check the replayed UE security capabilities
- */
- UInt8_t eea = (0x80 >> _emm_data.security->capability.eps_encryption);
- UInt8_t eia = (0x80 >> _emm_data.security->capability.eps_integrity);
-
- if ( (reea != eea) || (reia != eia) ) {
- LOG_TRACE(WARNING, "EMM-PROC - Replayed UE security capabilities "
- "rejected");
- emm_cause = EMM_CAUSE_UE_SECURITY_MISMATCH;
-
- /* XXX - For testing purpose UE always accepts EIA0
- * The UE shall accept "null integrity protection algorithm" EIA0 only
- * if a PDN connection for emergency bearer services is established or
- * the UE is establishing a PDN connection for emergency bearer services
- */
- }
- /*
- * Check the non-current EPS security context
- */
- else if (_emm_data.non_current == NULL) {
- LOG_TRACE(WARNING, "EMM-PROC - Non-current EPS security context "
- "is not valid");
- emm_cause = EMM_CAUSE_SECURITY_MODE_REJECTED;
- }
- /*
- * Update the non-current EPS security context
- */
- else {
- LOG_TRACE(INFO, "EMM-PROC - Update the non-current EPS security context seea=%u seia=%u", seea, seia);
- /* Update selected cyphering and integrity algorithms */
- //LG COMENTED _emm_data.non_current->capability.encryption = seea;
- //LG COMENTED _emm_data.non_current->capability.integrity = seia;
-
- _emm_data.non_current->selected_algorithms.encryption = seea;
- _emm_data.non_current->selected_algorithms.integrity = seia;
-
- /* Derive the NAS cyphering key */
- if (_emm_data.non_current->knas_enc.value == NULL) {
- _emm_data.non_current->knas_enc.value =
- (uint8_t *)calloc(1,AUTH_KNAS_ENC_SIZE);
- _emm_data.non_current->knas_enc.length = AUTH_KNAS_ENC_SIZE;
- }
-
- if (_emm_data.non_current->knas_enc.value != NULL) {
- LOG_TRACE(INFO, "EMM-PROC - Update the non-current EPS security context knas_enc");
- rc = _security_knas_enc(&_emm_data.non_current->kasme,
- &_emm_data.non_current->knas_enc, seea);
- }
-
- /* Derive the NAS integrity key */
- if (_emm_data.non_current->knas_int.value == NULL) {
- _emm_data.non_current->knas_int.value =
- (uint8_t *)calloc(1,AUTH_KNAS_INT_SIZE);
- _emm_data.non_current->knas_int.length = AUTH_KNAS_INT_SIZE;
- }
-
- if (_emm_data.non_current->knas_int.value != NULL) {
- if (rc != RETURNerror) {
- LOG_TRACE(INFO, "EMM-PROC - Update the non-current EPS security context knas_int");
- rc = _security_knas_int(&_emm_data.non_current->kasme,
- &_emm_data.non_current->knas_int, seia);
- }
- }
-
- /* Derive the eNodeB key */
- if (_security_data.kenb.value == NULL) {
- _security_data.kenb.value = (uint8_t *)calloc(1,AUTH_KENB_SIZE);
- _security_data.kenb.length = AUTH_KENB_SIZE;
- }
-
- if (_security_data.kenb.value != NULL) {
- if (rc != RETURNerror) {
- LOG_TRACE(INFO, "EMM-PROC - Update the non-current EPS security context kenb");
- // LG COMMENT rc = _security_kenb(&_emm_data.security->kasme,
- rc = _security_kenb(&_emm_data.non_current->kasme,
- &_security_data.kenb,
- *(UInt32_t *)(&_emm_data.non_current->ul_count));
- }
- }
-
- /*
- * NAS security mode command accepted by the UE
- */
- if (rc != RETURNerror) {
- LOG_TRACE(INFO, "EMM-PROC - NAS security mode command accepted by the UE");
-
- /* Update the current EPS security context */
- if ( native_ksi && (_emm_data.security->type != EMM_KSI_NATIVE) ) {
- /* The type of security context flag included in the SECURITY
- * MODE COMMAND message is set to "native security context" and
- * the UE has a mapped EPS security context as the current EPS
- * security context */
- if ( (_emm_data.non_current->type == EMM_KSI_NATIVE) &&
- (_emm_data.non_current->eksi == ksi) ) {
- /* The KSI matches the non-current native EPS security
- * context; the UE shall take the non-current native EPS
- * security context into use which then becomes the
- * current native EPS security context and delete the
- * mapped EPS security context */
- LOG_TRACE(INFO,
- "EMM-PROC - Update Current security context");
- /* Release non-current security context */
- _security_release(_emm_data.security);
- _emm_data.security = _emm_data.non_current;
- /* Reset the uplink NAS COUNT counter */
- _emm_data.security->ul_count.overflow = 0;
- _emm_data.security->ul_count.seq_num = 0;
- /* Set new security context indicator */
- security_context_is_new = TRUE;
- }
- }
-
- if ( !native_ksi && (_emm_data.security->type != EMM_KSI_NATIVE) ) {
- /* The type of security context flag included in the SECURITY
- * MODE COMMAND message is set to "mapped security context" and
- * the UE has a mapped EPS security context as the current EPS
- * security context */
- if (ksi != _emm_data.security->eksi) {
- /* The KSI does not match the current EPS security context;
- * the UE shall reset the uplink NAS COUNT counter */
- LOG_TRACE(INFO,
- "EMM-PROC - Reset uplink NAS COUNT counter");
- _emm_data.security->ul_count.overflow = 0;
- _emm_data.security->ul_count.seq_num = 0;
- }
- }
-
- _emm_data.security->selected_algorithms.encryption = seea;
- _emm_data.security->selected_algorithms.integrity = seia;
-
- }
- /*
- * NAS security mode command not accepted by the UE
- */
- else {
- /* Setup EMM cause code */
- emm_cause = EMM_CAUSE_SECURITY_MODE_REJECTED;
-
- /* Release security mode control internal data */
- if (_security_data.kenb.value) {
- free(_security_data.kenb.value);
- _security_data.kenb.value = NULL;
- _security_data.kenb.length = 0;
- }
- }
- }
-
- /* Setup EMM procedure handler to be executed upon receiving
- * lower layer notification */
- rc = emm_proc_lowerlayer_initialize(NULL, NULL, NULL, NULL);
-
- if (rc != RETURNok) {
- LOG_TRACE(WARNING,
- "EMM-PROC - Failed to initialize EMM procedure handler");
- LOG_FUNC_RETURN (RETURNerror);
- }
-
- /*
- * Notify EMM-AS SAP that Security Mode response message has to be sent
- * to the network
- */
- emm_sap_t emm_sap;
- emm_sap.primitive = EMMAS_SECURITY_RES;
- emm_sap.u.emm_as.u.security.guti = _emm_data.guti;
- emm_sap.u.emm_as.u.security.ueid = 0;
- emm_sap.u.emm_as.u.security.msgType = EMM_AS_MSG_TYPE_SMC;
- emm_sap.u.emm_as.u.security.emm_cause = emm_cause;
- /* Setup EPS NAS security data */
- emm_as_set_security_data(&emm_sap.u.emm_as.u.security.sctx,
- _emm_data.security, security_context_is_new, TRUE);
- rc = emm_sap_send(&emm_sap);
-
- LOG_FUNC_RETURN (rc);
-}
-#endif // NAS_UE
/*
* --------------------------------------------------------------------------
* Security mode control procedure executed by the MME
* --------------------------------------------------------------------------
*/
-#ifdef NAS_MME
/****************************************************************************
@@ -587,7 +338,7 @@ int emm_proc_security_mode_control(unsigned int ueid, int ksi,
MSC_NAS_EMM_MME,
MSC_NAS_EMM_MME,
NULL,0,
- "0 EMMREG_COMMON_PROC_REQ ue id %06x (security mode control)", ueid);
+ "0 EMMREG_COMMON_PROC_REQ ue id "NAS_UE_ID_FMT" (security mode control)", ueid);
emm_sap_t emm_sap;
emm_sap.primitive = EMMREG_COMMON_PROC_REQ;
emm_sap.u.emm_reg.ueid = ueid;
@@ -630,12 +381,26 @@ int emm_proc_security_mode_complete(unsigned int ueid)
LOG_FUNC_IN;
- LOG_TRACE(INFO, "EMM-PROC - Security mode complete (ueid=%u)", ueid);
+ LOG_TRACE(INFO, "EMM-PROC - Security mode complete (ueid="NAS_UE_ID_FMT")", ueid);
- /* Stop timer T3460 */
- LOG_TRACE(INFO, "EMM-PROC - Stop timer T3460 (%d)", T3460.id);
- T3460.id = nas_timer_stop(T3460.id);
+ /* Get the UE context */
+#if defined(NAS_BUILT_IN_EPC)
+ if (ueid > 0) {
+ emm_ctx = emm_data_context_get(&_emm_data, ueid);
+ }
+#else
+ if (ueid < EMM_DATA_NB_UE_MAX) {
+ emm_ctx = _emm_data.ctx[ueid];
+ }
+#endif
+
+ if (emm_ctx) {
+ /* Stop timer T3460 */
+ LOG_TRACE(INFO, "EMM-PROC - Stop timer T3460 (%d)", emm_ctx->T3460.id);
+ emm_ctx->T3460.id = nas_timer_stop(emm_ctx->T3460.id);
+ MSC_LOG_EVENT(MSC_NAS_EMM_MME, "0 T3460 stopped UE "NAS_UE_ID_FMT" ", ueid);
+ }
/* Release retransmission timer paramaters */
security_data_t *data = (security_data_t *)(emm_proc_common_get_args(ueid));
@@ -643,21 +408,6 @@ int emm_proc_security_mode_complete(unsigned int ueid)
free(data);
}
- /* Get the UE context */
-#if defined(NAS_BUILT_IN_EPC)
-
- if (ueid > 0) {
- emm_ctx = emm_data_context_get(&_emm_data, ueid);
- }
-
-#else
-
- if (ueid < EMM_DATA_NB_UE_MAX) {
- emm_ctx = _emm_data.ctx[ueid];
- }
-
-#endif
-
if (emm_ctx && emm_ctx->security) {
/*
* Notify EMM that the authentication procedure successfully completed
@@ -666,7 +416,7 @@ int emm_proc_security_mode_complete(unsigned int ueid)
MSC_NAS_EMM_MME,
MSC_NAS_EMM_MME,
NULL,0,
- "0 EMMREG_COMMON_PROC_CNF ue id %06x (security mode complete)", ueid);
+ "0 EMMREG_COMMON_PROC_CNF ue id "NAS_UE_ID_FMT" (security mode complete)", ueid);
emm_sap.primitive = EMMREG_COMMON_PROC_CNF;
emm_sap.u.emm_reg.ueid = ueid;
emm_sap.u.emm_reg.ctx = emm_ctx;
@@ -680,7 +430,7 @@ int emm_proc_security_mode_complete(unsigned int ueid)
MSC_NAS_EMM_MME,
MSC_NAS_EMM_MME,
NULL,0,
- "0 EMMREG_COMMON_PROC_REJ ue id %06x (security mode complete)", ueid);
+ "0 EMMREG_COMMON_PROC_REJ ue id "NAS_UE_ID_FMT" (security mode complete)", ueid);
emm_sap.primitive = EMMREG_COMMON_PROC_REJ;
emm_sap.u.emm_reg.ueid = ueid;
emm_sap.u.emm_reg.ctx = emm_ctx;
@@ -723,34 +473,32 @@ int emm_proc_security_mode_reject(unsigned int ueid)
LOG_FUNC_IN;
LOG_TRACE(WARNING, "EMM-PROC - Security mode command not accepted by the UE"
- "(ueid=0x%08x)", ueid);
+ "(ueid="NAS_UE_ID_FMT")", ueid);
- /* Stop timer T3460 */
- LOG_TRACE(INFO, "EMM-PROC - Stop timer T3460 (%d)", T3460.id);
- T3460.id = nas_timer_stop(T3460.id);
- /* Release retransmission timer paramaters */
- security_data_t *data = (security_data_t *)(emm_proc_common_get_args(ueid));
-
- if (data) {
- free(data);
- }
/* Get the UE context */
#if defined(NAS_BUILT_IN_EPC)
-
if (ueid > 0) {
emm_ctx = emm_data_context_get(&_emm_data, ueid);
DevAssert(emm_ctx != NULL);
}
-
#else
-
if (ueid < EMM_DATA_NB_UE_MAX) {
emm_ctx = _emm_data.ctx[ueid];
}
-
#endif
+ if (emm_ctx) {
+ /* Stop timer T3460 */
+ LOG_TRACE(INFO, "EMM-PROC - Stop timer T3460 (%d)", emm_ctx->T3460.id);
+ emm_ctx->T3460.id = nas_timer_stop(emm_ctx->T3460.id);
+ MSC_LOG_EVENT(MSC_NAS_EMM_MME, "0 T3460 stopped UE "NAS_UE_ID_FMT" ", ueid);
+ }
+ /* Release retransmission timer paramaters */
+ security_data_t *data = (security_data_t *)(emm_proc_common_get_args(ueid));
+ if (data) {
+ free(data);
+ }
/* Set the key set identifier to its previous value */
if (emm_ctx && emm_ctx->security) {
@@ -770,7 +518,7 @@ int emm_proc_security_mode_reject(unsigned int ueid)
MSC_NAS_EMM_MME,
MSC_NAS_EMM_MME,
NULL,0,
- "0 EMMREG_COMMON_PROC_REJ ue id %06x (security mode reject)", ueid);
+ "0 EMMREG_COMMON_PROC_REJ ue id "NAS_UE_ID_FMT" (security mode reject)", ueid);
emm_sap_t emm_sap;
emm_sap.primitive = EMMREG_COMMON_PROC_REJ;
emm_sap.u.emm_reg.ueid = ueid;
@@ -779,218 +527,13 @@ int emm_proc_security_mode_reject(unsigned int ueid)
LOG_FUNC_RETURN (rc);
}
-#endif // NAS_MME
/****************************************************************************/
/********************* L O C A L F U N C T I O N S *********************/
/****************************************************************************/
-#ifdef NAS_UE
-/*
- * --------------------------------------------------------------------------
- * UE specific local functions
- * --------------------------------------------------------------------------
- */
-/****************************************************************************
- ** **
- ** Name: _security_release() **
- ** **
- ** Description: Releases the given EPS NAS security context **
- ** **
- ** Inputs: ctx: The EPS NAS security context to release **
- ** Others: None **
- ** **
- ** Outputs: None **
- ** Return: None **
- ** Others: None **
- ** **
- ***************************************************************************/
-static void _security_release(emm_security_context_t *ctx)
-{
- LOG_FUNC_IN;
- if (ctx) {
- /* Release Kasme security key */
- if (ctx->kasme.value) {
- free(ctx->kasme.value);
- ctx->kasme.value = NULL;
- ctx->kasme.length = 0;
- }
-
- /* Release NAS cyphering key */
- if (ctx->knas_enc.value) {
- free(ctx->knas_enc.value);
- ctx->knas_enc.value = NULL;
- ctx->knas_enc.length = 0;
- }
-
- /* Release NAS integrity key */
- if (ctx->knas_int.value) {
- free(ctx->knas_int.value);
- ctx->knas_int.value = NULL;
- ctx->knas_int.length = 0;
- }
-
- /* Release the NAS security context */
- free(ctx);
- }
-
- LOG_FUNC_OUT;
-}
-
-/****************************************************************************
- ** **
- ** Name: _security_knas_enc() **
- ** **
- ** Description: Algorithm Key generation function used for the derivation **
- ** of NAS encryption key Knas-enc from the Kasme. **
- ** **
- ** 3GPP TS 33.401, Annex A.7 **
- ** **
- ** Inputs: kasme: Key Access Security Management Entity **
- ** eea: Cyphering algorithm identity **
- ** Others: None **
- ** **
- ** Outputs: knas_enc: Derived key for NAS cyphering algorithm **
- ** Return: RETURNok, RETURNerror **
- ** Others: None **
- ** **
- ***************************************************************************/
-static int _security_knas_enc(const OctetString *kasme, OctetString *knas_enc,
- UInt8_t eea)
-{
- LOG_FUNC_IN;
- LOG_TRACE(INFO, "%s with algo dist %d algo id %d", __FUNCTION__,0x01, eea);
- LOG_FUNC_RETURN (_security_kdf(kasme, knas_enc, 0x01, eea));
-}
-
-/****************************************************************************
- ** **
- ** Name: _security_knas_int() **
- ** **
- ** Description: Algorithm Key generation function used for the derivation **
- ** of NAS integrity key Knas-int from the Kasme. **
- ** **
- ** 3GPP TS 33.401, Annex A.7 **
- ** **
- ** Inputs: kasme: Key Access Security Management Entity **
- ** eia: Integrity algorithm identity **
- ** Others: None **
- ** **
- ** Outputs: knas_int: Derived key for NAS integrity algorithm **
- ** Return: RETURNok, RETURNerror **
- ** Others: None **
- ** **
- ***************************************************************************/
-static int _security_knas_int(const OctetString *kasme, OctetString *knas_int,
- UInt8_t eia)
-{
- LOG_FUNC_IN;
- LOG_TRACE(INFO, "%s with algo dist %d algo id %d", __FUNCTION__,0x02, eia);
- LOG_FUNC_RETURN (_security_kdf(kasme, knas_int, 0x02, eia));
-}
-
-/****************************************************************************
- ** **
- ** Name: _security_kenb() **
- ** **
- ** Description: Computes the eNodeB key from Kasme and the given value of **
- ** uplink NAS counter. **
- ** **
- ** 3GPP TS 33.401, Annex A.3 **
- ** **
- ** Inputs: kasme: Key Access Security Management Entity **
- ** count: Uplink NAS counter value **
- ** Others: None **
- ** **
- ** Outputs: kenb: eNodeB security key **
- ** Return: RETURNok, RETURNerror **
- ** Others: None **
- ** **
- ***************************************************************************/
-static int _security_kenb(const OctetString *kasme, OctetString *kenb,
- UInt32_t count)
-{
- /* Compute the KDF input parameter
- * S = FC(0x11) || UL NAS Count || 0x00 0x04
- */
- UInt8_t input[32];
- // UInt16_t length = 4;
- // int offset = 0;
-
- LOG_TRACE(INFO, "%s with count= %d", __FUNCTION__, count);
- memset(input, 0, 32);
- input[0] = 0x11;
- // P0
- input[1] = count >> 24;
- input[2] = (UInt8_t)(count >> 16);
- input[3] = (UInt8_t)(count >> 8);
- input[4] = (UInt8_t)count;
- // L0
- input[5] = 0;
- input[6] = 4;
-
- kdf(kasme->value, 32, input, 7, kenb->value, 32);
- kenb->length = 32;
- return (RETURNok);
-}
-
-/****************************************************************************
- ** **
- ** Name: _security_kdf() **
- ** **
- ** Description: Algorithm Key generation function used for the derivation **
- ** of keys for NAS integrity and NAS encryption algorithms **
- ** from Kasme, algorithm types and algorithm identities. **
- ** **
- ** 3GPP TS 33.401, Annex A.7 **
- ** **
- ** Inputs: kasme: Key Access Security Management Entity **
- ** algo_dist: Algorithm type distinguisher **
- ** algo_id: Algorithm identity **
- ** Others: None **
- ** **
- ** Outputs: key: Derived key for NAS security protection **
- ** Return: RETURNok, RETURNerror **
- ** Others: None **
- ** **
- ***************************************************************************/
-static int _security_kdf(const OctetString *kasme, OctetString *key,
- UInt8_t algo_dist, UInt8_t algo_id)
-{
- /* Compute the KDF input parameter
- * S = FC(0x15) || Algorithm distinguisher || 0x00 0x01
- || Algorithm identity || 0x00 0x01
- */
- UInt8_t input[32];
- UInt8_t output[32];
- LOG_TRACE(DEBUG, "%s:%u output key mem %p lenth %u",
- __FUNCTION__, __LINE__,
- key->value,
- key->length);
- memset(input, 0, 32);
- // FC
- input[0] = 0x15;
- // P0 = Algorithm distinguisher
- input[1] = algo_dist;
- // L0 = 0x00 01
- input[2] = 0x00;
- input[3] = 0x01;
- // P1 = Algorithm identity
- input[4] = algo_id;
- // L1 = length of Algorithm identity 0x00 0x01
- input[5] = 0x00;
- input[6] = 0x01;
-
- /* Compute the derived key */
- kdf(kasme->value, kasme->length, input, 7, output, 32);
- memcpy(key->value, &output[31 - key->length + 1], key->length);
- return (RETURNok);
-}
-#endif // NAS_UE
-
-#ifdef NAS_MME
/*
* --------------------------------------------------------------------------
* Timer handlers
@@ -1096,17 +639,13 @@ int _security_request(security_data_t *data, int is_new)
emm_sap.u.emm_as.u.security.selected_eia = data->selected_eia;
#if defined(NAS_BUILT_IN_EPC)
-
if (data->ueid > 0) {
emm_ctx = emm_data_context_get(&_emm_data, data->ueid);
}
-
#else
-
if (data->ueid < EMM_DATA_NB_UE_MAX) {
emm_ctx = _emm_data.ctx[data->ueid];
}
-
#endif
/* Setup EPS NAS security data */
@@ -1116,22 +655,22 @@ int _security_request(security_data_t *data, int is_new)
MSC_NAS_EMM_MME,
MSC_NAS_EMM_MME,
NULL,0,
- "0 EMMAS_SECURITY_REQ ue id %06x", data->ueid);
+ "0 EMMAS_SECURITY_REQ ue id "NAS_UE_ID_FMT" ", data->ueid);
rc = emm_sap_send(&emm_sap);
if (rc != RETURNerror) {
- if (T3460.id != NAS_TIMER_INACTIVE_ID) {
+ if (emm_ctx->T3460.id != NAS_TIMER_INACTIVE_ID) {
/* Re-start T3460 timer */
- T3460.id = nas_timer_restart(T3460.id);
+ emm_ctx->T3460.id = nas_timer_restart(emm_ctx->T3460.id);
+ MSC_LOG_EVENT(MSC_NAS_EMM_MME, "0 T3460 restarted UE "NAS_UE_ID_FMT" ", data->ueid);
} else {
/* Start T3460 timer */
- T3460.id = nas_timer_start(T3460.sec, _security_t3460_handler, data);
+ emm_ctx->T3460.id = nas_timer_start(emm_ctx->T3460.sec, _security_t3460_handler, data);
+ MSC_LOG_EVENT(MSC_NAS_EMM_MME, "0 T3460 started UE "NAS_UE_ID_FMT" ", data->ueid);
}
-
LOG_TRACE(INFO,"EMM-PROC - Timer T3460 (%d) expires in %ld seconds",
- T3460.id, T3460.sec);
+ emm_ctx->T3460.id, emm_ctx->T3460.sec);
}
-
LOG_FUNC_RETURN (rc);
}
@@ -1154,6 +693,7 @@ static int _security_abort(void *args)
{
LOG_FUNC_IN;
+ struct emm_data_context_s *emm_ctx = NULL;
int rc = RETURNerror;
security_data_t *data = (security_data_t *)(args);
@@ -1163,12 +703,21 @@ static int _security_abort(void *args)
int notify_failure = data->notify_failure;
LOG_TRACE(WARNING, "EMM-PROC - Abort security mode control procedure "
- "(ueid=%u)", ueid);
-
+ "(ueid="NAS_UE_ID_FMT")", ueid);
+#if defined(NAS_BUILT_IN_EPC)
+ if (data->ueid > 0) {
+ emm_ctx = emm_data_context_get(&_emm_data, data->ueid);
+ }
+#else
+ if (data->ueid < EMM_DATA_NB_UE_MAX) {
+ emm_ctx = _emm_data.ctx[data->ueid];
+ }
+#endif
/* Stop timer T3460 */
- if (T3460.id != NAS_TIMER_INACTIVE_ID) {
- LOG_TRACE(INFO, "EMM-PROC - Stop timer T3460 (%d)", T3460.id);
- T3460.id = nas_timer_stop(T3460.id);
+ if (emm_ctx->T3460.id != NAS_TIMER_INACTIVE_ID) {
+ LOG_TRACE(INFO, "EMM-PROC - Stop timer T3460 (%d)", emm_ctx->T3460.id);
+ emm_ctx->T3460.id = nas_timer_stop(emm_ctx->T3460.id);
+ MSC_LOG_EVENT(MSC_NAS_EMM_MME, "0 T3460 stopped UE "NAS_UE_ID_FMT" ", ueid);
}
/* Release retransmission timer paramaters */
@@ -1182,7 +731,7 @@ static int _security_abort(void *args)
MSC_NAS_EMM_MME,
MSC_NAS_EMM_MME,
NULL,0,
- "0 EMMREG_COMMON_PROC_REJ ue id %06x (security abort)", data->ueid);
+ "0 EMMREG_COMMON_PROC_REJ ue id "NAS_UE_ID_FMT" (security abort)", data->ueid);
emm_sap_t emm_sap;
emm_sap.primitive = EMMREG_COMMON_PROC_REJ;
emm_sap.u.emm_reg.ueid = ueid;
@@ -1252,5 +801,4 @@ static int _security_select_algorithms(
LOG_FUNC_RETURN (RETURNok);
}
-#endif // NAS_MME
diff --git a/openair-cn/NAS/MME/EMM/ServiceRequestHdl.c b/openair-cn/NAS/MME/EMM/ServiceRequestHdl.c
new file mode 100644
index 0000000000..1655b22d71
--- /dev/null
+++ b/openair-cn/NAS/MME/EMM/ServiceRequestHdl.c
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+Source ServiceRequest.c
+
+Version 0.1
+
+Date 2013/05/07
+
+Product NAS stack
+
+Subsystem EPS Mobility Management
+
+Author Frederic Maurel
+
+Description Defines the service request EMM procedure executed by the
+ Non-Access Stratum.
+
+ The purpose of the service request procedure is to transfer
+ the EMM mode from EMM-IDLE to EMM-CONNECTED mode and establish
+ the radio and S1 bearers when uplink user data or signalling
+ is to be sent.
+
+ This procedure is used when the network has downlink signalling
+ pending, the UE has uplink signalling pending, the UE or the
+ network has user data pending and the UE is in EMM-IDLE mode.
+
+*****************************************************************************/
+
+#include "emm_proc.h"
+#include "nas_log.h"
+#include "nas_timer.h"
+
+#include "emmData.h"
+
+#include "emm_sap.h"
+
+/****************************************************************************/
+/**************** E X T E R N A L D E F I N I T I O N S ****************/
+/****************************************************************************/
+
+/****************************************************************************/
+/******************* L O C A L D E F I N I T I O N S *******************/
+/****************************************************************************/
+
+/*
+ * --------------------------------------------------------------------------
+ * Internal data handled by the service request procedure in the UE
+ * --------------------------------------------------------------------------
+ */
+
+/*
+ * --------------------------------------------------------------------------
+ * Internal data handled by the service request procedure in the MME
+ * --------------------------------------------------------------------------
+ */
+
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+/****************************************************************************/
+/********************* L O C A L F U N C T I O N S *********************/
+/****************************************************************************/
+
+
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/TrackingAreaUpdate.c b/openair-cn/NAS/MME/EMM/TrackingAreaUpdate.c
similarity index 77%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/TrackingAreaUpdate.c
rename to openair-cn/NAS/MME/EMM/TrackingAreaUpdate.c
index 2e95dd303c..09ae70da85 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/TrackingAreaUpdate.c
+++ b/openair-cn/NAS/MME/EMM/TrackingAreaUpdate.c
@@ -69,32 +69,17 @@ Description Defines the tracking area update EMM procedure executed by the
/******************* L O C A L D E F I N I T I O N S *******************/
/****************************************************************************/
-/*
- * --------------------------------------------------------------------------
- * Internal data handled by the tracking area update procedure in the UE
- * --------------------------------------------------------------------------
- */
-#ifdef NAS_UE
-/*
- * Timer handlers
- */
-void *_emm_tau_t3430_handler(void *);
-#endif // NAS_UE
-
/*
* --------------------------------------------------------------------------
* Internal data handled by the tracking area update procedure in the MME
* --------------------------------------------------------------------------
*/
-#ifdef NAS_MME
static int _emm_tracking_area_update_reject(void *args);
-#endif // NAS_MME
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
-#ifdef NAS_MME
/****************************************************************************
** **
** Name: emm_proc_tracking_area_update_reject() **
@@ -140,50 +125,13 @@ int emm_proc_tracking_area_update_reject(unsigned int ueid, int emm_cause)
LOG_FUNC_RETURN(rc);
}
-#endif // NAS_MME
/****************************************************************************/
/********************* L O C A L F U N C T I O N S *********************/
/****************************************************************************/
-#ifdef NAS_UE
-/*
- * --------------------------------------------------------------------------
- * Timer handlers
- * --------------------------------------------------------------------------
- */
-/****************************************************************************
- ** **
- ** Name: _emm_tau_t3430_handler() **
- ** **
- ** Description: T3430 timeout handler **
- ** **
- ** 3GPP TS 24.301, section 5.5.3.2.6 case c **
- ** **
- ** Inputs: args: handler parameters **
- ** Others: None **
- ** **
- ** Outputs: None **
- ** Return: None **
- ** Others: None **
- ** **
- ***************************************************************************/
-void *_emm_tau_t3430_handler(void *args)
-{
- LOG_FUNC_IN;
- LOG_TRACE(WARNING, "EMM-PROC - T3430 timer expired");
-
- /* Stop timer T3430 */
- T3430.id = nas_timer_stop(T3430.id);
-
- LOG_FUNC_RETURN(NULL);
-}
-
-#endif // NAS_UE
-
-#ifdef NAS_MME
/****************************************************************************
** **
** Name: _emm_tracking_area_update_reject() **
@@ -210,7 +158,7 @@ static int _emm_tracking_area_update_reject(void *args)
if (emm_ctx) {
emm_sap_t emm_sap;
LOG_TRACE(WARNING, "EMM-PROC - EMM tracking area update procedure not accepted "
- "by the network (ueid=%08x, cause=%d)",
+ "by the network (ueid="NAS_UE_ID_FMT", cause=%d)",
emm_ctx->ueid, emm_ctx->emm_cause);
/*
* Notify EMM-AS SAP that Tracking Area Update Reject message has to be sent
@@ -238,4 +186,3 @@ static int _emm_tracking_area_update_reject(void *args)
LOG_FUNC_RETURN(rc);
}
-#endif // NAS_MME
diff --git a/openair-cn/NAS/MME/EMM/emmData.h b/openair-cn/NAS/MME/EMM/emmData.h
new file mode 100644
index 0000000000..e17214badb
--- /dev/null
+++ b/openair-cn/NAS/MME/EMM/emmData.h
@@ -0,0 +1,285 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+Source emmData.h
+
+Version 0.1
+
+Date 2012/10/18
+
+Product NAS stack
+
+Subsystem EPS Mobility Management
+
+Author Frederic Maurel
+
+Description Defines internal private data handled by EPS Mobility
+ Management sublayer.
+
+*****************************************************************************/
+#ifndef __EMMDATA_H__
+#define __EMMDATA_H__
+
+#include "commonDef.h"
+#include "networkDef.h"
+#include "securityDef.h"
+
+#include "OctetString.h"
+#include "nas_timer.h"
+
+#include "esmData.h"
+
+#include "emm_fsm.h"
+#include "mme_api.h"
+# if defined(NAS_BUILT_IN_EPC)
+# include "tree.h"
+# endif
+
+/****************************************************************************/
+/********************* G L O B A L C O N S T A N T S *******************/
+/****************************************************************************/
+
+
+/* Checks Mobile Country Code equality */
+#define MCCS_ARE_EQUAL(n1, n2) (((n1).MCCdigit1 == (n2).MCCdigit1) && \
+ ((n1).MCCdigit2 == (n2).MCCdigit2) && \
+ ((n1).MCCdigit3 == (n2).MCCdigit3))
+
+/* Checks Mobile Network Code equality */
+#define MNCS_ARE_EQUAL(n1, n2) (((n1).MNCdigit1 == (n2).MNCdigit1) && \
+ ((n1).MNCdigit2 == (n2).MNCdigit2) && \
+ ((n1).MNCdigit3 == (n2).MNCdigit3))
+
+/* Checks PLMNs equality */
+#define PLMNS_ARE_EQUAL(p1, p2) ((MCCS_ARE_EQUAL((p1),(p2))) && \
+ (MNCS_ARE_EQUAL((p1),(p2))))
+
+/* Checks TAIs equality */
+#define TAIS_ARE_EQUAL(t1, t2) ((PLMNS_ARE_EQUAL((t1).plmn,(t2).plmn)) && \
+ ((t1).tac == (t2).tac))
+
+/****************************************************************************/
+/************************ G L O B A L T Y P E S ************************/
+/****************************************************************************/
+
+/*
+ * --------------------------------------------------------------------------
+ * EPS NAS security context handled by EPS Mobility Management sublayer in
+ * the UE and in the MME
+ * --------------------------------------------------------------------------
+ */
+/* Type of security context */
+typedef enum {
+ EMM_KSI_NOT_AVAILABLE = 0,
+ EMM_KSI_NATIVE,
+ EMM_KSI_MAPPED
+} emm_ksi_t;
+
+/* EPS NAS security context structure */
+typedef struct emm_security_context_s {
+ emm_ksi_t type; /* Type of security context */
+ int eksi; /* NAS key set identifier for E-UTRAN */
+ OctetString kasme; /* ASME security key (native context) */
+ //OctetString ksgsn; /* SGSN security key (mapped context) */
+ OctetString knas_enc; /* NAS cyphering key */
+ OctetString knas_int; /* NAS integrity key */
+ struct count_s{
+ uint32_t spare:8;
+ uint32_t overflow:16;
+ uint32_t seq_num:8;
+ } dl_count, ul_count; /* Downlink and uplink count parameters */
+ struct {
+ uint8_t eps_encryption; /* algorithm used for ciphering */
+ uint8_t eps_integrity; /* algorithm used for integrity protection */
+ uint8_t umts_encryption; /* algorithm used for ciphering */
+ uint8_t umts_integrity; /* algorithm used for integrity protection */
+ uint8_t gprs_encryption; /* algorithm used for ciphering */
+ uint8_t umts_present:1;
+ uint8_t gprs_present:1;
+ } capability; /* UE network capability */
+ struct {
+ uint8_t encryption:4; /* algorithm used for ciphering */
+ uint8_t integrity:4; /* algorithm used for integrity protection */
+ } selected_algorithms; /* MME selected algorithms */
+} emm_security_context_t;
+
+/*
+ * --------------------------------------------------------------------------
+ * EMM internal data handled by EPS Mobility Management sublayer in the UE
+ * --------------------------------------------------------------------------
+ */
+
+/*
+ * --------------------------------------------------------------------------
+ * EMM internal data handled by EPS Mobility Management sublayer in the MME
+ * --------------------------------------------------------------------------
+ */
+/*
+ * Structure of the EMM context established by the network for a particular UE
+ * ---------------------------------------------------------------------------
+ */
+typedef struct emm_data_context_s {
+#if defined(NAS_BUILT_IN_EPC)
+ RB_ENTRY(emm_data_context_s) entries;
+#endif
+
+ unsigned int ueid; /* UE identifier */
+ int is_dynamic; /* Dynamically allocated context indicator */
+ int is_attached; /* Attachment indicator */
+ int is_emergency;/* Emergency bearer services indicator */
+
+ imsi_t *imsi; /* The IMSI provided by the UE or the MME */
+ imei_t *imei; /* The IMEI provided by the UE */
+ int guti_is_new; /* New GUTI indicator */
+ GUTI_t *guti; /* The GUTI assigned to the UE */
+ GUTI_t *old_guti; /* The old GUTI */
+ int n_tacs; /* Number of consecutive tracking areas the UE is
+ * registered to */
+ tac_t tac; /* Code of the first tracking area the UE is
+ * registered to */
+
+ int ksi; /* Security key set identifier provided by the UE */
+ int eea; /* EPS encryption algorithms supported by the UE */
+ int eia; /* EPS integrity algorithms supported by the UE */
+ int ucs2; /* UCS2 Alphabet*/
+ int uea; /* UMTS encryption algorithms supported by the UE */
+ int uia; /* UMTS integrity algorithms supported by the UE */
+ int gea; /* GPRS encryption algorithms supported by the UE */
+ int umts_present; /* For encoding ue network capabilities (variable size)*/
+ int gprs_present; /* For encoding ue network capabilities (variable size)*/
+
+ auth_vector_t vector;/* EPS authentication vector */
+ emm_security_context_t *security; /* Current EPS NAS security context */
+ OctetString esm_msg; /* ESM message contained within the initial request*/
+ int emm_cause; /* EMM failure cause code */
+
+ emm_fsm_state_t _emm_fsm_status;
+
+ struct nas_timer_t T3450; /* EMM message retransmission timer */
+ struct nas_timer_t T3460; /* Authentication timer */
+ struct nas_timer_t T3470; /* Identification timer */
+
+ esm_data_context_t esm_data_ctx;
+} emm_data_context_t;
+
+/*
+ * Structure of the EMM data
+ * -------------------------
+ */
+typedef struct emm_data_s {
+ /*
+ * MME configuration
+ * -----------------
+ */
+ mme_api_emm_config_t conf;
+ /*
+ * EMM contexts
+ * ------------
+ */
+# if defined(NAS_BUILT_IN_EPC)
+ /* Use a tree for ue data context within MME */
+ RB_HEAD(emm_data_context_map, emm_data_context_s) ctx_map;
+# else
+# define EMM_DATA_NB_UE_MAX (MME_API_NB_UE_MAX + 1)
+ emm_data_context_t *ctx [EMM_DATA_NB_UE_MAX];
+# endif
+} emm_data_t;
+
+struct emm_data_context_s *emm_data_context_get(
+ emm_data_t *_emm_data, unsigned int _ueid);
+
+struct emm_data_context_s *emm_data_context_remove(
+ emm_data_t *_emm_data, struct emm_data_context_s *elm);
+
+void emm_data_context_add(emm_data_t *emm_data, struct emm_data_context_s *elm);
+void emm_data_context_dump(struct emm_data_context_s *elm_pP);
+
+void emm_data_context_dump_all(void);
+
+
+/****************************************************************************/
+/******************** G L O B A L V A R I A B L E S ********************/
+/****************************************************************************/
+
+/*
+ * --------------------------------------------------------------------------
+ * EPS mobility management data (used within EMM only)
+ * --------------------------------------------------------------------------
+ */
+emm_data_t _emm_data;
+
+
+/*
+ * --------------------------------------------------------------------------
+ * EPS mobility management timers – Network side
+ * --------------------------------------------------------------------------
+ */
+#define T3450_DEFAULT_VALUE 6 /* 6 seconds */
+#define T3460_DEFAULT_VALUE 6 /* 6 seconds */
+#define T3470_DEFAULT_VALUE 6 /* 6 seconds */
+
+/*
+ * mobile reachable timer
+ * ----------------------
+ * The network supervises the periodic tracking area updating procedure
+ * of the UE by means of the mobile reachable timer.
+ * If the UE is not attached for emergency bearer services, the mobile
+ * reachable timer is 4 minutes greater than T3412.
+ * If the UE is attached for emergency bearer services, the MME shall
+ * set the mobile reachable timer with a value equal to T3412. When
+ * the mobile reachable timer expires, the MME shall locally detach the UE.
+ *
+ * The mobile reachable timer shall be reset and started, when the MME
+ * releases the NAS signalling connection for the UE. The mobile reachable
+ * timer shall be stopped when a NAS signalling connection is established
+ * for the UE.
+ */
+
+/*
+ * implicit detach timer
+ * ---------------------
+ * If ISR is activated, the default value of the implicit detach timer is
+ * 4 minutes greater than T3423.
+ * If the implicit detach timer expires before the UE contacts the network,
+ * the network shall implicitly detach the UE.
+ * If the MME includes timer T3346 in the TRACKING AREA UPDATE REJECT message
+ * or the SERVICE REJECT message and T3346 is greater than T3412, the MME
+ * sets the mobile reachable timer and the implicit detach timer such that
+ * the sum of the timer values is greater than T3346.
+ *
+ * Upon expiry of the mobile reachable timer the network shall start the
+ * implicit detach timer. The implicit detach timer shall be stopped when
+ * a NAS signalling connection is established for the UE.
+ */
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+#endif /* __EMMDATA_H__*/
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/emm_data_ctx.c b/openair-cn/NAS/MME/EMM/emm_data_ctx.c
similarity index 96%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/emm_data_ctx.c
rename to openair-cn/NAS/MME/EMM/emm_data_ctx.c
index 9fead509fa..4030e08e95 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/emm_data_ctx.c
+++ b/openair-cn/NAS/MME/EMM/emm_data_ctx.c
@@ -30,7 +30,7 @@
#include
#include
-#if defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)
+#if defined(NAS_BUILT_IN_EPC)
#include "assertions.h"
#include "tree.h"
#include "emmData.h"
@@ -80,13 +80,13 @@ struct emm_data_context_s *emm_data_context_get(
struct emm_data_context_s *emm_data_context_remove(
emm_data_t *emm_data, struct emm_data_context_s *elm)
{
- LOG_TRACE(INFO, "EMM-CTX - Remove in context %p UE id %u", elm, elm->ueid);
+ LOG_TRACE(INFO, "EMM-CTX - Remove in context %p UE id "NAS_UE_ID_FMT" ", elm, elm->ueid);
return RB_REMOVE(emm_data_context_map, &emm_data->ctx_map, elm);
}
void emm_data_context_add(emm_data_t *emm_data, struct emm_data_context_s *elm)
{
- LOG_TRACE(INFO, "EMM-CTX - Add in context %p UE id %u", elm, elm->ueid);
+ LOG_TRACE(INFO, "EMM-CTX - Add in context %p UE id "NAS_UE_ID_FMT" ", elm, elm->ueid);
RB_INSERT(emm_data_context_map, &emm_data->ctx_map, elm);
}
@@ -97,7 +97,7 @@ void emm_data_context_dump(struct emm_data_context_s *elm_pP)
char guti_str[22];
int k, size, remaining_size;
char key_string[KASME_LENGTH_OCTETS*2];
- LOG_TRACE(INFO, "EMM-CTX: ue id: 0x%06"PRIX32" (UE identifier)", elm_pP->ueid);
+ LOG_TRACE(INFO, "EMM-CTX: ue id: "NAS_UE_ID_FMT" (UE identifier)", elm_pP->ueid);
LOG_TRACE(INFO, " is_dynamic: %u (Dynamically allocated context indicator)", elm_pP->is_dynamic);
LOG_TRACE(INFO, " is_attached: %u (Attachment indicator)", elm_pP->is_attached);
LOG_TRACE(INFO, " is_emergency: %u (Emergency bearer services indicator)", elm_pP->is_emergency);
diff --git a/openair-cn/NAS/MME/EMM/emm_main.c b/openair-cn/NAS/MME/EMM/emm_main.c
new file mode 100644
index 0000000000..c90a7836f5
--- /dev/null
+++ b/openair-cn/NAS/MME/EMM/emm_main.c
@@ -0,0 +1,138 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+Source emm_main.c
+
+Version 0.1
+
+Date 2012/10/10
+
+Product NAS stack
+
+Subsystem EPS Mobility Management
+
+Author Frederic Maurel
+
+Description Defines the EPS Mobility Management procedure call manager,
+ the main entry point for elementary EMM processing.
+
+*****************************************************************************/
+
+#include "emm_main.h"
+#include "nas_log.h"
+#include "emmData.h"
+
+
+#if defined(NAS_BUILT_IN_EPC)
+# include "mme_config.h"
+#endif
+
+/****************************************************************************/
+/**************** E X T E R N A L D E F I N I T I O N S ****************/
+/****************************************************************************/
+
+/****************************************************************************/
+/******************* L O C A L D E F I N I T I O N S *******************/
+/****************************************************************************/
+
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+
+/****************************************************************************
+ ** **
+ ** Name: emm_main_initialize() **
+ ** **
+ ** Description: Initializes EMM internal data **
+ ** **
+ ** Inputs: None **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: None **
+ ** Others: _emm_data **
+ ** **
+ ***************************************************************************/
+#if defined(NAS_BUILT_IN_EPC)
+void emm_main_initialize(mme_config_t *mme_config_p)
+#else
+void emm_main_initialize(void)
+#endif
+{
+ LOG_FUNC_IN;
+
+ /* Retreive MME supported configuration data */
+#if defined(NAS_BUILT_IN_EPC)
+
+ if (mme_api_get_emm_config(&_emm_data.conf, mme_config_p) != RETURNok)
+#else
+ if (mme_api_get_emm_config(&_emm_data.conf) != RETURNok)
+#endif
+ {
+ LOG_TRACE(ERROR, "EMM-MAIN - Failed to get MME configuration data");
+ }
+
+#if defined(NAS_BUILT_IN_EPC)
+ RB_INIT(&_emm_data.ctx_map);
+#endif
+
+ LOG_FUNC_OUT;
+}
+
+/****************************************************************************
+ ** **
+ ** Name: emm_main_cleanup() **
+ ** **
+ ** Description: Performs the EPS Mobility Management clean up procedure **
+ ** **
+ ** Inputs: None **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: None **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+void emm_main_cleanup(void)
+{
+ LOG_FUNC_IN;
+
+
+ LOG_FUNC_OUT;
+}
+
+
+
+/****************************************************************************/
+/********************* L O C A L F U N C T I O N S *********************/
+/****************************************************************************/
+
+
diff --git a/openair-cn/NAS/MME/EMM/emm_main.h b/openair-cn/NAS/MME/EMM/emm_main.h
new file mode 100644
index 0000000000..ac3772a24f
--- /dev/null
+++ b/openair-cn/NAS/MME/EMM/emm_main.h
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+Source emm_main.h
+
+Version 0.1
+
+Date 2012/10/10
+
+Product NAS stack
+
+Subsystem EPS Mobility Management
+
+Author Frederic Maurel
+
+Description Defines the EPS Mobility Management procedure call manager,
+ the main entry point for elementary EMM processing.
+
+*****************************************************************************/
+#ifndef __EMM_MAIN_H__
+#define __EMM_MAIN_H__
+
+#if defined(NAS_BUILT_IN_EPC)
+# include "mme_config.h"
+#endif
+
+#include "commonDef.h"
+#include "networkDef.h"
+
+/****************************************************************************/
+/********************* G L O B A L C O N S T A N T S *******************/
+/****************************************************************************/
+
+/****************************************************************************/
+/************************ G L O B A L T Y P E S ************************/
+/****************************************************************************/
+
+/****************************************************************************/
+/******************** G L O B A L V A R I A B L E S ********************/
+/****************************************************************************/
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+
+# if defined(NAS_BUILT_IN_EPC)
+void emm_main_initialize(mme_config_t *mme_config_p);
+# else
+void emm_main_initialize(void);
+# endif
+void emm_main_cleanup(void);
+
+
+
+#endif /* __EMM_MAIN_H__*/
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/emm_proc.h b/openair-cn/NAS/MME/EMM/emm_proc.h
similarity index 76%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/emm_proc.h
rename to openair-cn/NAS/MME/EMM/emm_proc.h
index 32d0b06493..d7892a03b1 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/emm_proc.h
+++ b/openair-cn/NAS/MME/EMM/emm_proc.h
@@ -49,14 +49,9 @@ Description Defines the EPS Mobility Management procedures executed at
#include "commonDef.h"
#include "OctetString.h"
-#ifdef NAS_MME
#include "EmmCommon.h"
#include "emmData.h"
-#endif
-#ifdef NAS_UE
-#include "LowerLayer.h"
-#endif
/****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/
@@ -114,49 +109,22 @@ int emm_proc_status(unsigned int ueid, int emm_cause);
* Lower layer procedure
*---------------------------------------------------------------------------
*/
-#ifdef NAS_UE
-int emm_proc_lowerlayer_initialize(lowerlayer_success_callback_t success,
- lowerlayer_failure_callback_t failure,
- lowerlayer_release_callback_t release,
- void *args);
-int emm_proc_lowerlayer_success(void);
-int emm_proc_lowerlayer_failure(int is_initial);
-int emm_proc_lowerlayer_release(void);
-#endif
+
/*
*---------------------------------------------------------------------------
* UE's Idle mode procedure
*---------------------------------------------------------------------------
*/
-#ifdef NAS_UE
-int emm_proc_initialize(void);
-int emm_proc_plmn_selection(int index);
-int emm_proc_plmn_selection_end(int found, tac_t tac, ci_t ci, AcT_t rat);
-#endif
+
/*
* --------------------------------------------------------------------------
* Attach procedure
* --------------------------------------------------------------------------
*/
-#ifdef NAS_UE
-int emm_proc_attach(emm_proc_attach_type_t type);
-int emm_proc_attach_request(void *args);
-int emm_proc_attach_accept(long T3412, long T3402, long T3423, int n_tais,
- tai_t *tai, GUTI_t *guti, int n_eplmns, plmn_t *eplmn,
- const OctetString *esm_msg);
-int emm_proc_attach_reject(int emm_cause, const OctetString *esm_msg);
-int emm_proc_attach_complete(void *args);
-int emm_proc_attach_failure(int is_initial, void *args);
-int emm_proc_attach_release(void *args);
-int emm_proc_attach_restart(void);
-int emm_proc_attach_set_emergency(void);
-int emm_proc_attach_set_detach(void);
-#endif
-#ifdef NAS_MME
int emm_proc_attach_request(unsigned int ueid, emm_proc_attach_type_t type,
int native_ksi, int ksi, int native_guti, GUTI_t *guti, imsi_t *imsi,
imei_t *imei, tai_t *tai, int eea, int eia, int ucs2, int uea, int uia, int gea,
@@ -164,38 +132,23 @@ int emm_proc_attach_request(unsigned int ueid, emm_proc_attach_type_t type,
int emm_proc_attach_reject(unsigned int ueid, int emm_cause);
int emm_proc_attach_complete(unsigned int ueid, const OctetString *esm_msg);
int emm_proc_tracking_area_update_reject(unsigned int ueid, int emm_cause);
-#endif
/*
* --------------------------------------------------------------------------
* Detach procedure
* --------------------------------------------------------------------------
*/
-#ifdef NAS_UE
-int emm_proc_detach(emm_proc_detach_type_t type, int switch_off);
-int emm_proc_detach_request(void *args);
-int emm_proc_detach_accept(void);
-int emm_proc_detach_failure(int is_initial, void *args);
-int emm_proc_detach_release(void *args);
-#endif
-#ifdef NAS_MME
int emm_proc_detach(unsigned int ueid, emm_proc_detach_type_t type);
int emm_proc_detach_request(unsigned int ueid, emm_proc_detach_type_t type,
int switch_off, int native_ksi, int ksi, GUTI_t *guti, imsi_t *imsi,
imei_t *imei);
-#endif
/*
* --------------------------------------------------------------------------
* Identification procedure
* --------------------------------------------------------------------------
*/
-#ifdef NAS_UE
-int emm_proc_identification_request(emm_proc_identity_type_t type);
-#endif
-
-#ifdef NAS_MME
int emm_proc_identification(unsigned int ueid,
emm_data_context_t *emm_ctx,
emm_proc_identity_type_t type,
@@ -203,22 +156,14 @@ int emm_proc_identification(unsigned int ueid,
emm_common_reject_callback_t reject,
emm_common_failure_callback_t failure);
int emm_proc_identification_complete(unsigned int ueid, const imsi_t *imsi,
- const imei_t *imei, UInt32_t *tmsi);
-#endif
+ const imei_t *imei, uint32_t *tmsi);
/*
* --------------------------------------------------------------------------
* Authentication procedure
* --------------------------------------------------------------------------
*/
-#ifdef NAS_UE
-int emm_proc_authentication_request(int native_ksi, int ksi,
- const OctetString *rand, const OctetString *autn);
-int emm_proc_authentication_reject(void);
-int emm_proc_authentication_delete(void);
-#endif
-#ifdef NAS_MME
int emm_proc_authentication(void *ctx, unsigned int ueid, int ksi,
const OctetString *_rand, const OctetString *autn,
emm_common_success_callback_t success,
@@ -228,19 +173,13 @@ int emm_proc_authentication_complete(unsigned int ueid, int emm_cause,
const OctetString *res);
int emm_attach_security(void *args);
-#endif
/*
* --------------------------------------------------------------------------
* Security mode control procedure
* --------------------------------------------------------------------------
*/
-#ifdef NAS_UE
-int emm_proc_security_mode_command(int native_ksi, int ksi, int seea, int seia,
- int reea, int reia);
-#endif
-#ifdef NAS_MME
int emm_proc_security_mode_control(unsigned int ueid, int ksi,
int eea, int eia,int ucs2, int uea, int uia, int gea,
int umts_present, int gprs_present,
@@ -249,17 +188,12 @@ int emm_proc_security_mode_control(unsigned int ueid, int ksi,
emm_common_failure_callback_t failure);
int emm_proc_security_mode_complete(unsigned int ueid);
int emm_proc_security_mode_reject(unsigned int ueid);
-#endif
/*
*---------------------------------------------------------------------------
* Network indication handlers
*---------------------------------------------------------------------------
*/
-#ifdef NAS_UE
-int emm_proc_registration_notify(Stat_t status);
-int emm_proc_location_notify(tac_t tac, ci_t ci, AcT_t rat);
-int emm_proc_network_notify(int index);
-#endif
+
#endif /* __EMM_PROC_H__*/
diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/user/COPYING b/openair-cn/NAS/MME/ESM/COPYING
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/api/user/COPYING
rename to openair-cn/NAS/MME/ESM/COPYING
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/DedicatedEpsBearerContextActivation.c b/openair-cn/NAS/MME/ESM/DedicatedEpsBearerContextActivation.c
similarity index 65%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/DedicatedEpsBearerContextActivation.c
rename to openair-cn/NAS/MME/ESM/DedicatedEpsBearerContextActivation.c
index 303e41285e..813b29770d 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/esm/DedicatedEpsBearerContextActivation.c
+++ b/openair-cn/NAS/MME/ESM/DedicatedEpsBearerContextActivation.c
@@ -80,7 +80,6 @@ Description Defines the dedicated EPS bearer context activation ESM
* procedure in the MME
* --------------------------------------------------------------------------
*/
-#ifdef NAS_MME
/*
* Timer handlers
*/
@@ -92,7 +91,6 @@ static void *_dedicated_eps_bearer_activate_t3485_handler(void *);
static int _dedicated_eps_bearer_activate(emm_data_context_t *ctx, int ebi,
const OctetString *msg);
-#endif // NAS_MME
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
@@ -103,7 +101,6 @@ static int _dedicated_eps_bearer_activate(emm_data_context_t *ctx, int ebi,
* Dedicated EPS bearer context activation procedure executed by the MME
* --------------------------------------------------------------------------
*/
-#ifdef NAS_MME
/****************************************************************************
** **
** Name: esm_proc_dedicated_eps_bearer_context() **
@@ -137,7 +134,7 @@ int esm_proc_dedicated_eps_bearer_context(emm_data_context_t *ctx, int pid,
LOG_FUNC_IN;
LOG_TRACE(INFO, "ESM-PROC - Dedicated EPS bearer context activation "
- "(ueid=%u, pid=%d)", ctx->ueid, pid);
+ "(ueid="NAS_UE_ID_FMT", pid=%d)", ctx->ueid, pid);
/* Assign new EPS bearer context */
*ebi = esm_ebr_assign(ctx, ESM_EBI_UNASSIGNED);
@@ -197,7 +194,7 @@ int esm_proc_dedicated_eps_bearer_context_request(int is_standalone,
int rc = RETURNok;
LOG_TRACE(INFO,"ESM-PROC - Initiate dedicated EPS bearer context "
- "activation (ueid=%d, ebi=%d)", ctx->ueid, ebi);
+ "activation (ueid="NAS_UE_ID_FMT", ebi=%d)", ctx->ueid, ebi);
/* Send activate dedicated EPS bearer context request message and
* start timer T3485 */
@@ -247,7 +244,7 @@ int esm_proc_dedicated_eps_bearer_context_accept(emm_data_context_t *ctx, int eb
int rc;
LOG_TRACE(INFO, "ESM-PROC - Dedicated EPS bearer context activation "
- "accepted by the UE (ueid=%u, ebi=%d)", ctx->ueid, ebi);
+ "accepted by the UE (ueid="NAS_UE_ID_FMT", ebi=%d)", ctx->ueid, ebi);
/* Stop T3485 timer */
rc = esm_ebr_stop_timer(ctx, ebi);
@@ -300,7 +297,7 @@ int esm_proc_dedicated_eps_bearer_context_reject(emm_data_context_t *ctx, int eb
LOG_FUNC_IN;
LOG_TRACE(WARNING, "ESM-PROC - Dedicated EPS bearer context activation "
- "not accepted by the UE (ueid=%u, ebi=%d)", ctx->ueid, ebi);
+ "not accepted by the UE (ueid="NAS_UE_ID_FMT", ebi=%d)", ctx->ueid, ebi);
/* Stop T3485 timer if running */
rc = esm_ebr_stop_timer(ctx, ebi);
@@ -319,230 +316,7 @@ int esm_proc_dedicated_eps_bearer_context_reject(emm_data_context_t *ctx, int eb
LOG_FUNC_RETURN (rc);
}
-#endif // NAS_MME
-/*
- * --------------------------------------------------------------------------
- * Dedicated EPS bearer context activation procedure executed by the UE
- * --------------------------------------------------------------------------
- */
-#ifdef NAS_UE
-/****************************************************************************
- ** **
- ** Name: esm_proc_dedicated_eps_bearer_context_request() **
- ** **
- ** Description: Creates local dedicated EPS bearer context upon receipt **
- ** of the ACTIVATE DEDICATED EPS BEARER CONTEXT REQUEST **
- ** message. **
- ** **
- ** Inputs: ebi: EPS bearer identity **
- ** default_ebi: EPS bearer identity of the associated de- **
- ** fault EPS bearer context **
- ** esm_qos: EPS bearer level QoS parameters **
- ** tft: Traffic flow template parameters **
- ** Others: None **
- ** **
- ** Outputs: esm_cause: Cause code returned upon ESM procedure **
- ** failure **
- ** Return: RETURNok, RETURNerror **
- ** Others: None **
- ** **
- ***************************************************************************/
-int esm_proc_dedicated_eps_bearer_context_request(int ebi, int default_ebi,
- const esm_proc_qos_t *qos,
- const esm_proc_tft_t *tft,
- int *esm_cause)
-{
- LOG_FUNC_IN;
-
- int rc = RETURNerror;
-
- LOG_TRACE(INFO, "ESM-PROC - Dedicated EPS bearer context activation "
- "requested by the network (ebi=%d)", ebi);
-
- /* Get the PDN connection the dedicated EPS bearer is linked to */
- int pid = esm_ebr_context_get_pid(default_ebi);
-
- if (pid < 0) {
- /* 3GPP TS 24.301, section 6.4.2.5, abnormal case c
- * No default EPS bearer context with linked EPS bearer identity
- * activated
- */
- LOG_TRACE(WARNING, "ESM-PROC - Failed to get PDN connection the "
- "dedicated EPS bearer is linked to (ebi=%d)", default_ebi);
- *esm_cause = ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY;
- LOG_FUNC_RETURN (RETURNerror);
- }
-
- /* Assign dedicated EPS bearer context */
- int new_ebi = esm_ebr_assign(ebi, pid+1, FALSE);
-
- if (new_ebi == ESM_EBI_UNASSIGNED) {
- /* 3GPP TS 24.301, section 6.4.2.5, abnormal cases a and b
- * Dedicated EPS bearer context activation request for an already
- * activated default or dedicated EPS bearer context
- */
- int old_pid, old_bid;
- /* Locally deactivate the existing EPS bearer context and proceed
- * with the requested dedicated EPS bearer context activation */
- rc = esm_proc_eps_bearer_context_deactivate(TRUE, ebi,
- &old_pid, &old_bid);
-
- if (rc != RETURNok) {
- /* Failed to release EPS bearer context */
- *esm_cause = ESM_CAUSE_PROTOCOL_ERROR;
- } else {
- /* Assign new dedicated EPS bearer context */
- ebi = esm_ebr_assign(ebi, pid+1, FALSE);
- }
- }
-
- if (ebi != ESM_EBI_UNASSIGNED) {
- /* Check syntactical errors in packet filters */
- rc = esm_ebr_context_check_tft(pid, ebi, tft,
- ESM_EBR_CONTEXT_TFT_CREATE);
-
- if (rc != RETURNok) {
- /* Syntactical errors in packet filters */
- LOG_TRACE(WARNING, "ESM-PROC - Syntactical errors in packet "
- "filters");
- *esm_cause = ESM_CAUSE_SYNTACTICAL_ERROR_IN_PACKET_FILTER;
- } else {
- /* Create new dedicated EPS bearer context */
- default_ebi = esm_ebr_context_create(pid, ebi, FALSE, qos, tft);
-
- if (default_ebi != ESM_EBI_UNASSIGNED) {
- /* Dedicated EPS bearer contextx successfully created */
- rc = RETURNok;
- } else {
- /* No resource available */
- LOG_TRACE(WARNING, "ESM-PROC - Failed to create new dedicated "
- "EPS bearer context");
- *esm_cause = ESM_CAUSE_INSUFFICIENT_RESOURCES;
- }
- }
- }
-
- LOG_FUNC_RETURN (rc);
-}
-
-/****************************************************************************
- ** **
- ** Name: esm_proc_dedicated_eps_bearer_context_accept() **
- ** **
- ** Description: Performs dedicated EPS bearer context activation proce- **
- ** dure accepted by the UE. **
- ** **
- ** 3GPP TS 24.301, section 6.4.2.3 **
- ** The UE accepts dedicated EPS bearer context activation by **
- ** sending ACTIVATE DEDICATED EPS BEARER CONTEXT ACCEPT mes- **
- ** sage and entering the state BEARER CONTEXT ACTIVE. **
- ** **
- ** Inputs: is_standalone: Not used **
- ** ebi: EPS bearer identity **
- ** msg: Encoded ESM message to be sent **
- ** ue_triggered: TRUE if the EPS bearer context procedure **
- ** was triggered by the UE **
- ** Others: None **
- ** **
- ** Outputs: None **
- ** Return: RETURNok, RETURNerror **
- ** Others: None **
- ** **
- ***************************************************************************/
-int esm_proc_dedicated_eps_bearer_context_accept(int is_standalone, int ebi,
- OctetString *msg, int ue_triggered)
-{
- LOG_FUNC_IN;
-
- int rc;
-
- LOG_TRACE(INFO,"ESM-PROC - Dedicated EPS bearer context activation "
- "accepted by the UE (ebi=%d)", ebi);
-
- emm_sap_t emm_sap;
- emm_esm_data_t *emm_esm = &emm_sap.u.emm_esm.u.data;
- /*
- * Notity EMM that ESM PDU has to be forwarded to lower layers
- */
- emm_sap.primitive = EMMESM_UNITDATA_REQ;
- emm_sap.u.emm_esm.ueid = 0;
- emm_esm->msg.length = msg->length;
- emm_esm->msg.value = msg->value;
- rc = emm_sap_send(&emm_sap);
-
- if (rc != RETURNerror) {
- /* Set the EPS bearer context state to ACTIVE */
- rc = esm_ebr_set_status(ebi, ESM_EBR_ACTIVE, ue_triggered);
-
- if (rc != RETURNok) {
- /* The EPS bearer context was already in ACTIVE state */
- LOG_TRACE(WARNING, "ESM-PROC - EBI %d was already ACTIVE", ebi);
- /* Accept network retransmission of already accepted activate
- * dedicated EPS bearer context request */
- LOG_FUNC_RETURN (RETURNok);
- }
- }
-
- LOG_FUNC_RETURN (rc);
-}
-
-/****************************************************************************
- ** **
- ** Name: esm_proc_dedicated_eps_bearer_context_reject() **
- ** **
- ** Description: Performs dedicated EPS bearer context activation proce- **
- ** dure not accepted by the UE. **
- ** **
- ** 3GPP TS 24.301, section 6.4.2.4 **
- ** The UE rejects dedicated EPS bearer context activation by **
- ** sending ACTIVATE DEDICATED EPS BEARER CONTEXT REJECT mes- **
- ** sage. **
- ** **
- ** Inputs: is_standalone: Not used **
- ** ebi: EPS bearer identity **
- ** msg: Encoded ESM message to be sent **
- ** ue_triggered: Not used **
- ** Others: None **
- ** **
- ** Outputs: None **
- ** Return: RETURNok, RETURNerror **
- ** Others: None **
- ** **
- ***************************************************************************/
-int esm_proc_dedicated_eps_bearer_context_reject(int is_standalone, int ebi,
- OctetString *msg, int ue_triggered)
-{
- LOG_FUNC_IN;
-
- int rc = RETURNok;
-
- LOG_TRACE(WARNING, "ESM-PROC - Dedicated EPS bearer context activation "
- "not accepted by the UE (ebi=%d)", ebi);
-
- if ( !esm_ebr_is_not_in_use(ebi) ) {
- /* Release EPS bearer data currently in use */
- rc = esm_ebr_release(ebi);
- }
-
- if (rc != RETURNok) {
- LOG_TRACE(WARNING, "ESM-PROC - Failed to release EPS bearer data");
- } else {
- emm_sap_t emm_sap;
- emm_esm_data_t *emm_esm = &emm_sap.u.emm_esm.u.data;
- /*
- * Notity EMM that ESM PDU has to be forwarded to lower layers
- */
- emm_sap.primitive = EMMESM_UNITDATA_REQ;
- emm_sap.u.emm_esm.ueid = 0;
- emm_esm->msg.length = msg->length;
- emm_esm->msg.value = msg->value;
- rc = emm_sap_send(&emm_sap);
- }
-
- LOG_FUNC_RETURN (rc);
-}
-#endif // NAS_UE
/****************************************************************************/
/********************* L O C A L F U N C T I O N S *********************/
@@ -553,7 +327,6 @@ int esm_proc_dedicated_eps_bearer_context_reject(int is_standalone, int ebi,
* Timer handlers
* --------------------------------------------------------------------------
*/
-#ifdef NAS_MME
/****************************************************************************
** **
** Name: _dedicated_eps_bearer_activate_t3485_handler() **
@@ -589,7 +362,7 @@ static void *_dedicated_eps_bearer_activate_t3485_handler(void *args)
/* Increment the retransmission counter */
data->count += 1;
- LOG_TRACE(WARNING, "ESM-PROC - T3485 timer expired (ueid=%d, ebi=%d), "
+ LOG_TRACE(WARNING, "ESM-PROC - T3485 timer expired (ueid="NAS_UE_ID_FMT", ebi=%d), "
"retransmission counter = %d",
data->ueid, data->ebi, data->count);
@@ -667,4 +440,3 @@ static int _dedicated_eps_bearer_activate(emm_data_context_t *ctx, int ebi,
LOG_FUNC_RETURN (rc);
}
-#endif // NAS_MME
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/DefaultEpsBearerContextActivation.c b/openair-cn/NAS/MME/ESM/DefaultEpsBearerContextActivation.c
similarity index 60%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/DefaultEpsBearerContextActivation.c
rename to openair-cn/NAS/MME/ESM/DefaultEpsBearerContextActivation.c
index 6163bcd4da..831fc3327d 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/esm/DefaultEpsBearerContextActivation.c
+++ b/openair-cn/NAS/MME/ESM/DefaultEpsBearerContextActivation.c
@@ -70,19 +70,6 @@ Description Defines the default EPS bearer context activation ESM
/******************* L O C A L D E F I N I T I O N S *******************/
/****************************************************************************/
-/*
- * --------------------------------------------------------------------------
- * Internal data handled by the default EPS bearer context activation
- * procedure in the UE
- * --------------------------------------------------------------------------
- */
-#ifdef NAS_UE
-static struct {
- int ebi; /* EPS bearer identity of the default EPS bearer associated
- * to the PDN connection to be activated */
-} _default_eps_bearer_context_data = {ESM_EBI_UNASSIGNED};
-
-#endif // NAS_UE
/*
* --------------------------------------------------------------------------
@@ -90,7 +77,6 @@ static struct {
* procedure in the MME
* --------------------------------------------------------------------------
*/
-#ifdef NAS_MME
/*
* Timer handlers
*/
@@ -102,7 +88,6 @@ static void *_default_eps_bearer_activate_t3485_handler(void *);
static int _default_eps_bearer_activate(emm_data_context_t *ctx, int ebi,
const OctetString *msg);
-#endif // NAS_MME
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
@@ -113,7 +98,6 @@ static int _default_eps_bearer_activate(emm_data_context_t *ctx, int ebi,
* Default EPS bearer context activation procedure executed by the MME
* --------------------------------------------------------------------------
*/
-#ifdef NAS_MME
/****************************************************************************
** **
** Name: esm_proc_default_eps_bearer_context() **
@@ -142,7 +126,7 @@ int esm_proc_default_eps_bearer_context(emm_data_context_t *ctx, int pid,
LOG_FUNC_IN;
LOG_TRACE(INFO, "ESM-PROC - Default EPS bearer context activation "
- "(ueid=%u, pid=%d, GBR UL %u GBR DL %u, MBR UL %u MBR DL %u QCI %u)",
+ "(ueid="NAS_UE_ID_FMT", pid=%d, GBR UL %u GBR DL %u, MBR UL %u MBR DL %u QCI %u)",
ctx->ueid,
pid,
qos->gbrUL,
@@ -216,11 +200,11 @@ int esm_proc_default_eps_bearer_context_request(int is_standalone,
/* Send activate default EPS bearer context request message and
* start timer T3485 */
LOG_TRACE(INFO,"ESM-PROC - Initiate standalone default EPS bearer context activation "
- "(ueid=%u, ebi=%d)", ctx->ueid, ebi);
+ "(ueid="NAS_UE_ID_FMT", ebi=%d)", ctx->ueid, ebi);
rc = _default_eps_bearer_activate(ctx, ebi, msg);
} else {
LOG_TRACE(INFO,"ESM-PROC - Initiate non standalone default EPS bearer context activation "
- "(ueid=%u, ebi=%d)", ctx->ueid, ebi);
+ "(ueid="NAS_UE_ID_FMT", ebi=%d)", ctx->ueid, ebi);
}
if (rc != RETURNerror) {
@@ -267,7 +251,7 @@ int esm_proc_default_eps_bearer_context_accept(emm_data_context_t *ctx, int ebi,
int rc;
LOG_TRACE(INFO, "ESM-PROC - Default EPS bearer context activation "
- "accepted by the UE (ueid=%u, ebi=%d)", ctx->ueid, ebi);
+ "accepted by the UE (ueid="NAS_UE_ID_FMT", ebi=%d)", ctx->ueid, ebi);
/* Stop T3485 timer if running */
rc = esm_ebr_stop_timer(ctx, ebi);
@@ -316,7 +300,7 @@ int esm_proc_default_eps_bearer_context_reject(emm_data_context_t *ctx, int ebi,
int rc;
LOG_TRACE(WARNING, "ESM-PROC - Default EPS bearer context activation "
- "not accepted by the UE (ueid=%u, ebi=%d)", ctx->ueid, ebi);
+ "not accepted by the UE (ueid="NAS_UE_ID_FMT", ebi=%d)", ctx->ueid, ebi);
/* Stop T3485 timer if running */
rc = esm_ebr_stop_timer(ctx, ebi);
@@ -368,7 +352,7 @@ int esm_proc_default_eps_bearer_context_failure(emm_data_context_t *ctx)
LOG_FUNC_IN;
LOG_TRACE(WARNING, "ESM-PROC - Default EPS bearer context activation "
- "failure (ueid=%u)", ctx->ueid);
+ "failure (ueid="NAS_UE_ID_FMT")", ctx->ueid);
/* Get the EPS bearer identity of the EPS bearer context which is still
* pending in the active pending state */
@@ -388,295 +372,7 @@ int esm_proc_default_eps_bearer_context_failure(emm_data_context_t *ctx)
LOG_FUNC_RETURN (RETURNerror);
}
-#endif // NAS_MME
-/*
- * --------------------------------------------------------------------------
- * Default EPS bearer context activation procedure executed by the UE
- * --------------------------------------------------------------------------
- */
-#ifdef NAS_UE
-/****************************************************************************
- ** **
- ** Name: esm_proc_default_eps_bearer_context_request() **
- ** **
- ** Description: Creates local default EPS bearer context upon receipt of **
- ** the ACTIVATE DEFAULT EPS BEARER CONTEXT REQUEST message. **
- ** **
- ** Inputs: pid: PDN connection identifier **
- ** ebi: EPS bearer identity **
- ** qos: EPS bearer level QoS parameters **
- ** Others: None **
- ** **
- ** Outputs: esm_cause: Cause code returned upon ESM procedure **
- ** failure **
- ** Return: RETURNok, RETURNerror **
- ** Others: _default_eps_bearer_context_data **
- ** **
- ***************************************************************************/
-int esm_proc_default_eps_bearer_context_request(int pid, int ebi,
- const esm_proc_qos_t *qos,
- int *esm_cause)
-{
- LOG_FUNC_IN;
-
- int rc = RETURNerror;
-
- LOG_TRACE(INFO, "ESM-PROC - Default EPS bearer context activation "
- "requested by the network (ebi=%d)", ebi);
-
- /* Assign default EPS bearer context */
- int new_ebi = esm_ebr_assign(ebi, pid+1, TRUE);
-
- if (new_ebi == ESM_EBI_UNASSIGNED) {
- /* 3GPP TS 24.301, section 6.4.1.5, abnormal cases a and b
- * Default EPS bearer context activation request for an already
- * activated default or dedicated EPS bearer context
- */
- int old_pid, old_bid;
- /* Locally deactivate the existing EPS bearer context and proceed
- * with the requested default EPS bearer context activation */
- rc = esm_proc_eps_bearer_context_deactivate(TRUE, ebi,
- &old_pid, &old_bid);
-
- if (rc != RETURNok) {
- /* Failed to release EPS bearer context */
- *esm_cause = ESM_CAUSE_PROTOCOL_ERROR;
- } else {
- /* Assign new default EPS bearer context */
- ebi = esm_ebr_assign(ebi, pid+1, TRUE);
- }
- }
-
- if (ebi != ESM_EBI_UNASSIGNED) {
- /* Create new default EPS bearer context */
- ebi = esm_ebr_context_create(pid, ebi, TRUE, qos, NULL);
-
- if (ebi != ESM_EBI_UNASSIGNED) {
- /* Default EPS bearer contextx successfully created */
- _default_eps_bearer_context_data.ebi = ebi;
- rc = RETURNok;
- } else {
- /* No resource available */
- LOG_TRACE(WARNING, "ESM-PROC - Failed to create new default EPS "
- "bearer context");
- *esm_cause = ESM_CAUSE_INSUFFICIENT_RESOURCES;
- }
- }
-
- LOG_FUNC_RETURN (rc);
-}
-
-/****************************************************************************
- ** **
- ** Name: esm_proc_default_eps_bearer_context_accept() **
- ** **
- ** Description: Performs default EPS bearer context activation procedure **
- ** accepted by the UE. **
- ** **
- ** 3GPP TS 24.301, section 6.4.1.3 **
- ** The UE accepts default EPS bearer context activation by **
- ** sending ACTIVATE DEFAULT EPS BEARER CONTEXT ACCEPT mes- **
- ** sage and entering the state BEARER CONTEXT ACTIVE. **
- ** If the default bearer is activated as part of the attach **
- ** procedure, the UE shall send the accept message together **
- ** with ATTACH COMPLETE message. **
- ** **
- ** Inputs: is_standalone: Indicates whether the activate default EPS **
- ** bearer context accept has to be sent stand-**
- ** alone or together within an attach comple- **
- ** te message **
- ** ebi: EPS bearer identity **
- ** msg: Encoded ESM message to be sent **
- ** ue_triggered: TRUE if the EPS bearer context procedure **
- ** was triggered by the UE (should be always **
- ** TRUE) **
- ** Others: None **
- ** **
- ** Outputs: None **
- ** Return: RETURNok, RETURNerror **
- ** Others: None **
- ** **
- ***************************************************************************/
-int esm_proc_default_eps_bearer_context_accept(int is_standalone, int ebi,
- OctetString *msg, int ue_triggered)
-{
- LOG_FUNC_IN;
-
- int rc = RETURNok;
-
- LOG_TRACE(INFO,"ESM-PROC - Default EPS bearer context activation "
- "accepted by the UE (ebi=%d)", ebi);
-
- if (is_standalone) {
- emm_sap_t emm_sap;
- emm_esm_data_t *emm_esm = &emm_sap.u.emm_esm.u.data;
- /*
- * Notity EMM that ESM PDU has to be forwarded to lower layers
- */
- emm_sap.primitive = EMMESM_UNITDATA_REQ;
- emm_sap.u.emm_esm.ueid = 0;
- emm_esm->msg.length = msg->length;
- emm_esm->msg.value = msg->value;
- rc = emm_sap_send(&emm_sap);
- }
-
- if (rc != RETURNerror) {
- /* Set the EPS bearer context state to ACTIVE */
- rc = esm_ebr_set_status(ebi, ESM_EBR_ACTIVE, ue_triggered);
-
- if (rc != RETURNok) {
- /* The EPS bearer context was already in ACTIVE state */
- LOG_TRACE(WARNING, "ESM-PROC - EBI %d was already ACTIVE", ebi);
- /* Accept network retransmission of already accepted activate
- * default EPS bearer context request */
- LOG_FUNC_RETURN (RETURNok);
- }
- }
-
- LOG_FUNC_RETURN (rc);
-}
-
-/****************************************************************************
- ** **
- ** Name: esm_proc_default_eps_bearer_context_reject() **
- ** **
- ** Description: Performs default EPS bearer context activation procedure **
- ** not accepted by the UE. **
- ** **
- ** 3GPP TS 24.301, section 6.4.1.4 **
- ** The UE rejects default EPS bearer context activation by **
- ** sending ACTIVATE DEFAULT EPS BEARER CONTEXT REJECT mes- **
- ** sage and entering the state BEARER CONTEXT INACTIVE. **
- ** If the default EPS bearer context activation is part of **
- ** the attach procedure, the ESM sublayer shall notify the **
- ** EMM sublayer of an ESM failure. **
- ** **
- ** Inputs: is_standalone: Indicates whether the activate default EPS **
- ** bearer context accept has to be sent stand-**
- ** alone or together within an attach comple- **
- ** te message **
- ** ebi: EPS bearer identity **
- ** msg: Encoded ESM message to be sent **
- ** ue_triggered: Not used **
- ** Others: None **
- ** **
- ** Outputs: None **
- ** Return: RETURNok, RETURNerror **
- ** Others: None **
- ** **
- ***************************************************************************/
-int esm_proc_default_eps_bearer_context_reject(int is_standalone, int ebi,
- OctetString *msg, int ue_triggered)
-{
- LOG_FUNC_IN;
-
- int rc = RETURNok;
-
- LOG_TRACE(WARNING, "ESM-PROC - Default EPS bearer context activation "
- "not accepted by the UE (ebi=%d)", ebi);
-
- if ( !esm_ebr_is_not_in_use(ebi) ) {
- /* Release EPS bearer data currently in use */
- rc = esm_ebr_release(ebi);
- }
-
- if (rc != RETURNok) {
- LOG_TRACE(WARNING, "ESM-PROC - Failed to release EPS bearer data");
- } else if (is_standalone) {
- emm_sap_t emm_sap;
- emm_esm_data_t *emm_esm = &emm_sap.u.emm_esm.u.data;
- /*
- * Notity EMM that ESM PDU has to be forwarded to lower layers
- */
- emm_sap.primitive = EMMESM_UNITDATA_REQ;
- emm_sap.u.emm_esm.ueid = 0;
- emm_esm->msg.length = msg->length;
- emm_esm->msg.value = msg->value;
- rc = emm_sap_send(&emm_sap);
- } else {
- /* An error is returned to notify EMM that the default EPS bearer
- * activation procedure initiated as part of the initial attach
- * procedure has failed
- */
- rc = RETURNerror;
- }
-
- LOG_FUNC_RETURN (rc);
-}
-
-/****************************************************************************
- ** **
- ** Name: esm_proc_default_eps_bearer_context_complete() **
- ** **
- ** Description: Terminates the default EPS bearer context activation pro- **
- ** cedure upon receiving indication from the EPS Mobility **
- ** Management sublayer that the ACTIVATE DEFAULT EPS BEARER **
- ** CONTEXT ACCEPT message has been successfully delivered to **
- ** the MME. **
- ** **
- ** Inputs: None **
- ** Others: None **
- ** **
- ** Outputs: None **
- ** Return: RETURNok, RETURNerror **
- ** Others: _default_eps_bearer_context_data **
- ** **
- ***************************************************************************/
-int esm_proc_default_eps_bearer_context_complete(void)
-{
- LOG_FUNC_IN;
-
- LOG_TRACE(INFO,
- "ESM-PROC - Default EPS bearer context activation complete");
-
- /* Reset default EPS bearer context internal data */
- _default_eps_bearer_context_data.ebi = ESM_EBI_UNASSIGNED;
-
- LOG_FUNC_RETURN (RETURNok);
-}
-
-/****************************************************************************
- ** **
- ** Name: esm_proc_default_eps_bearer_context_failure() **
- ** **
- ** Description: Performs default EPS bearer context activation procedure **
- ** upon receiving transmission failure of ESM message indi- **
- ** cation from the EPS Mobility Management sublayer **
- ** **
- ** The UE releases the default EPS bearer context previously **
- ** allocated before the ACTIVATE DEFAULT EPS BEARER CONTEXT **
- ** ACCEPT message was sent. **
- ** **
- ** Inputs: None **
- ** Others: _default_eps_bearer_context_data **
- ** **
- ** Outputs: None **
- ** Return: RETURNok, RETURNerror **
- ** Others: _default_eps_bearer_context_data **
- ** **
- ***************************************************************************/
-int esm_proc_default_eps_bearer_context_failure(void)
-{
- LOG_FUNC_IN;
-
- int ebi = _default_eps_bearer_context_data.ebi;
- int pid, bid;
-
- LOG_TRACE(WARNING,
- "ESM-PROC - Default EPS bearer context activation failure");
-
- /* Release the default EPS bearer context and enter state INACTIVE */
- int rc = esm_proc_eps_bearer_context_deactivate(TRUE, ebi, &pid, &bid);
-
- if (rc != RETURNerror) {
- /* Reset default EPS bearer context internal data */
- _default_eps_bearer_context_data.ebi = ESM_EBI_UNASSIGNED;
- }
-
- LOG_FUNC_RETURN (rc);
-}
-#endif // NAS_UE
/****************************************************************************/
/********************* L O C A L F U N C T I O N S *********************/
@@ -687,7 +383,6 @@ int esm_proc_default_eps_bearer_context_failure(void)
* Timer handlers
* --------------------------------------------------------------------------
*/
-#ifdef NAS_MME
/****************************************************************************
** **
** Name: _default_eps_bearer_activate_t3485_handler() **
@@ -722,7 +417,7 @@ static void *_default_eps_bearer_activate_t3485_handler(void *args)
/* Increment the retransmission counter */
data->count += 1;
- LOG_TRACE(WARNING, "ESM-PROC - T3485 timer expired (ueid=%d, ebi=%d), "
+ LOG_TRACE(WARNING, "ESM-PROC - T3485 timer expired (ueid="NAS_UE_ID_FMT", ebi=%d), "
"retransmission counter = %d",
data->ueid, data->ebi, data->count);
@@ -800,4 +495,3 @@ static int _default_eps_bearer_activate(emm_data_context_t *ctx, int ebi,
LOG_FUNC_RETURN (rc);
}
-#endif // NAS_MME
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/EpsBearerContextDeactivation.c b/openair-cn/NAS/MME/ESM/EpsBearerContextDeactivation.c
similarity index 61%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/EpsBearerContextDeactivation.c
rename to openair-cn/NAS/MME/ESM/EpsBearerContextDeactivation.c
index 2e4791f907..b26240a848 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/esm/EpsBearerContextDeactivation.c
+++ b/openair-cn/NAS/MME/ESM/EpsBearerContextDeactivation.c
@@ -62,10 +62,6 @@ Description Defines the EPS bearer context deactivation ESM procedure
#include "esm_ebr.h"
#include "esm_ebr_context.h"
-#ifdef NAS_UE
-#include "esm_main.h"
-#endif
-
#include "emm_sap.h"
#include "esm_sap.h"
@@ -77,15 +73,7 @@ Description Defines the EPS bearer context deactivation ESM procedure
/******************* L O C A L D E F I N I T I O N S *******************/
/****************************************************************************/
-/*
- * --------------------------------------------------------------------------
- * Internal data handled by the EPS bearer context deactivation procedure
- * in the UE
- * --------------------------------------------------------------------------
- */
-#ifdef NAS_UE
-static int _eps_bearer_release(int ebi, int *pid, int *bid);
-#endif // NAS_UE
+
/*
* --------------------------------------------------------------------------
@@ -93,7 +81,6 @@ static int _eps_bearer_release(int ebi, int *pid, int *bid);
* in the MME
* --------------------------------------------------------------------------
*/
-#ifdef NAS_MME
/*
* Timer handlers
*/
@@ -107,7 +94,6 @@ static int _eps_bearer_deactivate(emm_data_context_t *ctx, int ebi,
const OctetString *msg);
static int _eps_bearer_release(emm_data_context_t *ctx, int ebi, int *pid, int *bid);
-#endif // NAS_MME
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
@@ -118,7 +104,6 @@ static int _eps_bearer_release(emm_data_context_t *ctx, int ebi, int *pid, int *
* EPS bearer context deactivation procedure executed by the MME
* --------------------------------------------------------------------------
*/
-#ifdef NAS_MME
/****************************************************************************
** **
** Name: esm_proc_eps_bearer_context_deactivate() **
@@ -179,7 +164,7 @@ int esm_proc_eps_bearer_context_deactivate(emm_data_context_t *ctx, int is_local
}
LOG_TRACE(INFO, "ESM-PROC - EPS bearer context deactivation "
- "(ueid=%u, ebi=%d)", ctx->ueid, ebi);
+ "(ueid="NAS_UE_ID_FMT", ebi=%d)", ctx->ueid, ebi);
if ((ctx != NULL) &&
(*pid < ESM_DATA_PDN_MAX) ) {
@@ -249,7 +234,7 @@ int esm_proc_eps_bearer_context_deactivate_request(int is_standalone,
int rc;
LOG_TRACE(INFO,"ESM-PROC - Initiate EPS bearer context deactivation "
- "(ueid=%d, ebi=%d)", ctx->ueid, ebi);
+ "(ueid="NAS_UE_ID_FMT", ebi=%d)", ctx->ueid, ebi);
/* Send deactivate EPS bearer context request message and
* start timer T3495 */
@@ -303,7 +288,7 @@ int esm_proc_eps_bearer_context_deactivate_accept(emm_data_context_t *ctx, int e
int pid = RETURNerror;
LOG_TRACE(INFO, "ESM-PROC - EPS bearer context deactivation "
- "accepted by the UE (ueid=%u, ebi=%d)", ctx->ueid, ebi);
+ "accepted by the UE (ueid="NAS_UE_ID_FMT", ebi=%d)", ctx->ueid, ebi);
/* Stop T3495 timer if running */
rc = esm_ebr_stop_timer(ctx, ebi);
@@ -323,243 +308,7 @@ int esm_proc_eps_bearer_context_deactivate_accept(emm_data_context_t *ctx, int e
LOG_FUNC_RETURN (pid);
}
-#endif // NAS_MME
-/*
- * --------------------------------------------------------------------------
- * EPS bearer context deactivation procedure executed by the UE
- * --------------------------------------------------------------------------
- */
-#ifdef NAS_UE
-/****************************************************************************
- ** **
- ** Name: esm_proc_eps_bearer_context_deactivate() **
- ** **
- ** Description: Locally releases the EPS bearer context identified by the **
- ** given EPS bearer identity, without peer-to-peer signal- **
- ** ling between the UE and the MME, or checks whether the UE **
- ** has an EPS bearer context with specified EPS bearer iden- **
- ** tity activated. **
- ** **
- ** Inputs: is local: TRUE if the EPS bearer context has to be **
- ** locally released without peer-to-peer si- **
- ** gnalling between the UE and the MME **
- ** ebi: EPS bearer identity of the EPS bearer con- **
- ** text to be deactivated **
- ** Others: _esm_data **
- ** **
- ** Outputs: pid: Identifier of the PDN connection the EPS **
- ** bearer belongs to **
- ** bid: Identifier of the released EPS bearer con- **
- ** text entry **
- ** Return: RETURNok, RETURNerror **
- ** Others: None **
- ** **
- ***************************************************************************/
-int esm_proc_eps_bearer_context_deactivate(int is_local, int ebi,
- int *pid, int *bid)
-{
- LOG_FUNC_IN;
-
- int rc = RETURNerror;
- int i;
-
- if (is_local) {
- if (ebi != ESM_SAP_ALL_EBI) {
- /* Locally release the EPS bearer context */
- rc = _eps_bearer_release(ebi, pid, bid);
- } else {
- /* Locally release all the EPS bearer contexts */
- *bid = 0;
-
- for (*pid = 0; *pid < ESM_DATA_PDN_MAX; (*pid)++) {
- if (_esm_data.pdn[*pid].data) {
- rc = _eps_bearer_release(ESM_EBI_UNASSIGNED, pid, bid);
-
- if (rc != RETURNok) {
- break;
- }
- }
- }
- }
-
- LOG_FUNC_RETURN (rc);
- }
-
- LOG_TRACE(WARNING, "ESM-PROC - EPS bearer context deactivation (ebi=%d)",
- ebi);
-
- if (*pid < ESM_DATA_PDN_MAX) {
- if (_esm_data.pdn[*pid].pid != *pid) {
- LOG_TRACE(ERROR, "ESM-PROC - PDN connection identifier %d "
- "is not valid", *pid);
- } else if (_esm_data.pdn[*pid].data == NULL) {
- LOG_TRACE(ERROR, "ESM-PROC - PDN connection %d has not been "
- "allocated", *pid);
- } else if (!_esm_data.pdn[*pid].is_active) {
- LOG_TRACE(WARNING, "ESM-PROC - PDN connection %d is not active",
- *pid);
- } else {
- esm_pdn_t *pdn = _esm_data.pdn[*pid].data;
-
- for (i = 0; i < pdn->n_bearers; i++) {
- if (pdn->bearer[i]->ebi != ebi) {
- continue;
- }
-
- /* The EPS bearer context to be released is valid */
- rc = RETURNok;
- }
- }
- }
-
- LOG_FUNC_RETURN (rc);
-}
-
-/****************************************************************************
- ** **
- ** Name: esm_proc_eps_bearer_context_deactivate_request() **
- ** **
- ** Description: Deletes the EPS bearer context identified by the EPS bea- **
- ** rer identity upon receipt of the DEACTIVATE EPS BEARER **
- ** CONTEXT REQUEST message. **
- ** **
- ** Inputs: ebi: EPS bearer identity **
- ** Others: None **
- ** **
- ** Outputs: esm_cause: Cause code returned upon ESM procedure **
- ** failure **
- ** Return: RETURNok, RETURNerror **
- ** Others: None **
- ** **
- ***************************************************************************/
-int esm_proc_eps_bearer_context_deactivate_request(int ebi, int *esm_cause)
-{
- LOG_FUNC_IN;
-
- int pid, bid;
- int rc = RETURNok;
-
- LOG_TRACE(INFO, "ESM-PROC - EPS bearer context deactivation "
- "requested by the network (ebi=%d)", ebi);
-
- /* Release the EPS bearer context entry */
- if (esm_ebr_context_release(ebi, &pid, &bid) == ESM_EBI_UNASSIGNED) {
- LOG_TRACE(WARNING, "ESM-PROC - Failed to release EPS bearer context");
- *esm_cause = ESM_CAUSE_PROTOCOL_ERROR;
- LOG_FUNC_RETURN (RETURNerror);
- }
-
- if (bid == 0) {
- /* The EPS bearer identity is that of the default bearer assigned to
- * the PDN connection */
- if (*esm_cause == ESM_CAUSE_REACTIVATION_REQUESTED) {
- esm_sap_t esm_sap;
- int active = FALSE;
-
- /* 3GPP TS 24.301, section 6.4.4.3
- * The UE should re-initiate the UE requested PDN connectivity
- * procedure for the APN associated to the PDN it was connected
- * to in order to reactivate the EPS bearer context
- */
- LOG_TRACE(WARNING, "ESM-PROC - The network requests PDN "
- "connection reactivation");
-
- /* Get PDN context parameters */
- rc = esm_main_get_pdn(pid + 1, &esm_sap.data.pdn_connect.pdn_type,
- &esm_sap.data.pdn_connect.apn,
- &esm_sap.data.pdn_connect.is_emergency,
- &active);
-
- if (rc != RETURNerror) {
- if (active) {
- LOG_TRACE(ERROR, "ESM-PROC - Connectivity to APN %s "
- "has not been deactivated",
- esm_sap.data.pdn_connect.apn);
- *esm_cause = ESM_CAUSE_REQUEST_REJECTED_UNSPECIFIED;
- LOG_FUNC_RETURN (RETURNerror);
- }
-
- /*
- * Notify ESM to re-initiate PDN connectivity procedure
- */
- esm_sap.primitive = ESM_PDN_CONNECTIVITY_REQ;
- esm_sap.is_standalone = TRUE;
- esm_sap.data.pdn_connect.is_defined = TRUE;
- esm_sap.data.pdn_connect.cid = pid + 1;
- rc = esm_sap_send(&esm_sap);
- }
- }
- }
-
- LOG_FUNC_RETURN (rc);
-}
-
-/****************************************************************************
- ** **
- ** Name: esm_proc_eps_bearer_context_deactivate_accept() **
- ** **
- ** Description: Performs EPS bearer context deactivation procedure accep- **
- ** ted by the UE. **
- ** **
- ** 3GPP TS 24.301, section 6.4.4.3 **
- ** The UE accepts EPS bearer context deactivation by sending **
- ** DEACTIVATE EPS BEARER CONTEXT ACCEPT message and entering **
- ** the state BEARER CONTEXT INACTIVE. **
- ** **
- ** Inputs: is_standalone: Should be always TRUE **
- ** ebi: EPS bearer identity **
- ** msg: Encoded ESM message to be sent **
- ** ue_triggered: TRUE if the EPS bearer context procedure **
- ** was triggered by the UE **
- ** Others: None **
- ** **
- ** Outputs: None **
- ** Return: RETURNok, RETURNerror **
- ** Others: None **
- ** **
- ***************************************************************************/
-int esm_proc_eps_bearer_context_deactivate_accept(int is_standalone, int ebi,
- OctetString *msg, int ue_triggered)
-{
- LOG_FUNC_IN;
-
- int rc = RETURNok;
-
- LOG_TRACE(INFO,"ESM-PROC - EPS bearer context deactivation accepted");
-
- if (is_standalone) {
- emm_sap_t emm_sap;
- /*
- * Notity EMM that ESM PDU has to be forwarded to lower layers
- */
- emm_sap.primitive = EMMESM_UNITDATA_REQ;
- emm_sap.u.emm_esm.ueid = 0;
- emm_sap.u.emm_esm.u.data.msg.length = msg->length;
- emm_sap.u.emm_esm.u.data.msg.value = msg->value;
- rc = emm_sap_send(&emm_sap);
- }
-
- if (rc != RETURNerror) {
- /* Set the EPS bearer context state to INACTIVE */
- rc = esm_ebr_set_status(ebi, ESM_EBR_INACTIVE, ue_triggered);
-
- if (rc != RETURNok) {
- /* The EPS bearer context was already in INACTIVE state */
- LOG_TRACE(WARNING, "ESM-PROC - EBI %d was already INACTIVE", ebi);
- /* Accept network retransmission of already accepted deactivate
- * EPS bearer context request */
- LOG_FUNC_RETURN (RETURNok);
- }
-
- /* Release EPS bearer data */
- rc = esm_ebr_release(ebi);
- }
-
- LOG_FUNC_RETURN (rc);
-}
-
-#endif // NAS_UE
/****************************************************************************/
/********************* L O C A L F U N C T I O N S *********************/
@@ -570,7 +319,6 @@ int esm_proc_eps_bearer_context_deactivate_accept(int is_standalone, int ebi,
* Timer handlers
* --------------------------------------------------------------------------
*/
-#ifdef NAS_MME
/****************************************************************************
** **
** Name: _eps_bearer_deactivate_t3495_handler() **
@@ -605,7 +353,7 @@ static void *_eps_bearer_deactivate_t3495_handler(void *args)
/* Increment the retransmission counter */
data->count += 1;
- LOG_TRACE(WARNING, "ESM-PROC - T3495 timer expired (ueid=%d, ebi=%d), "
+ LOG_TRACE(WARNING, "ESM-PROC - T3495 timer expired (ueid="NAS_UE_ID_FMT", ebi=%d), "
"retransmission counter = %d",
data->ueid, data->ebi, data->count);
@@ -630,7 +378,6 @@ static void *_eps_bearer_deactivate_t3495_handler(void *args)
LOG_FUNC_RETURN (NULL);
}
-#endif // NAS_MME
/*
* --------------------------------------------------------------------------
@@ -638,7 +385,6 @@ static void *_eps_bearer_deactivate_t3495_handler(void *args)
* --------------------------------------------------------------------------
*/
-#ifdef NAS_MME
/****************************************************************************
** **
** Name: _eps_bearer_deactivate() **
@@ -734,62 +480,4 @@ static int _eps_bearer_release(emm_data_context_t *ctx, int ebi, int *pid, int *
LOG_FUNC_RETURN (rc);
}
-#endif // NAS_MME
-/*
- * --------------------------------------------------------------------------
- * UE specific local functions
- * --------------------------------------------------------------------------
- */
-
-#ifdef NAS_UE
-/****************************************************************************
- ** **
- ** Name: _eps_bearer_release() **
- ** **
- ** Description: Releases the EPS bearer context identified by the given **
- ** EPS bearer identity and enters state INACTIVE. **
- ** **
- ** Inputs: ebi: EPS bearer identity **
- ** Others: None **
- ** **
- ** Outputs: pid: Identifier of the PDN connection the EPS **
- ** bearer belongs to **
- ** bid: Identifier of the released EPS bearer con- **
- ** text entry **
- ** Return: RETURNok, RETURNerror **
- ** Others: None **
- ** **
- ***************************************************************************/
-static int _eps_bearer_release(int ebi, int *pid, int *bid)
-{
- LOG_FUNC_IN;
-
- int rc = RETURNerror;
-
- /* Release the EPS bearer context entry */
- ebi = esm_ebr_context_release(ebi, pid, bid);
-
- if (ebi == ESM_EBI_UNASSIGNED) {
- LOG_TRACE(WARNING, "ESM-PROC - Failed to release EPS bearer context");
- } else {
- /* Set the EPS bearer context state to INACTIVE */
- rc = esm_ebr_set_status(ebi, ESM_EBR_INACTIVE, FALSE);
-
- if (rc != RETURNok) {
- /* The EPS bearer context was already in INACTIVE state */
- LOG_TRACE(WARNING, "ESM-PROC - EBI %d was already INACTIVE", ebi);
- } else {
- /* Release EPS bearer data */
- rc = esm_ebr_release(ebi);
-
- if (rc != RETURNok) {
- LOG_TRACE(WARNING,
- "ESM-PROC - Failed to release EPS bearer data");
- }
- }
- }
-
- LOG_FUNC_RETURN (rc);
-}
-#endif // NAS_UE
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/EsmStatusHdl.c b/openair-cn/NAS/MME/ESM/EsmStatusHdl.c
similarity index 98%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/EsmStatusHdl.c
rename to openair-cn/NAS/MME/ESM/EsmStatusHdl.c
index d01020f395..6edada9f0c 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/esm/EsmStatusHdl.c
+++ b/openair-cn/NAS/MME/ESM/EsmStatusHdl.c
@@ -97,9 +97,7 @@ Description Defines the ESM status procedure executed by the Non-Access
** **
***************************************************************************/
int esm_proc_status_ind(
-#ifdef NAS_MME
emm_data_context_t *ctx,
-#endif
int pti, int ebi, int *esm_cause)
{
LOG_FUNC_IN;
@@ -172,9 +170,7 @@ int esm_proc_status_ind(
** **
***************************************************************************/
int esm_proc_status(int is_standalone,
-#ifdef NAS_MME
emm_data_context_t *ctx,
-#endif
int ebi, OctetString *msg,
int ue_triggered)
{
@@ -189,13 +185,8 @@ int esm_proc_status(int is_standalone,
* Notity EMM that ESM PDU has to be forwarded to lower layers
*/
emm_sap.primitive = EMMESM_UNITDATA_REQ;
-#ifdef NAS_UE
- emm_sap.u.emm_esm.ueid = 0;
-#endif
-#ifdef NAS_MME
emm_sap.u.emm_esm.ueid = ctx->ueid;
emm_sap.u.emm_esm.ctx = ctx;
-#endif
emm_sap.u.emm_esm.u.data.msg.length = msg->length;
emm_sap.u.emm_esm.u.data.msg.value = msg->value;
rc = emm_sap_send(&emm_sap);
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/Makefile b/openair-cn/NAS/MME/ESM/Makefile
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/Makefile
rename to openair-cn/NAS/MME/ESM/Makefile
diff --git a/openair-cn/NAS/MME/ESM/PdnConnectivity.c b/openair-cn/NAS/MME/ESM/PdnConnectivity.c
new file mode 100644
index 0000000000..e2eda77bed
--- /dev/null
+++ b/openair-cn/NAS/MME/ESM/PdnConnectivity.c
@@ -0,0 +1,556 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+Source PdnConnectivity.c
+
+Version 0.1
+
+Date 2013/01/02
+
+Product NAS stack
+
+Subsystem EPS Session Management
+
+Author Frederic Maurel
+
+Description Defines the PDN connectivity ESM procedure executed by the
+ Non-Access Stratum.
+
+ The PDN connectivity procedure is used by the UE to request
+ the setup of a default EPS bearer to a PDN.
+
+ The procedure is used either to establish the 1st default
+ bearer by including the PDN CONNECTIVITY REQUEST message
+ into the initial attach message, or to establish subsequent
+ default bearers to additional PDNs in order to allow the UE
+ simultaneous access to multiple PDNs by sending the message
+ stand-alone.
+
+*****************************************************************************/
+
+#include // malloc, free
+#include // memset, memcpy, memcmp
+#include // isprint
+
+#include "esm_proc.h"
+#include "commonDef.h"
+#include "nas_log.h"
+
+#include "esmData.h"
+#include "esm_cause.h"
+#include "esm_pt.h"
+
+# include "mme_api.h"
+
+#include "emm_sap.h"
+
+#if defined(ENABLE_ITTI)
+# include "assertions.h"
+#endif
+
+/****************************************************************************/
+/**************** E X T E R N A L D E F I N I T I O N S ****************/
+/****************************************************************************/
+
+/****************************************************************************/
+/******************* L O C A L D E F I N I T I O N S *******************/
+/****************************************************************************/
+
+
+
+/*
+ * --------------------------------------------------------------------------
+ * Internal data handled by the PDN connectivity procedure in the MME
+ * --------------------------------------------------------------------------
+ */
+/*
+ * PDN connection handlers
+ */
+static int _pdn_connectivity_create(emm_data_context_t *ctx,
+ int pti,
+ const OctetString *apn,
+ esm_proc_pdn_type_t pdn_type,
+ const OctetString *pdn_addr,
+ int is_emergency);
+int _pdn_connectivity_delete(emm_data_context_t *ctx, int pid);
+
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+
+/*
+ * --------------------------------------------------------------------------
+ * PDN connectivity procedure executed by the MME
+ * --------------------------------------------------------------------------
+ */
+/****************************************************************************
+ ** **
+ ** Name: esm_proc_pdn_connectivity_request() **
+ ** **
+ ** Description: Performs PDN connectivity procedure requested by the UE. **
+ ** **
+ ** 3GPP TS 24.301, section 6.5.1.3 **
+ ** Upon receipt of the PDN CONNECTIVITY REQUEST message, the **
+ ** MME checks if connectivity with the requested PDN can be **
+ ** established. If no requested APN is provided the MME **
+ ** shall use the default APN as the requested APN if the **
+ ** request type is different from "emergency", or the APN **
+ ** configured for emergency bearer services if the request **
+ ** type is "emergency". **
+ ** If connectivity with the requested PDN is accepted by the **
+ ** network, the MME shall initiate the default EPS bearer **
+ ** context activation procedure. **
+ ** **
+ ** Inputs: ueid: UE local identifier **
+ ** pti: Identifies the PDN connectivity procedure **
+ ** requested by the UE **
+ ** request_type: Type of the PDN request **
+ ** pdn_type: PDN type value (IPv4, IPv6, IPv4v6) **
+ ** apn: Requested Access Point Name **
+ ** Others: _esm_data **
+ ** **
+ ** Outputs: apn: Default Access Point Name **
+ ** pdn_addr: Assigned IPv4 address and/or IPv6 suffix **
+ ** esm_qos: EPS bearer level QoS parameters **
+ ** esm_cause: Cause code returned upon ESM procedure **
+ ** failure **
+ ** Return: The identifier of the PDN connection if **
+ ** successfully created; **
+ ** RETURNerror otherwise. **
+ ** Others: _esm_data **
+ ** **
+ ***************************************************************************/
+int esm_proc_pdn_connectivity_request(emm_data_context_t *ctx, int pti,
+ esm_proc_pdn_request_t request_type,
+ OctetString *apn,
+ esm_proc_pdn_type_t pdn_type,
+ OctetString *pdn_addr,
+ esm_proc_qos_t *esm_qos,
+ int *esm_cause)
+{
+ int rc = RETURNerror;
+ int pid = RETURNerror;
+
+ LOG_FUNC_IN;
+
+ LOG_TRACE(INFO, "ESM-PROC - PDN connectivity requested by the UE "
+ "(ueid="NAS_UE_ID_FMT", pti=%d) PDN type = %s, APN = %s pdn addr = %s", ctx->ueid, pti,
+ (pdn_type == ESM_PDN_TYPE_IPV4)? "IPv4" :
+ (pdn_type == ESM_PDN_TYPE_IPV6)? "IPv6" : "IPv4v6",
+ (apn) ? (char *)(apn->value) : "null",
+ (pdn_addr) ? (char *)(pdn_addr->value) : "null");
+
+#if !defined(NAS_BUILT_IN_EPC)
+
+ /* UE identifier sanity check */
+ if (ctx->ueid >= ESM_DATA_NB_UE_MAX) {
+ LOG_TRACE(WARNING, "ESM-PROC - Number of connected UEs exceeded");
+ LOG_FUNC_RETURN (RETURNerror);
+ }
+
+#endif
+
+ /*
+ * Check network IP capabilities
+ */
+ *esm_cause = ESM_CAUSE_SUCCESS;
+ LOG_TRACE(INFO, "ESM-PROC - _esm_data.conf.features %08x", _esm_data.conf.features);
+#warning "Uncomment code about _esm_data.conf.features & (MME_API_IPV4 | MME_API_IPV6) later"
+#if defined(ORIGINAL_CODE)
+
+ switch (_esm_data.conf.features & (MME_API_IPV4 | MME_API_IPV6)) {
+ case (MME_API_IPV4 | MME_API_IPV6):
+
+ /* The network supports both IPv4 and IPv6 connection */
+ if ( (pdn_type == ESM_PDN_TYPE_IPV4V6) &&
+ (_esm_data.conf.features & MME_API_SINGLE_ADDR_BEARERS) ) {
+ /* The network supports single IP version bearers only */
+ *esm_cause = ESM_CAUSE_SINGLE_ADDRESS_BEARERS_ONLY_ALLOWED;
+ }
+
+ rc = RETURNok;
+ break;
+
+ case MME_API_IPV6:
+ /* The network supports connection to IPv6 only */
+ *esm_cause = ESM_CAUSE_PDN_TYPE_IPV6_ONLY_ALLOWED;
+
+ if (pdn_type != ESM_PDN_TYPE_IPV4) {
+ rc = RETURNok;
+ }
+
+ break;
+
+ case MME_API_IPV4:
+ /* The network supports connection to IPv4 only */
+ *esm_cause = ESM_CAUSE_PDN_TYPE_IPV4_ONLY_ALLOWED;
+
+ if (pdn_type != ESM_PDN_TYPE_IPV6) {
+ rc = RETURNok;
+ }
+
+ break;
+
+ default:
+ LOG_TRACE(ERROR,
+ "ESM-PROC - _esm_data.conf.features incorrect value (no IPV4 or IPV6 ) %X",
+ _esm_data.conf.features);
+ }
+
+#else
+ rc = RETURNok;
+#endif
+
+ if (rc != RETURNerror) {
+ int is_emergency = (request_type == ESM_PDN_REQUEST_EMERGENCY);
+#if defined(ORIGINAL_CODE)
+ mme_api_ip_version_t mme_pdn_index;
+ mme_api_qos_t qos;
+
+ switch (pdn_type) {
+ case ESM_PDN_TYPE_IPV4:
+ mme_pdn_index = MME_API_IPV4_ADDR;
+ break;
+
+ case ESM_PDN_TYPE_IPV6:
+ mme_pdn_index = MME_API_IPV6_ADDR;
+ break;
+
+ case ESM_PDN_TYPE_IPV4V6:
+ default:
+ mme_pdn_index = MME_API_IPV4V6_ADDR;
+ break;
+ }
+
+ /* Check if connectivity with the requested PDN can be established */
+ rc = mme_api_subscribe(apn, mme_pdn_index, pdn_addr, is_emergency, &qos);
+
+ if (rc != RETURNok) {
+ LOG_TRACE(WARNING, "ESM-PROC - Connectivity to the requested PDN "
+ "cannot be established");
+ *esm_cause = ESM_CAUSE_REQUEST_REJECTED_UNSPECIFIED;
+ LOG_FUNC_RETURN (RETURNerror);
+ }
+
+#endif
+
+ /* Create new PDN connection */
+ pid = _pdn_connectivity_create(ctx, pti, apn, pdn_type,
+ pdn_addr, is_emergency);
+#if defined(ORIGINAL_CODE)
+
+ /* Setup ESM QoS parameters */
+ if (esm_qos) {
+ esm_qos->gbrUL = qos.gbr[MME_API_UPLINK];
+ esm_qos->gbrDL = qos.gbr[MME_API_DOWNLINK];
+ esm_qos->mbrUL = qos.mbr[MME_API_UPLINK];
+ esm_qos->mbrDL = qos.mbr[MME_API_DOWNLINK];
+ esm_qos->qci = qos.qci;
+ }
+
+#endif
+
+ if (pid < 0) {
+ LOG_TRACE(WARNING, "ESM-PROC - Failed to create PDN connection");
+ *esm_cause = ESM_CAUSE_INSUFFICIENT_RESOURCES;
+ LOG_FUNC_RETURN(RETURNerror);
+ }
+ }
+
+ LOG_FUNC_RETURN(pid);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: esm_proc_pdn_connectivity_reject() **
+ ** **
+ ** Description: Performs PDN connectivity procedure not accepted by the **
+ ** network. **
+ ** **
+ ** 3GPP TS 24.301, section 6.5.1.4 **
+ ** If connectivity with the requested PDN cannot be accepted **
+ ** by the network, the MME shall send a PDN CONNECTIVITY RE- **
+ ** JECT message to the UE. **
+ ** **
+ ** Inputs: is_standalone: Indicates whether the PDN connectivity **
+ ** procedure was initiated as part of the at- **
+ ** tach procedure **
+ ** ueid: UE lower layer identifier **
+ ** ebi: Not used **
+ ** msg: Encoded PDN connectivity reject message to **
+ ** be sent **
+ ** ue_triggered: Not used **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int esm_proc_pdn_connectivity_reject(int is_standalone, emm_data_context_t *ctx,
+ int ebi, OctetString *msg, int ue_triggered)
+{
+ LOG_FUNC_IN;
+
+ int rc = RETURNerror;
+
+ LOG_TRACE(WARNING, "ESM-PROC - PDN connectivity not accepted by the "
+ "network (ueid="NAS_UE_ID_FMT")", ctx->ueid);
+
+ if (is_standalone) {
+ emm_sap_t emm_sap;
+ /*
+ * Notity EMM that ESM PDU has to be forwarded to lower layers
+ */
+ emm_sap.primitive = EMMESM_UNITDATA_REQ;
+ emm_sap.u.emm_esm.ctx = ctx;
+ emm_sap.u.emm_esm.u.data.msg.length = msg->length;
+ emm_sap.u.emm_esm.u.data.msg.value = msg->value;
+ rc = emm_sap_send(&emm_sap);
+ }
+
+ /* If the PDN connectivity procedure initiated as part of the initial
+ * attach procedure has failed, an error is returned to notify EMM that
+ * the ESM sublayer did not accept UE requested PDN connectivity */
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: esm_proc_pdn_connectivity_failure() **
+ ** **
+ ** Description: Performs PDN connectivity procedure upon receiving noti- **
+ ** fication from the EPS Mobility Management sublayer that **
+ ** EMM procedure that initiated PDN connectivity activation **
+ ** locally failed. **
+ ** **
+ ** The MME releases the PDN connection entry allocated when **
+ ** the PDN connectivity procedure was requested by the UE. **
+ ** **
+ ** Inputs: ueid: UE local identifier **
+ ** pid: Identifier of the PDN connection to be **
+ ** released **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int esm_proc_pdn_connectivity_failure(emm_data_context_t *ctx, int pid)
+{
+ int pti;
+
+ LOG_FUNC_IN;
+
+ LOG_TRACE(WARNING, "ESM-PROC - PDN connectivity failure (ueid="NAS_UE_ID_FMT", pid=%d)",
+ ctx->ueid, pid);
+
+ /* Delete the PDN connection entry */
+ pti = _pdn_connectivity_delete(ctx, pid);
+
+ if (pti != ESM_PT_UNASSIGNED) {
+ LOG_FUNC_RETURN (RETURNok);
+ }
+
+ LOG_FUNC_RETURN (RETURNerror);
+}
+
+/****************************************************************************/
+/********************* L O C A L F U N C T I O N S *********************/
+/****************************************************************************/
+
+
+/*
+ *---------------------------------------------------------------------------
+ * PDN connection handlers
+ *---------------------------------------------------------------------------
+ */
+/****************************************************************************
+ ** **
+ ** Name: _pdn_connectivity_create() **
+ ** **
+ ** Description: Creates a new PDN connection entry for the specified UE **
+ ** **
+ ** Inputs: ueid: UE local identifier **
+ ** ctx: UE context **
+ ** pti: Procedure transaction identity **
+ ** apn: Access Point Name of the PDN connection **
+ ** pdn_type: PDN type (IPv4, IPv6, IPv4v6) **
+ ** pdn_addr: Network allocated PDN IPv4 or IPv6 address **
+ ** is_emergency: TRUE if the PDN connection has to be esta- **
+ ** blished for emergency bearer services **
+ ** Others: _esm_data **
+ ** **
+ ** Outputs: None **
+ ** Return: The identifier of the PDN connection if **
+ ** successfully created; -1 otherwise. **
+ ** Others: _esm_data **
+ ** **
+ ***************************************************************************/
+static int _pdn_connectivity_create(emm_data_context_t *ctx,
+ int pti,
+ const OctetString *apn,
+ esm_proc_pdn_type_t pdn_type,
+ const OctetString *pdn_addr,
+ int is_emergency)
+{
+ int pid = ESM_DATA_PDN_MAX;
+
+ LOG_TRACE(INFO, "ESM-PROC - Create new PDN connection "
+ "(pti=%d) APN = %s, IP address = %s (ueid="NAS_UE_ID_FMT")", pti, apn->value,
+ (pdn_type == ESM_PDN_TYPE_IPV4)? esm_data_get_ipv4_addr(pdn_addr) :
+ (pdn_type == ESM_PDN_TYPE_IPV6)? esm_data_get_ipv6_addr(pdn_addr) :
+ esm_data_get_ipv4v6_addr(pdn_addr), ctx->ueid);
+
+ /* Search for an available PDN connection entry */
+ for (pid = 0; pid < ESM_DATA_PDN_MAX; pid++) {
+ if (ctx->esm_data_ctx.pdn[pid].data != NULL) {
+ continue;
+ }
+
+ break;
+ }
+
+ if (pid < ESM_DATA_PDN_MAX) {
+ /* Create new PDN connection */
+ esm_pdn_t *pdn = (esm_pdn_t *)malloc(sizeof(esm_pdn_t));
+
+ if (pdn != NULL) {
+ memset(pdn, 0, sizeof(esm_pdn_t));
+ /* Increment the number of PDN connections */
+ ctx->esm_data_ctx.n_pdns += 1;
+ /* Set the PDN connection identifier */
+ ctx->esm_data_ctx.pdn[pid].pid = pid;
+ /* Reset the PDN connection active indicator */
+ ctx->esm_data_ctx.pdn[pid].is_active = FALSE;
+ /* Setup the PDN connection data */
+ ctx->esm_data_ctx.pdn[pid].data = pdn;
+
+ /* Set the procedure transaction identity */
+ pdn->pti = pti;
+ /* Set the emergency bearer services indicator */
+ pdn->is_emergency = is_emergency;
+
+ /* Setup the Access Point Name */
+ if ( apn && (apn->length > 0) ) {
+ pdn->apn.value = (uint8_t *)malloc(apn->length + 1);
+
+ if (pdn->apn.value) {
+ pdn->apn.length = apn->length;
+ memcpy(pdn->apn.value, apn->value, apn->length);
+ pdn->apn.value[pdn->apn.length] = '\0';
+ }
+ }
+
+ /* Setup the IP address allocated by the network */
+ if ( pdn_addr && (pdn_addr->length > 0) ) {
+ int length =
+ ((pdn_addr->length < ESM_DATA_IP_ADDRESS_SIZE) ?
+ pdn_addr->length : ESM_DATA_IP_ADDRESS_SIZE);
+ memcpy(pdn->ip_addr, pdn_addr->value, length);
+ pdn->type = pdn_type;
+ }
+
+ /* Return the identifier of the new PDN connection */
+ return (ctx->esm_data_ctx.pdn[pid].pid);
+ }
+
+ LOG_TRACE(WARNING, "ESM-PROC - Failed to create new PDN connection "
+ "(pid=%d)", pid);
+ }
+
+ return (-1);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: _pdn_connectivity_delete() **
+ ** **
+ ** Description: Deletes PDN connection to the specified UE associated to **
+ ** PDN connection entry with given identifier **
+ ** **
+ ** Inputs: ueid: UE local identifier **
+ ** pid: Identifier of the PDN connection to be **
+ ** released **
+ ** Others: _esm_data **
+ ** **
+ ** Outputs: None **
+ ** Return: The identity of the procedure transaction **
+ ** assigned to the PDN connection when suc- **
+ ** cessfully released; **
+ ** UNASSIGNED value otherwise. **
+ ** Others: _esm_data **
+ ** **
+ ***************************************************************************/
+int _pdn_connectivity_delete(emm_data_context_t *ctx, int pid)
+{
+ int pti = ESM_PT_UNASSIGNED;
+
+ if (ctx == NULL) {
+ return pti;
+ }
+
+ if (pid < ESM_DATA_PDN_MAX) {
+ if (pid != ctx->esm_data_ctx.pdn[pid].pid) {
+ LOG_TRACE(ERROR,
+ "ESM-PROC - PDN connection identifier is not valid");
+ } else if (ctx->esm_data_ctx.pdn[pid].data == NULL) {
+ LOG_TRACE(ERROR,
+ "ESM-PROC - PDN connection has not been allocated");
+ } else if (ctx->esm_data_ctx.pdn[pid].is_active) {
+ LOG_TRACE(ERROR, "ESM-PROC - PDN connection is active");
+ } else {
+ /* Get the identity of the procedure transaction that created
+ * the PDN connection */
+ pti = ctx->esm_data_ctx.pdn[pid].data->pti;
+ }
+ }
+
+ if (pti != ESM_PT_UNASSIGNED) {
+ /* Decrement the number of PDN connections */
+ ctx->esm_data_ctx.n_pdns -= 1;
+ /* Set the PDN connection as available */
+ ctx->esm_data_ctx.pdn[pid].pid = -1;
+
+ /* Release allocated PDN connection data */
+ if (ctx->esm_data_ctx.pdn[pid].data->apn.length > 0) {
+ free(ctx->esm_data_ctx.pdn[pid].data->apn.value);
+ }
+
+ free(ctx->esm_data_ctx.pdn[pid].data);
+ ctx->esm_data_ctx.pdn[pid].data = NULL;
+ LOG_TRACE(WARNING, "ESM-PROC - PDN connection %d released", pid);
+ }
+
+ /* Return the procedure transaction identity */
+ return (pti);
+}
diff --git a/openair-cn/NAS/MME/ESM/PdnDisconnect.c b/openair-cn/NAS/MME/ESM/PdnDisconnect.c
new file mode 100644
index 0000000000..9dfcbd66fb
--- /dev/null
+++ b/openair-cn/NAS/MME/ESM/PdnDisconnect.c
@@ -0,0 +1,299 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+Source PdnDisconnect.c
+
+Version 0.1
+
+Date 2013/05/15
+
+Product NAS stack
+
+Subsystem EPS Session Management
+
+Author Frederic Maurel
+
+Description Defines the PDN disconnect ESM procedure executed by the
+ Non-Access Stratum.
+
+ The PDN disconnect procedure is used by the UE to request
+ disconnection from one PDN.
+
+ All EPS bearer contexts established towards this PDN, inclu-
+ ding the default EPS bearer context, are released.
+
+*****************************************************************************/
+
+#include "esm_proc.h"
+#include "commonDef.h"
+#include "nas_log.h"
+
+#include "esmData.h"
+#include "esm_cause.h"
+#include "esm_pt.h"
+#include "emm_sap.h"
+
+/****************************************************************************/
+/**************** E X T E R N A L D E F I N I T I O N S ****************/
+/****************************************************************************/
+
+extern int _pdn_connectivity_delete(emm_data_context_t *ctx, int pid);
+
+/****************************************************************************/
+/******************* L O C A L D E F I N I T I O N S *******************/
+/****************************************************************************/
+
+
+/*
+ * --------------------------------------------------------------------------
+ * Internal data handled by the PDN disconnect procedure in the MME
+ * --------------------------------------------------------------------------
+ */
+/*
+ * PDN disconnection handlers
+ */
+static int _pdn_disconnect_get_pid(esm_data_context_t *ctx, int pti);
+
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+
+
+/*
+ * --------------------------------------------------------------------------
+ * PDN disconnect procedure executed by the MME
+ * --------------------------------------------------------------------------
+ */
+/****************************************************************************
+ ** **
+ ** Name: esm_proc_pdn_disconnect_request() **
+ ** **
+ ** Description: Performs PDN disconnect procedure requested by the UE. **
+ ** **
+ ** 3GPP TS 24.301, section 6.5.2.3 **
+ ** Upon receipt of the PDN DISCONNECT REQUEST message, if it **
+ ** is accepted by the network, the MME shall initiate the **
+ ** bearer context deactivation procedure. **
+ ** **
+ ** Inputs: ueid: UE lower layer identifier **
+ ** pti: Identifies the PDN disconnect procedure **
+ ** requested by the UE **
+ ** Others: _esm_data **
+ ** **
+ ** Outputs: esm_cause: Cause code returned upon ESM procedure **
+ ** failure **
+ ** Return: The identifier of the PDN connection to be **
+ ** released, if it exists; **
+ ** RETURNerror otherwise. **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int esm_proc_pdn_disconnect_request(emm_data_context_t *ctx, int pti, int *esm_cause)
+{
+ int pid = RETURNerror;
+
+ LOG_FUNC_IN;
+
+ LOG_TRACE(INFO, "ESM-PROC - PDN disconnect requested by the UE "
+ "(ueid="NAS_UE_ID_FMT", pti=%d)", ctx->ueid, pti);
+
+ /* Get UE's ESM context */
+ if (ctx->esm_data_ctx.n_pdns > 1) {
+ /* Get the identifier of the PDN connection entry assigned to the
+ * procedure transaction identity */
+ pid = _pdn_disconnect_get_pid(&ctx->esm_data_ctx, pti);
+
+ if (pid < 0) {
+ LOG_TRACE(ERROR, "ESM-PROC - No PDN connection found (pti=%d)",
+ pti);
+ *esm_cause = ESM_CAUSE_PROTOCOL_ERROR;
+ LOG_FUNC_RETURN (RETURNerror);
+ }
+ } else {
+ /* Attempt to disconnect from the last PDN disconnection
+ * is not allowed */
+ *esm_cause = ESM_CAUSE_LAST_PDN_DISCONNECTION_NOT_ALLOWED;
+ }
+
+ LOG_FUNC_RETURN(pid);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: esm_proc_pdn_disconnect_accept() **
+ ** **
+ ** Description: Performs PDN disconnect procedure accepted by the UE. **
+ ** **
+ ** 3GPP TS 24.301, section 6.5.2.3 **
+ ** On reception of DEACTIVATE EPS BEARER CONTEXT ACCEPT mes- **
+ ** sage from the UE, the MME releases all the resources re- **
+ ** served for the PDN in the network. **
+ ** **
+ ** Inputs: ueid: UE lower layer identifier **
+ ** pid: Identifier of the PDN connection to be **
+ ** released **
+ ** Others: _esm_data **
+ ** **
+ ** Outputs: esm_cause: Cause code returned upon ESM procedure **
+ ** failure **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int esm_proc_pdn_disconnect_accept(emm_data_context_t *ctx, int pid, int *esm_cause)
+{
+ LOG_FUNC_IN;
+
+ LOG_TRACE(INFO, "ESM-PROC - PDN disconnect accepted by the UE "
+ "(ueid="NAS_UE_ID_FMT", pid=%d)", ctx->ueid, pid);
+
+ /* Release the connectivity with the requested PDN */
+ int rc = mme_api_unsubscribe(NULL);
+
+ if (rc != RETURNerror) {
+ /* Delete the PDN connection entry */
+ int pti = _pdn_connectivity_delete(ctx, pid);
+
+ if (pti != ESM_PT_UNASSIGNED) {
+ LOG_FUNC_RETURN (RETURNok);
+ }
+ }
+
+ *esm_cause = ESM_CAUSE_PROTOCOL_ERROR;
+ LOG_FUNC_RETURN (RETURNerror);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: esm_proc_pdn_disconnect_reject() **
+ ** **
+ ** Description: Performs PDN disconnect procedure not accepted by the **
+ ** network. **
+ ** **
+ ** 3GPP TS 24.301, section 6.5.2.4 **
+ ** Upon receipt of the PDN DISCONNECT REQUEST message, if it **
+ ** is not accepted by the network, the MME shall send a PDN **
+ ** DISCONNECT REJECT message to the UE. **
+ ** **
+ ** Inputs: is_standalone: Not used - Always TRUE **
+ ** ueid: UE lower layer identifier **
+ ** ebi: Not used **
+ ** msg: Encoded PDN disconnect reject message to **
+ ** be sent **
+ ** ue_triggered: Not used **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int esm_proc_pdn_disconnect_reject(int is_standalone, emm_data_context_t *ctx,
+ int ebi, OctetString *msg, int ue_triggered)
+{
+ LOG_FUNC_IN;
+
+ int rc;
+ emm_sap_t emm_sap;
+
+ LOG_TRACE(WARNING, "ESM-PROC - PDN disconnect not accepted by the network "
+ "(ueid="NAS_UE_ID_FMT")", ctx->ueid);
+
+ /*
+ * Notity EMM that ESM PDU has to be forwarded to lower layers
+ */
+ emm_sap.primitive = EMMESM_UNITDATA_REQ;
+ emm_sap.u.emm_esm.ueid = ctx->ueid;
+ emm_sap.u.emm_esm.ctx = ctx;
+ emm_sap.u.emm_esm.u.data.msg.length = msg->length;
+ emm_sap.u.emm_esm.u.data.msg.value = msg->value;
+ rc = emm_sap_send(&emm_sap);
+
+ LOG_FUNC_RETURN(rc);
+}
+
+/****************************************************************************/
+/********************* L O C A L F U N C T I O N S *********************/
+/****************************************************************************/
+
+/*
+ * --------------------------------------------------------------------------
+ * Timer handlers
+ * --------------------------------------------------------------------------
+ */
+
+
+/*
+ *---------------------------------------------------------------------------
+ * PDN disconnection handlers
+ *---------------------------------------------------------------------------
+ */
+
+
+/****************************************************************************
+ ** **
+ ** Name: _pdn_disconnect_get_pid() **
+ ** **
+ ** Description: Returns the identifier of the PDN connection to which the **
+ ** given procedure transaction identity has been assigned **
+ ** to establish connectivity to the specified UE **
+ ** **
+ ** Inputs: ueid: UE local identifier **
+ ** pti: The procedure transaction identity **
+ ** Others: _esm_data **
+ ** **
+ ** Outputs: None **
+ ** Return: The identifier of the PDN connection if **
+ ** found in the list; -1 otherwise. **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+static int _pdn_disconnect_get_pid(esm_data_context_t *ctx, int pti)
+{
+ int i = ESM_DATA_PDN_MAX;
+
+ if (ctx != NULL) {
+ for (i = 0; i < ESM_DATA_PDN_MAX; i++) {
+ if ( (ctx->pdn[i].pid != -1) &&
+ (ctx->pdn[i].data != NULL) ) {
+ if (ctx->pdn[i].data->pti != pti) {
+ continue;
+ }
+
+ /* PDN entry found */
+ break;
+ }
+ }
+ }
+
+ /* Return the identifier of the PDN connection */
+ return (ctx->pdn[i].pid);
+}
diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/usim/COPYING b/openair-cn/NAS/MME/ESM/SAP/COPYING
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/api/usim/COPYING
rename to openair-cn/NAS/MME/ESM/SAP/COPYING
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/sap/Makefile b/openair-cn/NAS/MME/ESM/SAP/Makefile
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/sap/Makefile
rename to openair-cn/NAS/MME/ESM/SAP/Makefile
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/sap/esm_recv.c b/openair-cn/NAS/MME/ESM/SAP/esm_recv.c
similarity index 55%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/sap/esm_recv.c
rename to openair-cn/NAS/MME/ESM/SAP/esm_recv.c
index a3f1b719c7..1114178154 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/esm/sap/esm_recv.c
+++ b/openair-cn/NAS/MME/ESM/SAP/esm_recv.c
@@ -54,13 +54,8 @@ Description Defines functions executed at the ESM Service Access
#include "esm_proc.h"
#include "esm_cause.h"
-#ifdef NAS_MME
#include "nas_itti_messaging.h"
-#endif
-#ifdef NAS_UE
-#include // malloc, free
-#include // memset
-#endif
+
/****************************************************************************/
/**************** E X T E R N A L D E F I N I T I O N S ****************/
@@ -97,13 +92,9 @@ Description Defines functions executed at the ESM Service Access
** Others: None **
** **
***************************************************************************/
-#ifdef NAS_UE
-int esm_recv_status(int pti, int ebi, const esm_status_msg *msg)
-#endif
-#ifdef NAS_MME
+
int esm_recv_status(emm_data_context_t *ctx, int pti, int ebi,
const esm_status_msg *msg)
-#endif
{
int esm_cause;
int rc;
@@ -120,12 +111,7 @@ int esm_recv_status(emm_data_context_t *ctx, int pti, int ebi,
esm_cause = msg->esmcause;
/* Execute the ESM status procedure */
-#ifdef NAS_UE
- rc = esm_proc_status_ind(pti, ebi, &esm_cause);
-#endif
-#ifdef NAS_MME
rc = esm_proc_status_ind(ctx, pti, ebi, &esm_cause);
-#endif
if (rc != RETURNerror) {
esm_cause = ESM_CAUSE_SUCCESS;
@@ -135,582 +121,12 @@ int esm_recv_status(emm_data_context_t *ctx, int pti, int ebi,
LOG_FUNC_RETURN (esm_cause);
}
-/*
- * --------------------------------------------------------------------------
- * Functions executed by the UE upon receiving ESM message from the network
- * --------------------------------------------------------------------------
- */
-#ifdef NAS_UE
-/****************************************************************************
- ** **
- ** Name: esm_recv_pdn_connectivity_reject() **
- ** **
- ** Description: Processes PDN Connectivity Reject message **
- ** **
- ** Inputs: pti: Procedure transaction identity **
- ** ebi: EPS bearer identity **
- ** msg: The received ESM message **
- ** Others: None **
- ** **
- ** Outputs: None **
- ** Return: ESM cause code whenever the processing of **
- ** the ESM message fails **
- ** Others: None **
- ** **
- ***************************************************************************/
-int esm_recv_pdn_connectivity_reject(int pti, int ebi,
- const pdn_connectivity_reject_msg *msg)
-{
- LOG_FUNC_IN;
-
- int esm_cause;
-
- LOG_TRACE(INFO, "ESM-SAP - Received PDN Connectivity Reject message "
- "(pti=%d, ebi=%d, cause=%d)", pti, ebi, msg->esmcause);
-
- /*
- * Procedure transaction identity checking
- */
- if ( (pti == ESM_PT_UNASSIGNED) || esm_pt_is_reserved(pti) ) {
- /* 3GPP TS 24.301, section 7.3.1, case a
- * Reserved or unassigned PTI value
- */
- LOG_TRACE(WARNING, "ESM-SAP - Invalid PTI value (pti=%d)", pti);
- LOG_FUNC_RETURN (ESM_CAUSE_INVALID_PTI_VALUE);
- } else if ( esm_pt_is_not_in_use(pti) ) {
- /* 3GPP TS 24.301, section 7.3.1, case a
- * Assigned value that does not match any PTI in use
- */
- LOG_TRACE(WARNING, "ESM-SAP - PTI mismatch (pti=%d)", pti);
- LOG_FUNC_RETURN (ESM_CAUSE_PTI_MISMATCH);
- }
- /*
- * EPS bearer identity checking
- */
- else if ( (ebi != ESM_EBI_UNASSIGNED) || esm_ebr_is_reserved(ebi) ) {
- /* 3GPP TS 24.301, section 7.3.2, case a
- * Assigned or reserved EPS bearer identity value */
- LOG_TRACE(WARNING, "ESM-SAP - Invalid EPS bearer identity (ebi=%d)",
- ebi);
- LOG_FUNC_RETURN (ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY);
- }
-
- /*
- * Message processing
- */
- /* Get the ESM cause */
- esm_cause = msg->esmcause;
-
- /* Execute the PDN connectivity procedure not accepted by the network */
- int rc = esm_proc_pdn_connectivity_reject(pti, &esm_cause);
-
- if (rc != RETURNerror) {
- esm_cause = ESM_CAUSE_SUCCESS;
- }
-
- /* Return the ESM cause value */
- LOG_FUNC_RETURN (esm_cause);
-}
-
-/****************************************************************************
- ** **
- ** Name: esm_recv_pdn_disconnect_reject() **
- ** **
- ** Description: Processes PDN Disconnect Reject message **
- ** **
- ** Inputs: pti: Procedure transaction identity **
- ** ebi: EPS bearer identity **
- ** msg: The received ESM message **
- ** Others: None **
- ** **
- ** Outputs: None **
- ** Return: ESM cause code whenever the processing of **
- ** the ESM message fails **
- ** Others: None **
- ** **
- ***************************************************************************/
-int esm_recv_pdn_disconnect_reject(int pti, int ebi,
- const pdn_disconnect_reject_msg *msg)
-{
- LOG_FUNC_IN;
-
- int esm_cause;
-
- LOG_TRACE(INFO, "ESM-SAP - Received PDN Disconnect Reject message "
- "(pti=%d, ebi=%d, cause=%d)", pti, ebi, msg->esmcause);
-
- /*
- * Procedure transaction identity checking
- */
- if ( (pti == ESM_PT_UNASSIGNED) || esm_pt_is_reserved(pti) ) {
- /* 3GPP TS 24.301, section 7.3.1, case b
- * Reserved or unassigned PTI value
- */
- LOG_TRACE(WARNING, "ESM-SAP - Invalid PTI value (pti=%d)", pti);
- LOG_FUNC_RETURN (ESM_CAUSE_INVALID_PTI_VALUE);
- } else if ( esm_pt_is_not_in_use(pti) ) {
- /* 3GPP TS 24.301, section 7.3.1, case b
- * Assigned value that does not match any PTI in use
- */
- LOG_TRACE(WARNING, "ESM-SAP - PTI mismatch (pti=%d)", pti);
- LOG_FUNC_RETURN (ESM_CAUSE_PTI_MISMATCH);
- }
- /*
- * EPS bearer identity checking
- */
- else if ( (ebi != ESM_EBI_UNASSIGNED) || esm_ebr_is_reserved(ebi) ) {
- /* 3GPP TS 24.301, section 7.3.2, case b
- * Assigned or reserved EPS bearer identity value */
- LOG_TRACE(WARNING, "ESM-SAP - Invalid EPS bearer identity (ebi=%d)",
- ebi);
- LOG_FUNC_RETURN (ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY);
- }
-
- /*
- * Message processing
- */
- /* Get the ESM cause */
- esm_cause = msg->esmcause;
-
- /* Execute the PDN disconnect procedure not accepted by the network */
- int rc = esm_proc_pdn_disconnect_reject(pti, &esm_cause);
-
- if (rc != RETURNerror) {
- esm_cause = ESM_CAUSE_SUCCESS;
- }
-
- /* Return the ESM cause value */
- LOG_FUNC_RETURN (esm_cause);
-}
-
-/****************************************************************************
- ** **
- ** Name: esm_recv_activate_default_eps_bearer_context_request() **
- ** **
- ** Description: Processes Activate Default EPS Bearer Context Request **
- ** message **
- ** **
- ** Inputs: pti: Procedure transaction identity **
- ** ebi: EPS bearer identity **
- ** msg: The received ESM message **
- ** Others: None **
- ** **
- ** Outputs: None **
- ** Return: ESM cause code whenever the processing of **
- ** the ESM message fails **
- ** Others: None **
- ** **
- ***************************************************************************/
-int esm_recv_activate_default_eps_bearer_context_request(int pti, int ebi,
- const activate_default_eps_bearer_context_request_msg *msg)
-{
- LOG_FUNC_IN;
-
- int esm_cause = ESM_CAUSE_SUCCESS;
-
- LOG_TRACE(INFO, "ESM-SAP - Received Activate Default EPS Bearer Context "
- "Request message (pti=%d, ebi=%d)", pti, ebi);
-
- /*
- * Procedure transaction identity checking
- */
- if ( (pti == ESM_PT_UNASSIGNED) || esm_pt_is_reserved(pti) ) {
- /* 3GPP TS 24.301, section 7.3.1, case h
- * Reserved or unassigned PTI value
- */
- LOG_TRACE(WARNING, "ESM-SAP - Invalid PTI value (pti=%d)", pti);
- LOG_FUNC_RETURN (ESM_CAUSE_INVALID_PTI_VALUE);
- } else if ( esm_pt_is_not_in_use(pti) ) {
- /* 3GPP TS 24.301, section 7.3.1, case g
- * Assigned value that does not match any PTI in use
- */
- LOG_TRACE(WARNING, "ESM-SAP - PTI mismatch (pti=%d)", pti);
- LOG_FUNC_RETURN (ESM_CAUSE_PTI_MISMATCH);
- }
- /*
- * EPS bearer identity checking
- */
- else if ( (ebi == ESM_EBI_UNASSIGNED) || esm_ebr_is_reserved(ebi) ) {
- /* 3GPP TS 24.301, section 7.3.2, case g
- * Reserved or unassigned EPS bearer identity value
- */
- LOG_TRACE(WARNING, "ESM-SAP - Invalid EPS bearer identity (ebi=%d)",
- ebi);
- LOG_FUNC_RETURN (ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY);
- }
-
- /*
- * Message processing
- */
- esm_proc_qos_t qos = {-1, -1, -1, -1, -1};
-
- /* Get the maximum bit rate for uplink and downlink */
- if (msg->epsqos.bitRatesExtPresent) {
- qos.mbrUL =
- eps_qos_bit_rate_ext_value(msg->epsqos.bitRatesExt.maxBitRateForUL);
- qos.mbrDL =
- eps_qos_bit_rate_ext_value(msg->epsqos.bitRatesExt.maxBitRateForDL);
- } else if (msg->epsqos.bitRatesPresent) {
- qos.mbrUL =
- eps_qos_bit_rate_value(msg->epsqos.bitRates.maxBitRateForUL);
- qos.mbrDL =
- eps_qos_bit_rate_value(msg->epsqos.bitRates.maxBitRateForDL);
- }
-
- /* Get the guaranteed bit rate for uplink and downlink */
- if (msg->epsqos.bitRatesExtPresent) {
- qos.gbrUL =
- eps_qos_bit_rate_ext_value(msg->epsqos.bitRatesExt.guarBitRateForUL);
- qos.gbrDL =
- eps_qos_bit_rate_ext_value(msg->epsqos.bitRatesExt.guarBitRateForDL);
- } else if (msg->epsqos.bitRatesPresent) {
- qos.gbrUL =
- eps_qos_bit_rate_value(msg->epsqos.bitRates.guarBitRateForUL);
- qos.gbrDL =
- eps_qos_bit_rate_value(msg->epsqos.bitRates.guarBitRateForDL);
- }
-
- /* Get the QoS Class Identifier */
- qos.qci = msg->epsqos.qci;
- /* Get the value of the PDN type indicator */
- int pdn_type = -1;
-
- if (msg->pdnaddress.pdntypevalue == PDN_VALUE_TYPE_IPV4) {
- pdn_type = ESM_PDN_TYPE_IPV4;
- } else if (msg->pdnaddress.pdntypevalue == PDN_VALUE_TYPE_IPV6) {
- pdn_type = ESM_PDN_TYPE_IPV6;
- } else if (msg->pdnaddress.pdntypevalue == PDN_VALUE_TYPE_IPV4V6) {
- pdn_type = ESM_PDN_TYPE_IPV4V6;
- }
-
- /* Get the ESM cause */
- if (msg->presencemask &
- ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_ESM_CAUSE_PRESENT) {
- /* The network allocated a PDN address of a PDN type which is different
- * from the requested PDN type */
- esm_cause = msg->esmcause;
- }
-
- /* Execute the PDN connectivity procedure accepted by the network */
- int pid = esm_proc_pdn_connectivity_accept(pti, pdn_type,
- &msg->pdnaddress.pdnaddressinformation,
- &msg->accesspointname.accesspointnamevalue,
- &esm_cause);
-
- if (pid != RETURNerror) {
- /* Create local default EPS bearer context */
- int rc = esm_proc_default_eps_bearer_context_request(pid, ebi, &qos,
- &esm_cause);
-
- if (rc != RETURNerror) {
- esm_cause = ESM_CAUSE_SUCCESS;
- }
- }
-
- /* Return the ESM cause value */
- LOG_FUNC_RETURN (esm_cause);
-}
-
-/****************************************************************************
- ** **
- ** Name: esm_recv_activate_dedicated_eps_bearer_context_request() **
- ** **
- ** Description: Processes Activate Dedicated EPS Bearer Context Request **
- ** message **
- ** **
- ** Inputs: pti: Procedure transaction identity **
- ** ebi: EPS bearer identity **
- ** msg: The received ESM message **
- ** Others: None **
- ** **
- ** Outputs: None **
- ** Return: ESM cause code whenever the processing of **
- ** the ESM message fails **
- ** Others: None **
- ** **
- ***************************************************************************/
-int esm_recv_activate_dedicated_eps_bearer_context_request(int pti, int ebi,
- const activate_dedicated_eps_bearer_context_request_msg *msg)
-{
- LOG_FUNC_IN;
-
- int esm_cause = ESM_CAUSE_SUCCESS;
- int i;
- int j;
-
- LOG_TRACE(INFO, "ESM-SAP - Received Activate Dedicated EPS Bearer "
- "Context Request message (pti=%d, ebi=%d)", pti, ebi);
-
- /*
- * Procedure transaction identity checking
- */
- if ( esm_pt_is_reserved(pti) ) {
- /* 3GPP TS 24.301, section 7.3.1, case j
- * Reserved PTI value
- */
- LOG_TRACE(WARNING, "ESM-SAP - Invalid PTI value (pti=%d)", pti);
- LOG_FUNC_RETURN (ESM_CAUSE_INVALID_PTI_VALUE);
- } else if ( (pti != ESM_PT_UNASSIGNED) && esm_pt_is_not_in_use(pti) ) {
- /* 3GPP TS 24.301, section 7.3.1, case i
- * Assigned value that does not match any PTI in use
- */
- LOG_TRACE(WARNING, "ESM-SAP - PTI mismatch (pti=%d)", pti);
- LOG_FUNC_RETURN (ESM_CAUSE_PTI_MISMATCH);
- }
- /*
- * EPS bearer identity checking
- */
- else if ( (ebi == ESM_EBI_UNASSIGNED) || esm_ebr_is_reserved(ebi) ) {
- /* 3GPP TS 24.301, section 7.3.2, case h
- * Reserved or unassigned EPS bearer identity value
- */
- LOG_TRACE(WARNING, "ESM-SAP - Invalid EPS bearer identity (ebi=%d)",
- ebi);
- LOG_FUNC_RETURN (ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY);
- }
- /*
- * TFT checking
- */
- else if (msg->tft.tftoperationcode != TRAFFIC_FLOW_TEMPLATE_OPCODE_CREATE) {
- /* 3GPP TS 24.301, section 6.4.2.4, case a1
- * Semantic errors in TFT operations
- */
- LOG_FUNC_RETURN (ESM_CAUSE_SEMANTIC_ERROR_IN_THE_TFT_OPERATION);
- } else if (msg->tft.numberofpacketfilters == 0) {
- /* 3GPP TS 24.301, section 6.4.2.4, case b1
- * Syntactical errors in TFT operations
- */
- LOG_FUNC_RETURN (ESM_CAUSE_SYNTACTICAL_ERROR_IN_THE_TFT_OPERATION);
- }
-
- /*
- * Message processing
- */
- /* Processing of the EPS bearer level QoS parameters */
- esm_proc_qos_t qos = {-1, -1, -1, -1, -1};
-
- /* Get the maximum bit rate for uplink and downlink */
- if (msg->epsqos.bitRatesExtPresent) {
- qos.mbrUL =
- eps_qos_bit_rate_ext_value(msg->epsqos.bitRatesExt.maxBitRateForUL);
- qos.mbrDL =
- eps_qos_bit_rate_ext_value(msg->epsqos.bitRatesExt.maxBitRateForDL);
- } else if (msg->epsqos.bitRatesPresent) {
- qos.mbrUL =
- eps_qos_bit_rate_value(msg->epsqos.bitRates.maxBitRateForUL);
- qos.mbrDL =
- eps_qos_bit_rate_value(msg->epsqos.bitRates.maxBitRateForDL);
- }
-
- /* Get the guaranteed bit rate for uplink and downlink */
- if (msg->epsqos.bitRatesExtPresent) {
- qos.gbrUL =
- eps_qos_bit_rate_ext_value(msg->epsqos.bitRatesExt.guarBitRateForUL);
- qos.gbrDL =
- eps_qos_bit_rate_ext_value(msg->epsqos.bitRatesExt.guarBitRateForDL);
- } else if (msg->epsqos.bitRatesPresent) {
- qos.gbrUL =
- eps_qos_bit_rate_value(msg->epsqos.bitRates.guarBitRateForUL);
- qos.gbrDL =
- eps_qos_bit_rate_value(msg->epsqos.bitRates.guarBitRateForDL);
- }
-
- /* Get the QoS Class Identifier */
- qos.qci = msg->epsqos.qci;
-
- /* Processing of the traffic flow template parameters */
- esm_proc_tft_t tft = {0, {NULL}};
- /* Get the list of packet filters */
- const PacketFilters *pkfs = &(msg->tft.packetfilterlist.createtft);
-
- for (i = 0; i < msg->tft.numberofpacketfilters; i++) {
- /* Create new temporary packet filter */
- tft.pkf[i] = (network_pkf_t *)malloc(sizeof(network_pkf_t));
-
- if (tft.pkf[i] != NULL) {
- /* Initialize the temporary packet filter */
- memset(tft.pkf[i], 0, sizeof(network_pkf_t));
- /* Increment the number of packet filters contained in the TFT */
- tft.n_pkfs += 1;
- /* Packet filter identifier */
- tft.pkf[i]->id = pkfs[i]->identifier;
- /* Packet filter direction */
- tft.pkf[i]->dir = pkfs[i]->direction;
- /* Evaluation precedence */
- tft.pkf[i]->precedence = pkfs[i]->eval_precedence;
-
- /* Get the packet filter components */
- const PacketFilter *pkf = &(pkfs[i]->packetfilter);
-
- if (pkf->flags & TRAFFIC_FLOW_TEMPLATE_IPV4_REMOTE_ADDR_FLAG) {
- /* IPv4 remote address component */
- for (j = 0;
- (j < TRAFFIC_FLOW_TEMPLATE_IPV4_ADDR_SIZE)
- && (j < NET_PACKET_FILTER_IPV4_ADDR_SIZE); j++) {
- tft.pkf[i]->data.ipv4.addr[j] = pkf->ipv4remoteaddr[j].addr;
- tft.pkf[i]->data.ipv4.mask[j] = pkf->ipv4remoteaddr[j].mask;
- }
- } else if (pkf->flags & TRAFFIC_FLOW_TEMPLATE_IPV6_REMOTE_ADDR_FLAG) {
- /* IPv6 remote address component */
- for (j = 0;
- (j < TRAFFIC_FLOW_TEMPLATE_IPV6_ADDR_SIZE)
- && (j < NET_PACKET_FILTER_IPV6_ADDR_SIZE); j++) {
- tft.pkf[i]->data.ipv6.addr[j] = pkf->ipv6remoteaddr[j].addr;
- tft.pkf[i]->data.ipv6.mask[j] = pkf->ipv6remoteaddr[j].mask;
- }
- }
-
- if (pkf->flags & TRAFFIC_FLOW_TEMPLATE_PROTOCOL_NEXT_HEADER_FLAG) {
- /* Protocol identifier/Next header component */
- tft.pkf[i]->data.ipv4.protocol =
- pkf->protocolidentifier_nextheader;
- }
-
- if (pkf->flags & TRAFFIC_FLOW_TEMPLATE_SINGLE_LOCAL_PORT_FLAG) {
- /* Single local port component */
- tft.pkf[i]->lport = pkf->singlelocalport;
- } else if (pkf->flags & TRAFFIC_FLOW_TEMPLATE_LOCAL_PORT_RANGE_FLAG) {
- /* Local port range component */
- /* TODO: Add port range type to network_pkf_t in networkDef.h */
- tft.pkf[i]->lport = pkf->localportrange.lowlimit;
- }
-
- if (pkf->flags & TRAFFIC_FLOW_TEMPLATE_SINGLE_REMOTE_PORT_FLAG) {
- /* Single remote port component */
- tft.pkf[i]->rport = pkf->singleremoteport;
- } else if (pkf->flags & TRAFFIC_FLOW_TEMPLATE_REMOTE_PORT_RANGE_FLAG) {
- /* Remote port range component */
- /* TODO: Add port range type to network_pkf_t in networkDef.h */
- tft.pkf[i]->rport = pkf->remoteportrange.lowlimit;
- }
-
- if (pkf->flags & TRAFFIC_FLOW_TEMPLATE_SECURITY_PARAMETER_INDEX) {
- /* Security parameter index component */
- tft.pkf[i]->data.ipv6.ipsec = pkf->securityparameterindex;
- }
-
- if (pkf->flags & TRAFFIC_FLOW_TEMPLATE_TYPE_OF_SERVICE_TRAFFIC_CLASS) {
- /* Type of service/Traffic class component */
- tft.pkf[i]->data.ipv4.tos =
- pkf->typdeofservice_trafficclass.value;
- }
-
- if (pkf->flags & TRAFFIC_FLOW_TEMPLATE_FLOW_LABEL) {
- /* Flow label component */
- tft.pkf[i]->data.ipv6.fl = pkf->flowlabel;
- }
- }
- }
-
- /* Execute the dedicated EPS bearer context activation procedure */
- int rc = esm_proc_dedicated_eps_bearer_context_request(ebi,
- msg->linkedepsbeareridentity,
- &qos, &tft, &esm_cause);
-
- if (rc != RETURNerror) {
- esm_cause = ESM_CAUSE_SUCCESS;
- }
-
- /* Release temporary traffic flow template data */
- for (i = 0; i < tft.n_pkfs; i++) {
- free(tft.pkf[i]);
- }
-
- /* Return the ESM cause value */
- LOG_FUNC_RETURN (esm_cause);
-}
-
-/****************************************************************************
- ** **
- ** Name: esm_recv_deactivate_eps_bearer_context_request() **
- ** **
- ** Description: Processes Deactivate EPS Bearer Context Request message **
- ** **
- ** Inputs: pti: Procedure transaction identity **
- ** ebi: EPS bearer identity **
- ** msg: The received ESM message **
- ** Others: None **
- ** **
- ** Outputs: None **
- ** Return: ESM cause code whenever the processing of **
- ** the ESM message fails **
- ** Others: None **
- ** **
- ***************************************************************************/
-int esm_recv_deactivate_eps_bearer_context_request(int pti, int ebi,
- const deactivate_eps_bearer_context_request_msg *msg)
-{
- LOG_FUNC_IN;
-
- int rc = RETURNok;
- int esm_cause;
-
- LOG_TRACE(INFO, "ESM-SAP - Received Deactivate EPS Bearer Context "
- "Request message (pti=%d, ebi=%d)", pti, ebi);
-
- /*
- * Procedure transaction identity checking
- */
- if ( esm_pt_is_reserved(pti) ) {
- /* 3GPP TS 24.301, section 7.3.1, case m
- * Reserved PTI value
- */
- LOG_TRACE(WARNING, "ESM-SAP - Invalid PTI value (pti=%d)", pti);
- LOG_FUNC_RETURN (ESM_CAUSE_INVALID_PTI_VALUE);
- } else if ( esm_pt_is_not_in_use(pti) ) {
- /* 3GPP TS 24.301, section 7.3.1, case m
- * Assigned value does not match any PTI in use
- */
- LOG_TRACE(WARNING, "ESM-SAP - PTI mismatch (pti=%d)", pti);
- LOG_FUNC_RETURN (ESM_CAUSE_PTI_MISMATCH);
- }
- /*
- * EPS bearer identity checking
- */
- else if ( (ebi == ESM_EBI_UNASSIGNED) || esm_ebr_is_reserved(ebi) ||
- esm_ebr_is_not_in_use(ebi) ) {
- /* 3GPP TS 24.301, section 7.3.2, case j
- * Reserved or unassigned EPS bearer identity value or,
- * assigned value that does not match an existing EPS bearer context
- */
- LOG_TRACE(WARNING, "ESM-SAP - Invalid EPS bearer identity (ebi=%d)",
- ebi);
- /* Respond with a DEACTIVATE EPS BEARER CONTEXT ACCEPT message with
- * the EPS bearer identity set to the received EPS bearer identity */
- LOG_FUNC_RETURN (ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY);
- }
-
- /*
- * Message processing
- */
- /* Get the ESM cause */
- esm_cause = msg->esmcause;
-
- /* Execute the PDN disconnect procedure accepted by the network */
- if (pti != ESM_PT_UNASSIGNED) {
- rc = esm_proc_pdn_disconnect_accept(pti, &esm_cause);
- }
-
- if (rc != RETURNerror) {
- /* Execute the EPS bearer context deactivation procedure */
- rc = esm_proc_eps_bearer_context_deactivate_request(ebi, &esm_cause);
-
- if (rc != RETURNerror) {
- esm_cause = ESM_CAUSE_SUCCESS;
- }
- }
-
- /* Return the ESM cause value */
- LOG_FUNC_RETURN (esm_cause);
-}
-#endif // NAS_UE
/*
* --------------------------------------------------------------------------
* Functions executed by the MME upon receiving ESM message from the UE
* --------------------------------------------------------------------------
*/
-#ifdef NAS_MME
/****************************************************************************
** **
** Name: esm_recv_pdn_connectivity_request() **
@@ -735,6 +151,7 @@ int esm_recv_pdn_connectivity_request(emm_data_context_t *ctx, int pti, int ebi,
unsigned int *new_ebi, void *data)
{
int esm_cause = ESM_CAUSE_SUCCESS;
+ uint8_t i;
LOG_FUNC_IN;
@@ -823,6 +240,13 @@ int esm_recv_pdn_connectivity_request(emm_data_context_t *ctx, int pti, int ebi,
*/
//TODO: rc = esm_proc_information_request();
}
+ esm_data->pco = msg->protocolconfigurationoptions;
+ for (i = 0; i < msg->protocolconfigurationoptions.num_protocol_id_or_container_id; i++) {
+ DUP_OCTET_STRING(msg->protocolconfigurationoptions.protocolidcontents[i], esm_data->pco.protocolidcontents[i]);
+ esm_data->pco.protocolid[i] = msg->protocolconfigurationoptions.protocolid[i];
+ esm_data->pco.lengthofprotocolid[i] = msg->protocolconfigurationoptions.lengthofprotocolid[i];
+ }
+
#if defined(ORIGINAL_CODE)
/* Execute the PDN connectivity procedure requested by the UE */
@@ -1284,8 +708,6 @@ int esm_recv_deactivate_eps_bearer_context_accept(emm_data_context_t *ctx,
LOG_FUNC_RETURN (esm_cause);
}
-#endif // NAS_MME
-
/****************************************************************************/
/********************* L O C A L F U N C T I O N S *********************/
/****************************************************************************/
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/sap/esm_recv.h b/openair-cn/NAS/MME/ESM/SAP/esm_recv.h
similarity index 76%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/sap/esm_recv.h
rename to openair-cn/NAS/MME/ESM/SAP/esm_recv.h
index f7da2b773b..6883d61885 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/esm/sap/esm_recv.h
+++ b/openair-cn/NAS/MME/ESM/SAP/esm_recv.h
@@ -50,21 +50,7 @@ Description Defines functions executed at the ESM Service Access
#include "EsmStatus.h"
#include "emmData.h"
-#ifdef NAS_UE
-#include "PdnConnectivityReject.h"
-#include "PdnDisconnectReject.h"
-#include "BearerResourceAllocationReject.h"
-#include "BearerResourceModificationReject.h"
-#include "ActivateDefaultEpsBearerContextRequest.h"
-#include "ActivateDedicatedEpsBearerContextRequest.h"
-#include "ModifyEpsBearerContextRequest.h"
-#include "DeactivateEpsBearerContextRequest.h"
-
-#include "EsmInformationRequest.h"
-#endif
-
-#ifdef NAS_MME
#include "PdnConnectivityRequest.h"
#include "PdnDisconnectRequest.h"
#include "BearerResourceAllocationRequest.h"
@@ -79,7 +65,6 @@ Description Defines functions executed at the ESM Service Access
#include "DeactivateEpsBearerContextAccept.h"
#include "EsmInformationResponse.h"
-#endif
/****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/
@@ -102,50 +87,15 @@ Description Defines functions executed at the ESM Service Access
* Functions executed by both the UE and the MME upon receiving ESM messages
* --------------------------------------------------------------------------
*/
-#ifdef NAS_UE
-int esm_recv_status(int pti, int ebi, const esm_status_msg *msg);
-#endif
-#ifdef NAS_MME
+
int esm_recv_status(emm_data_context_t *ctx, int pti, int ebi,
const esm_status_msg *msg);
-#endif
-
-/*
- * --------------------------------------------------------------------------
- * Functions executed by the UE upon receiving ESM message from the network
- * --------------------------------------------------------------------------
- */
-#ifdef NAS_UE
-/*
- * Transaction related messages
- * ----------------------------
- */
-int esm_recv_pdn_connectivity_reject(int pti, int ebi,
- const pdn_connectivity_reject_msg *msg);
-
-int esm_recv_pdn_disconnect_reject(int pti, int ebi,
- const pdn_disconnect_reject_msg *msg);
-
-/*
- * Messages related to EPS bearer contexts
- * ---------------------------------------
- */
-int esm_recv_activate_default_eps_bearer_context_request(int pti, int ebi,
- const activate_default_eps_bearer_context_request_msg *msg);
-
-int esm_recv_activate_dedicated_eps_bearer_context_request(int pti, int ebi,
- const activate_dedicated_eps_bearer_context_request_msg *msg);
-
-int esm_recv_deactivate_eps_bearer_context_request(int pti, int ebi,
- const deactivate_eps_bearer_context_request_msg *msg);
-#endif
/*
* --------------------------------------------------------------------------
* Functions executed by the MME upon receiving ESM message from the UE
* --------------------------------------------------------------------------
*/
-#ifdef NAS_MME
/*
* Transaction related messages
* ----------------------------
@@ -175,6 +125,5 @@ int esm_recv_activate_dedicated_eps_bearer_context_reject(emm_data_context_t *ct
int esm_recv_deactivate_eps_bearer_context_accept(emm_data_context_t *ctx, int pti,
int ebi, const deactivate_eps_bearer_context_accept_msg *msg);
-#endif
#endif /* __ESM_RECV_H__*/
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/sap/esm_sap.c b/openair-cn/NAS/MME/ESM/SAP/esm_sap.c
similarity index 70%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/sap/esm_sap.c
rename to openair-cn/NAS/MME/ESM/SAP/esm_sap.c
index 5220aba605..9c2d07c2c5 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/esm/sap/esm_sap.c
+++ b/openair-cn/NAS/MME/ESM/SAP/esm_sap.c
@@ -70,19 +70,11 @@ Description Defines the ESM Service Access Points at which the EPS
/******************* L O C A L D E F I N I T I O N S *******************/
/****************************************************************************/
-#ifdef NAS_UE
-static int _esm_sap_recv(int msg_type, int is_standalone,
- const OctetString *req, OctetString *rsp, esm_sap_error_t *err);
-static int _esm_sap_send(int msg_type, int is_standalone, int pti, int ebi,
- const esm_sap_data_t *data, OctetString *rsp);
-#endif
-#ifdef NAS_MME
static int _esm_sap_recv(int msg_type, int is_standalone, emm_data_context_t *ctx,
const OctetString *req, OctetString *rsp, esm_sap_error_t *err);
static int _esm_sap_send(int msg_type, int is_standalone, emm_data_context_t *ctx,
int pti, int ebi, const esm_sap_data_t *data, OctetString *rsp);
-#endif
/*
* String representation of ESM-SAP primitives
@@ -175,102 +167,22 @@ int esm_sap_send(esm_sap_t *msg)
switch (primitive) {
case ESM_PDN_CONNECTIVITY_REQ:
-#ifdef NAS_UE
- {
- esm_pdn_connectivity_t *pdn_connect = &msg->data.pdn_connect;
- if ( !msg->is_standalone || !pdn_connect->is_defined ) {
- OctetString apn = {0, NULL};
-
- if (pdn_connect->apn) {
- apn.length = strlen(pdn_connect->apn);
- apn.value = (uint8_t *)pdn_connect->apn;
- }
-
- /* Define new PDN context */
- rc = esm_proc_pdn_connectivity(pdn_connect->cid, TRUE,
- pdn_connect->pdn_type, &apn,
- pdn_connect->is_emergency, NULL);
-
- if ( msg->is_standalone || (rc != RETURNok) ) {
- break;
- }
- }
-
- if (pdn_connect->is_defined) {
- unsigned int pti;
- /* Assign new procedure transaction identity */
- rc = esm_proc_pdn_connectivity(pdn_connect->cid, TRUE,
- pdn_connect->pdn_type, NULL,
- pdn_connect->is_emergency, &pti);
-
- if (rc != RETURNerror) {
- /* Send PDN connectivity request */
- rc = _esm_sap_send(PDN_CONNECTIVITY_REQUEST,
- msg->is_standalone,
- pti, EPS_BEARER_IDENTITY_UNASSIGNED,
- &msg->data, &msg->send);
- }
- }
- }
-
-#endif
-#ifdef NAS_MME
/* The MME received a PDN connectivity request message */
rc = _esm_sap_recv(PDN_CONNECTIVITY_REQUEST, msg->is_standalone,
msg->ctx, msg->recv, &msg->send, &msg->err);
-#endif
break;
case ESM_PDN_CONNECTIVITY_REJ:
-#ifdef NAS_MME
/* PDN connectivity locally failed */
pid = esm_proc_default_eps_bearer_context_failure(msg->ctx);
if (pid != RETURNerror) {
rc = esm_proc_pdn_connectivity_failure(msg->ctx, pid);
}
-
-#endif
-#ifdef NAS_UE
- {
- esm_pdn_connectivity_t *pdn_connect = &msg->data.pdn_connect;
-
- if ( msg->is_standalone && pdn_connect->is_defined ) {
- /* Undefine the specified PDN context */
- rc = esm_proc_pdn_connectivity(pdn_connect->cid, FALSE,
- pdn_connect->pdn_type, NULL,
- pdn_connect->is_emergency, NULL);
- } else if (msg->recv != NULL) {
- /* The UE received a PDN connectivity reject message */
- rc = _esm_sap_recv(PDN_CONNECTIVITY_REJECT, msg->is_standalone,
- msg->recv, &msg->send, &msg->err);
- } else {
- /* The PDN connectivity procedure locally failed */
- rc = esm_proc_pdn_connectivity_failure(TRUE);
- }
- }
-#endif
break;
case ESM_PDN_DISCONNECT_REQ:
-#ifdef NAS_UE
- {
- unsigned int pti, ebi;
- /* Get the procedure transaction identity and the EPS bearer
- * identity of the default bearer assigned to the PDN to
- * disconnect from */
- rc = esm_proc_pdn_disconnect(msg->data.pdn_disconnect.cid,
- &pti, &ebi);
-
- if (rc != RETURNerror) {
- /* Send PDN disconnect request */
- rc = _esm_sap_send(PDN_DISCONNECT_REQUEST, TRUE, pti, ebi,
- &msg->data, &msg->send);
- }
- }
-
-#endif
break;
case ESM_PDN_DISCONNECT_REJ:
@@ -289,53 +201,20 @@ int esm_sap_send(esm_sap_t *msg)
break;
case ESM_DEFAULT_EPS_BEARER_CONTEXT_ACTIVATE_REQ:
-#ifdef NAS_UE
- /* The UE received activate default ESP bearer context request */
- rc = _esm_sap_recv(ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST,
- msg->is_standalone,
- msg->recv, &msg->send, &msg->err);
-#endif
break;
case ESM_DEFAULT_EPS_BEARER_CONTEXT_ACTIVATE_CNF:
-#ifdef NAS_MME
/* The MME received activate default ESP bearer context accept */
rc = _esm_sap_recv(ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT,
msg->is_standalone, msg->ctx,
msg->recv, &msg->send, &msg->err);
-#endif
-#ifdef NAS_UE
- /*
- * The activate default ESP bearer context accept message
- * has been successfully delivered to the other side
- */
- rc = esm_proc_default_eps_bearer_context_complete();
-
- if (rc != RETURNerror) {
- rc = esm_proc_pdn_connectivity_complete();
- }
-
-#endif
break;
case ESM_DEFAULT_EPS_BEARER_CONTEXT_ACTIVATE_REJ:
-#ifdef NAS_MME
/* The MME received activate default ESP bearer context reject */
rc = _esm_sap_recv(ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT,
msg->is_standalone, msg->ctx,
msg->recv, &msg->send, &msg->err);
-#endif
-#ifdef NAS_UE
- /*
- * Default ESP bearer context activation procedure locally failed
- */
- rc = esm_proc_default_eps_bearer_context_failure();
-
- if (rc != RETURNerror) {
- rc = esm_proc_pdn_connectivity_failure(FALSE);
- }
-
-#endif
break;
case ESM_DEDICATED_EPS_BEARER_CONTEXT_ACTIVATE_REQ:
@@ -361,15 +240,9 @@ int esm_sap_send(esm_sap_t *msg)
/*
* Locally deactivate EPS bearer context
*/
-#ifdef NAS_UE
- rc = esm_proc_eps_bearer_context_deactivate(TRUE,
- msg->data.eps_bearer_context_deactivate.ebi, &pid, &bid);
-#endif
-#ifdef NAS_MME
rc = esm_proc_eps_bearer_context_deactivate(msg->ctx, TRUE,
msg->data.eps_bearer_context_deactivate.ebi,
&pid, &bid, NULL);
-#endif
}
break;
@@ -377,28 +250,20 @@ int esm_sap_send(esm_sap_t *msg)
break;
case ESM_UNITDATA_IND:
-#ifdef NAS_UE
- rc = _esm_sap_recv(-1, msg->is_standalone, msg->recv,
- &msg->send, &msg->err);
-#endif
-#ifdef NAS_MME
rc = _esm_sap_recv(-1, msg->is_standalone, msg->ctx,
msg->recv, &msg->send, &msg->err);
-#endif
break;
default:
break;
}
-#ifdef NAS_MME
if (rc != RETURNok) {
LOG_TRACE(ERROR, "ESM-SAP - Failed to process primitive %s (%d)",
_esm_sap_primitive_str[primitive - ESM_START - 1], primitive);
}
-#endif
LOG_FUNC_RETURN (rc);
}
@@ -438,9 +303,7 @@ int esm_sap_send(esm_sap_t *msg)
** **
***************************************************************************/
static int _esm_sap_recv(int msg_type, int is_standalone,
-#ifdef NAS_MME
emm_data_context_t *ctx,
-#endif
const OctetString *req, OctetString *rsp,
esm_sap_error_t *err)
{
@@ -511,188 +374,7 @@ static int _esm_sap_recv(int msg_type, int is_standalone,
}
/* Process the received ESM message */
else switch (esm_msg.header.message_type) {
-#ifdef NAS_UE
- case ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST:
- /*
- * Process activate default EPS bearer context request message
- * received from the MME
- */
- esm_cause = esm_recv_activate_default_eps_bearer_context_request(
- pti, ebi,
- &esm_msg.activate_default_eps_bearer_context_request);
-
- if ( (esm_cause == ESM_CAUSE_SUCCESS) ||
- (esm_cause == ESM_CAUSE_PTI_ALREADY_IN_USE) ) {
- /* Return accept message */
- rc = esm_send_activate_default_eps_bearer_context_accept(ebi,
- &esm_msg.activate_default_eps_bearer_context_accept);
- /* Setup the callback function used to send activate default
- * EPS bearer context accept message onto the network */
- esm_procedure = esm_proc_default_eps_bearer_context_accept;
-
- if (esm_cause == ESM_CAUSE_PTI_ALREADY_IN_USE) {
- /* 3GPP TS 24.301, section 7.3.1, case g
- * Return accept message, even to network retransmission
- * of already accepted activate default EPS bearer context
- * request message
- */
- is_discarded = TRUE;
- }
- } else {
- /* Return reject message */
- rc = esm_send_activate_default_eps_bearer_context_reject(ebi,
- &esm_msg.activate_default_eps_bearer_context_reject,
- esm_cause);
- /* Setup the callback function used to send activate default
- * EPS bearer context reject message onto the network */
- esm_procedure = esm_proc_default_eps_bearer_context_reject;
- }
-
- break;
-
- case ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST:
- /*
- * Process activate dedicated EPS bearer context request message
- * received from the MME
- */
- esm_cause = esm_recv_activate_dedicated_eps_bearer_context_request(
- pti, ebi,
- &esm_msg.activate_dedicated_eps_bearer_context_request);
-
- if ( (esm_cause == ESM_CAUSE_SUCCESS) ||
- (esm_cause == ESM_CAUSE_PTI_ALREADY_IN_USE) ) {
- /* Return accept message */
- rc = esm_send_activate_dedicated_eps_bearer_context_accept(ebi,
- &esm_msg.activate_dedicated_eps_bearer_context_accept);
- /* Setup the callback function used to send activate dedicated
- * EPS bearer context accept message onto the network */
- esm_procedure = esm_proc_dedicated_eps_bearer_context_accept;
-
- if (esm_cause == ESM_CAUSE_PTI_ALREADY_IN_USE) {
- /* 3GPP TS 24.301, section 7.3.1, case i
- * Return accept message, even to network retransmission
- * of already accepted activate dedicated EPS bearer context
- * request message
- */
- is_discarded = TRUE;
- }
- } else {
- /* Return reject message */
- rc = esm_send_activate_dedicated_eps_bearer_context_reject(ebi,
- &esm_msg.activate_dedicated_eps_bearer_context_reject,
- esm_cause);
- /* Setup the callback function used to send activate dedicated
- * EPS bearer context reject message onto the network */
- esm_procedure = esm_proc_dedicated_eps_bearer_context_reject;
- }
-
- break;
-
- case MODIFY_EPS_BEARER_CONTEXT_REQUEST:
- break;
-
- case DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST:
- /*
- * Process deactivate EPS bearer context request message
- * received from the MME
- */
- esm_cause = esm_recv_deactivate_eps_bearer_context_request(pti, ebi,
- &esm_msg.deactivate_eps_bearer_context_request);
-
- if ( (esm_cause == ESM_CAUSE_INVALID_PTI_VALUE) ||
- (esm_cause == ESM_CAUSE_PTI_MISMATCH) ) {
- /* 3GPP TS 24.301, section 7.3.1, case m
- * Ignore deactivate EPS bearer context request message
- * received with PTI reserved value, or assigned value
- * that does not match any PTI in use
- */
- is_discarded = TRUE;
- } else if ( (esm_cause == ESM_CAUSE_SUCCESS) ||
- (esm_cause == ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY) ) {
- /* Return accept message */
- rc = esm_send_deactivate_eps_bearer_context_accept(ebi,
- &esm_msg.deactivate_eps_bearer_context_accept);
- /* Setup the callback function used to send deactivate
- * EPS bearer context accept message onto the network */
- esm_procedure = esm_proc_eps_bearer_context_deactivate_accept;
-
- if (esm_cause == ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY) {
- /* 3GPP TS 24.301, section 7.3.2, case j
- * Respond with a deactivate EPS bearer context accept
- * message with the EPS bearer identity set to the received
- * EPS bearer identity
- */
- is_discarded = TRUE;
- }
- }
-
- break;
-
- case PDN_CONNECTIVITY_REJECT:
- /*
- * Process PDN connectivity reject message received from the MME
- */
- esm_cause = esm_recv_pdn_connectivity_reject(pti, ebi,
- &esm_msg.pdn_connectivity_reject);
-
- if ( (esm_cause == ESM_CAUSE_INVALID_PTI_VALUE) ||
- (esm_cause == ESM_CAUSE_PTI_MISMATCH) ||
- (esm_cause == ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY) ) {
- /* 3GPP TS 24.301, section 7.3.1, case a
- * Ignore PDN connectivity reject message received with
- * reserved or unassigned PTI value, or assigned value that
- * does not match any PTI in use
- * 3GPP TS 24.301, section 7.3.2, case a
- * Ignore PDN connectivity reject message received with
- * reserved or unassigned EPS bearer identity value
- */
- is_discarded = TRUE;
- }
-
- break;
-
- case PDN_DISCONNECT_REJECT:
- /*
- * Process PDN disconnect reject message received from the MME
- */
- esm_cause = esm_recv_pdn_disconnect_reject(pti, ebi,
- &esm_msg.pdn_disconnect_reject);
-
- if ( (esm_cause == ESM_CAUSE_INVALID_PTI_VALUE) ||
- (esm_cause == ESM_CAUSE_PTI_MISMATCH) ||
- (esm_cause == ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY) ) {
- /* 3GPP TS 24.301, section 7.3.1, case b
- * Ignore PDN disconnect reject message received with
- * reserved or unassigned PTI value, or assigned value that
- * does not match any PTI in use
- * 3GPP TS 24.301, section 7.3.2, case b
- * Ignore PDN disconnect reject message received with
- * reserved or unassigned EPS bearer identity value
- */
- is_discarded = TRUE;
- }
-
- break;
-
- case BEARER_RESOURCE_ALLOCATION_REJECT:
- break;
-
- case BEARER_RESOURCE_MODIFICATION_REJECT:
- break;
-
- case ESM_INFORMATION_REQUEST:
- break;
-
- case ESM_STATUS:
- /*
- * Process received ESM status message
- */
- esm_cause = esm_recv_status(pti, ebi, &esm_msg.esm_status);
- break;
-#endif
-
-#ifdef NAS_MME
case ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT:
/*
@@ -962,7 +644,6 @@ static int _esm_sap_recv(int msg_type, int is_standalone,
*/
esm_cause = esm_recv_status(ctx, pti, ebi, &esm_msg.esm_status);
break;
-#endif
default:
LOG_TRACE(WARNING, "ESM-SAP - Received unexpected ESM message "
@@ -1003,12 +684,7 @@ static int _esm_sap_recv(int msg_type, int is_standalone,
}
/* Complete the relevant ESM procedure */
-#ifdef NAS_UE
- rc = (*esm_procedure)(is_standalone, ebi, rsp, triggered_by_ue);
-#endif
-#ifdef NAS_MME
rc = (*esm_procedure)(is_standalone, ctx, ebi, rsp, triggered_by_ue);
-#endif
if (is_discarded) {
/* Return indication that received message has been discarded */
@@ -1052,9 +728,7 @@ static int _esm_sap_recv(int msg_type, int is_standalone,
** **
***************************************************************************/
static int _esm_sap_send(int msg_type, int is_standalone,
-#ifdef NAS_MME
emm_data_context_t *ctx,
-#endif
int pti, int ebi, const esm_sap_data_t *data,
OctetString *rsp)
{
@@ -1064,74 +738,15 @@ static int _esm_sap_send(int msg_type, int is_standalone,
int rc = RETURNok;
/* Indicate whether the message is sent by the UE or the MME */
-#ifdef NAS_UE
- int sent_by_ue = TRUE;
-#endif
-#ifdef NAS_MME
int sent_by_ue = FALSE;
-#endif
ESM_msg esm_msg;
memset(&esm_msg, 0 , sizeof(ESM_msg));
/* Process the ESM message to send */
switch (msg_type) {
-#ifdef NAS_UE
- case ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT:
- break;
- case ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT:
- break;
-
- case ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT:
- break;
-
- case ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT:
- break;
-
- case MODIFY_EPS_BEARER_CONTEXT_ACCEPT:
- break;
-
- case MODIFY_EPS_BEARER_CONTEXT_REJECT:
- break;
-
- case DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT:
- break;
-
- case PDN_CONNECTIVITY_REQUEST: {
- /*
- * Process PDN connectivity request message to send to the MME
- */
- const esm_pdn_connectivity_t *msg = &data->pdn_connect;
- rc = esm_send_pdn_connectivity_request(pti, msg->is_emergency,
- msg->pdn_type, msg->apn,
- &esm_msg.pdn_connectivity_request);
- /* Setup callback function used to send PDN connectivity request
- * message onto the network */
- esm_procedure = esm_proc_pdn_connectivity_request;
- break;
- }
-
- case PDN_DISCONNECT_REQUEST:
- /*
- * Process PDN disconnect request message to send to the MME
- */
- rc = esm_send_pdn_disconnect_request(pti, ebi,
- &esm_msg.pdn_disconnect_request);
- /* Setup callback function used to send PDN disconnect request
- * message onto the network */
- esm_procedure = esm_proc_pdn_disconnect_request;
- break;
-
- case BEARER_RESOURCE_ALLOCATION_REQUEST:
- break;
-
- case BEARER_RESOURCE_MODIFICATION_REQUEST:
- break;
-#endif
-
-#ifdef NAS_MME
case ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST:
break;
@@ -1156,7 +771,6 @@ static int _esm_sap_send(int msg_type, int is_standalone,
case BEARER_RESOURCE_MODIFICATION_REJECT:
break;
-#endif
default:
LOG_TRACE(WARNING, "ESM-SAP - Send unexpected ESM message 0x%x",
@@ -1176,12 +790,7 @@ static int _esm_sap_send(int msg_type, int is_standalone,
/* Execute the relevant ESM procedure */
if (esm_procedure) {
-#ifdef NAS_UE
- rc = (*esm_procedure)(is_standalone, pti, rsp, sent_by_ue);
-#endif
-#ifdef NAS_MME
rc = (*esm_procedure)(is_standalone, ctx, pti, rsp, sent_by_ue);
-#endif
}
}
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/sap/esm_sap.h b/openair-cn/NAS/MME/ESM/SAP/esm_sap.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/sap/esm_sap.h
rename to openair-cn/NAS/MME/ESM/SAP/esm_sap.h
diff --git a/openair-cn/NAS/MME/ESM/SAP/esm_sapDef.h b/openair-cn/NAS/MME/ESM/SAP/esm_sapDef.h
new file mode 100644
index 0000000000..a1372193f1
--- /dev/null
+++ b/openair-cn/NAS/MME/ESM/SAP/esm_sapDef.h
@@ -0,0 +1,179 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+Source esm_sapDef.h
+
+Version 0.1
+
+Date 2012/11/21
+
+Product NAS stack
+
+Subsystem EPS Session Management
+
+Author Frederic Maurel
+
+Description Defines the ESM Service Access Point that provides EPS
+ bearer context handling and resources allocation procedures.
+
+*****************************************************************************/
+
+#include "emmData.h"
+
+#ifndef __ESM_SAPDEF_H__
+#define __ESM_SAPDEF_H__
+
+#include "OctetString.h"
+
+/****************************************************************************/
+/********************* G L O B A L C O N S T A N T S *******************/
+/****************************************************************************/
+
+/*
+ * EPS Session Management primitives
+ * ---------------------------------
+ */
+typedef enum esm_primitive_s {
+ ESM_START = 0,
+ /* Procedures related to EPS bearer contexts (initiated by the network) */
+ ESM_DEFAULT_EPS_BEARER_CONTEXT_ACTIVATE_REQ,
+ ESM_DEFAULT_EPS_BEARER_CONTEXT_ACTIVATE_CNF,
+ ESM_DEFAULT_EPS_BEARER_CONTEXT_ACTIVATE_REJ,
+ ESM_DEDICATED_EPS_BEARER_CONTEXT_ACTIVATE_REQ,
+ ESM_DEDICATED_EPS_BEARER_CONTEXT_ACTIVATE_CNF,
+ ESM_DEDICATED_EPS_BEARER_CONTEXT_ACTIVATE_REJ,
+ ESM_EPS_BEARER_CONTEXT_MODIFY_REQ,
+ ESM_EPS_BEARER_CONTEXT_MODIFY_CNF,
+ ESM_EPS_BEARER_CONTEXT_MODIFY_REJ,
+ ESM_EPS_BEARER_CONTEXT_DEACTIVATE_REQ,
+ ESM_EPS_BEARER_CONTEXT_DEACTIVATE_CNF,
+ /* Transaction related procedures (initiated by the UE) */
+ ESM_PDN_CONNECTIVITY_REQ,
+ ESM_PDN_CONNECTIVITY_REJ,
+ ESM_PDN_DISCONNECT_REQ,
+ ESM_PDN_DISCONNECT_REJ,
+ ESM_BEARER_RESOURCE_ALLOCATE_REQ,
+ ESM_BEARER_RESOURCE_ALLOCATE_REJ,
+ ESM_BEARER_RESOURCE_MODIFY_REQ,
+ ESM_BEARER_RESOURCE_MODIFY_REJ,
+ /* ESM data indication ("raw" ESM message) */
+ ESM_UNITDATA_IND,
+ ESM_END
+} esm_primitive_t;
+
+/****************************************************************************/
+/************************ G L O B A L T Y P E S ************************/
+/****************************************************************************/
+
+/*
+ * Error code returned upon processing ESM-SAP primitive
+ */
+typedef enum {
+ ESM_SAP_SUCCESS = 1, /* ESM-SAP primitive succeed */
+ ESM_SAP_DISCARDED, /* ESM-SAP primitive failed, the caller should
+ * ignore the error */
+ ESM_SAP_FAILED /* ESM-SAP primitive failed, the caller should
+ * take specific action and state transition may
+ * occurs */
+} esm_sap_error_t;
+
+/*
+ * ESM primitive for activate EPS default bearer context procedure
+ * ---------------------------------------------------------------
+ */
+typedef struct esm_activate_eps_default_bearer_context_s {
+} esm_activate_eps_default_bearer_context_t;
+
+/*
+ * ESM primitive for PDN connectivity procedure
+ * --------------------------------------------
+ */
+typedef struct esm_pdn_connectivity_s {
+ int cid; /* PDN connection local identifier */
+ int is_defined; /* Indicates whether a PDN context has been defined
+ * for the specified APN */
+ int pdn_type; /* PDN address type (IPv4, IPv6, IPv4v6) */
+ const char *apn; /* PDN's Access Point Name */
+ int is_emergency; /* Indicates whether the PDN context has been
+ * defined to establish connection for emergency
+ * bearer services */
+} esm_pdn_connectivity_t;
+
+/*
+ * ESM primitive for PDN disconnect procedure
+ * ------------------------------------------
+ */
+typedef struct esm_pdn_disconnect_s {
+ int cid; /* PDN connection local identifier */
+} esm_pdn_disconnect_t;
+
+/*
+ * ESM primitive for deactivate EPS bearer context procedure
+ * ---------------------------------------------------------
+ */
+typedef struct esm_eps_bearer_context_deactivate_s {
+#define ESM_SAP_ALL_EBI 0xff
+ unsigned int ebi; /* EPS bearer identity of the EPS bearer context
+ * to be deactivated */
+} esm_eps_bearer_context_deactivate_t;
+
+/*
+ * ------------------------------
+ * Structure of ESM-SAP primitive
+ * ------------------------------
+ */
+typedef union {
+ esm_pdn_connectivity_t pdn_connect;
+ esm_pdn_disconnect_t pdn_disconnect;
+ esm_eps_bearer_context_deactivate_t eps_bearer_context_deactivate;
+} esm_sap_data_t;
+
+typedef struct esm_sap_s {
+ esm_primitive_t primitive; /* ESM-SAP primitive to process */
+ int is_standalone; /* Indicates whether the ESM message handled
+ * within this primitive has to be sent/received
+ * standalone or together within an EMM related
+ * message */
+ emm_data_context_t *ctx; /* UE context */
+ unsigned int ueid; /* Local UE identifier */
+ esm_sap_error_t err; /* ESM-SAP error code */
+ const OctetString *recv; /* Encoded ESM message received */
+ OctetString send; /* Encoded ESM message to be sent */
+ esm_sap_data_t data; /* ESM message data parameters */
+} esm_sap_t;
+
+/****************************************************************************/
+/******************** G L O B A L V A R I A B L E S ********************/
+/****************************************************************************/
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+#endif /* __ESM_SAPDEF_H__*/
diff --git a/openair-cn/NAS/MME/ESM/SAP/esm_send.c b/openair-cn/NAS/MME/ESM/SAP/esm_send.c
new file mode 100644
index 0000000000..4926c749a2
--- /dev/null
+++ b/openair-cn/NAS/MME/ESM/SAP/esm_send.c
@@ -0,0 +1,427 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+Source esm_send.c
+
+Version 0.1
+
+Date 2013/02/11
+
+Product NAS stack
+
+Subsystem EPS Session Management
+
+Author Frederic Maurel
+
+Description Defines functions executed at the ESM Service Access
+ Point to send EPS Session Management messages to the
+ EPS Mobility Management sublayer.
+
+*****************************************************************************/
+
+#include "esm_send.h"
+#include "commonDef.h"
+#include "nas_log.h"
+
+
+#include "esm_msgDef.h"
+#include "esm_cause.h"
+
+#include // strlen
+
+/****************************************************************************/
+/**************** E X T E R N A L D E F I N I T I O N S ****************/
+/****************************************************************************/
+
+/****************************************************************************/
+/******************* L O C A L D E F I N I T I O N S *******************/
+/****************************************************************************/
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+/*
+ * --------------------------------------------------------------------------
+ * Functions executed by both the UE and the MME to send ESM messages
+ * --------------------------------------------------------------------------
+ */
+/****************************************************************************
+ ** **
+ ** Name: esm_send_status() **
+ ** **
+ ** Description: Builds ESM status message **
+ ** **
+ ** The ESM status message is sent by the network or the UE **
+ ** to pass information on the status of the indicated EPS **
+ ** bearer context and report certain error conditions. **
+ ** **
+ ** Inputs: pti: Procedure transaction identity **
+ ** ebi: EPS bearer identity **
+ ** esm_cause: ESM cause code **
+ ** Others: None **
+ ** **
+ ** Outputs: msg: The ESM message to be sent **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int esm_send_status(int pti, int ebi, esm_status_msg *msg, int esm_cause)
+{
+ LOG_FUNC_IN;
+
+ /* Mandatory - ESM message header */
+ msg->protocoldiscriminator = EPS_SESSION_MANAGEMENT_MESSAGE;
+ msg->epsbeareridentity = ebi;
+ msg->messagetype = ESM_STATUS;
+ msg->proceduretransactionidentity = pti;
+
+ /* Mandatory - ESM cause code */
+ msg->esmcause = esm_cause;
+
+ LOG_TRACE(WARNING, "ESM-SAP - Send ESM Status message (pti=%d, ebi=%d)",
+ msg->proceduretransactionidentity, msg->epsbeareridentity);
+
+ LOG_FUNC_RETURN(RETURNok);
+}
+
+
+/*
+ * --------------------------------------------------------------------------
+ * Functions executed by the MME to send ESM message to the UE
+ * --------------------------------------------------------------------------
+ */
+/****************************************************************************
+ ** **
+ ** Name: esm_send_pdn_connectivity_reject() **
+ ** **
+ ** Description: Builds PDN Connectivity Reject message **
+ ** **
+ ** The PDN connectivity reject message is sent by the net- **
+ ** work to the UE to reject establishment of a PDN connec- **
+ ** tion. **
+ ** **
+ ** Inputs: pti: Procedure transaction identity **
+ ** esm_cause: ESM cause code **
+ ** Others: None **
+ ** **
+ ** Outputs: msg: The ESM message to be sent **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int esm_send_pdn_connectivity_reject(int pti, pdn_connectivity_reject_msg *msg,
+ int esm_cause)
+{
+ LOG_FUNC_IN;
+
+ /* Mandatory - ESM message header */
+ msg->protocoldiscriminator = EPS_SESSION_MANAGEMENT_MESSAGE;
+ msg->epsbeareridentity = EPS_BEARER_IDENTITY_UNASSIGNED;
+ msg->messagetype = PDN_CONNECTIVITY_REJECT;
+ msg->proceduretransactionidentity = pti;
+
+ /* Mandatory - ESM cause code */
+ msg->esmcause = esm_cause;
+ /* Optional IEs */
+ msg->presencemask = 0;
+
+ LOG_TRACE(INFO, "ESM-SAP - Send PDN Connectivity Reject message "
+ "(pti=%d, ebi=%d)",
+ msg->proceduretransactionidentity, msg->epsbeareridentity);
+
+ LOG_FUNC_RETURN(RETURNok);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: esm_send_pdn_disconnect_reject() **
+ ** **
+ ** Description: Builds PDN Disconnect Reject message **
+ ** **
+ ** The PDN disconnect reject message is sent by the network **
+ ** to the UE to reject release of a PDN connection. **
+ ** **
+ ** Inputs: pti: Procedure transaction identity **
+ ** esm_cause: ESM cause code **
+ ** Others: None **
+ ** **
+ ** Outputs: msg: The ESM message to be sent **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int esm_send_pdn_disconnect_reject(int pti, pdn_disconnect_reject_msg *msg,
+ int esm_cause)
+{
+ LOG_FUNC_IN;
+
+ /* Mandatory - ESM message header */
+ msg->protocoldiscriminator = EPS_SESSION_MANAGEMENT_MESSAGE;
+ msg->epsbeareridentity = EPS_BEARER_IDENTITY_UNASSIGNED;
+ msg->messagetype = PDN_DISCONNECT_REJECT;
+ msg->proceduretransactionidentity = pti;
+
+ /* Mandatory - ESM cause code */
+ msg->esmcause = esm_cause;
+ /* Optional IEs */
+ msg->presencemask = 0;
+
+ LOG_TRACE(INFO, "ESM-SAP - Send PDN Disconnect Reject message "
+ "(pti=%d, ebi=%d)",
+ msg->proceduretransactionidentity, msg->epsbeareridentity);
+
+ LOG_FUNC_RETURN(RETURNok);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: esm_send_activate_default_eps_bearer_context_request() **
+ ** **
+ ** Description: Builds Activate Default EPS Bearer Context Request **
+ ** message **
+ ** **
+ ** The activate default EPS bearer context request message **
+ ** is sent by the network to the UE to request activation of **
+ ** a default EPS bearer context. **
+ ** **
+ ** Inputs: pti: Procedure transaction identity **
+ ** ebi: EPS bearer identity **
+ ** qos: Subscribed EPS quality of service **
+ ** apn: Access Point Name in used **
+ ** pdn_addr: PDN IPv4 address and/or IPv6 suffix **
+ ** esm_cause: ESM cause code **
+ ** Others: None **
+ ** **
+ ** Outputs: msg: The ESM message to be sent **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int esm_send_activate_default_eps_bearer_context_request(int pti,
+ int ebi,
+ activate_default_eps_bearer_context_request_msg *msg,
+ const OctetString *apn,
+ const ProtocolConfigurationOptions *pco,
+ int pdn_type,
+ const OctetString *pdn_addr,
+ const EpsQualityOfService *qos,
+ int esm_cause)
+{
+ LOG_FUNC_IN;
+
+ /* Mandatory - ESM message header */
+ msg->protocoldiscriminator = EPS_SESSION_MANAGEMENT_MESSAGE;
+ msg->epsbeareridentity = ebi;
+ msg->messagetype = ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST;
+ msg->proceduretransactionidentity = pti;
+
+ /* Mandatory - EPS QoS */
+ msg->epsqos = *qos;
+ LOG_TRACE(INFO, "ESM-SAP - epsqos qci: %u", qos->qci);
+
+ if (qos->bitRatesPresent) {
+ LOG_TRACE(INFO, "ESM-SAP - epsqos maxBitRateForUL: %u", qos->bitRates.maxBitRateForUL);
+ LOG_TRACE(INFO, "ESM-SAP - epsqos maxBitRateForDL: %u", qos->bitRates.maxBitRateForDL);
+ LOG_TRACE(INFO, "ESM-SAP - epsqos guarBitRateForUL: %u", qos->bitRates.guarBitRateForUL);
+ LOG_TRACE(INFO, "ESM-SAP - epsqos guarBitRateForDL: %u", qos->bitRates.guarBitRateForDL);
+ } else {
+ LOG_TRACE(INFO, "ESM-SAP - epsqos no bit rates defined");
+ }
+
+ if (qos->bitRatesExtPresent) {
+ LOG_TRACE(INFO, "ESM-SAP - epsqos maxBitRateForUL Ext: %u", qos->bitRatesExt.maxBitRateForUL);
+ LOG_TRACE(INFO, "ESM-SAP - epsqos maxBitRateForDL Ext: %u", qos->bitRatesExt.maxBitRateForDL);
+ LOG_TRACE(INFO, "ESM-SAP - epsqos guarBitRateForUL Ext: %u", qos->bitRatesExt.guarBitRateForUL);
+ LOG_TRACE(INFO, "ESM-SAP - epsqos guarBitRateForDL Ext: %u", qos->bitRatesExt.guarBitRateForDL);
+ } else {
+ LOG_TRACE(INFO, "ESM-SAP - epsqos no bit rates ext defined");
+ }
+
+
+ if ((apn == NULL) || ((apn != NULL) && (apn->value == NULL))) {
+ LOG_TRACE(WARNING, "ESM-SAP - apn is NULL!");
+ }
+
+ LOG_TRACE(INFO, "ESM-SAP - apn is %s", apn->value);
+
+ /* Mandatory - Access Point Name */
+ msg->accesspointname.accesspointnamevalue = *apn;
+
+ /* Mandatory - PDN address */
+ LOG_TRACE(INFO, "ESM-SAP - pdn_type is %u", pdn_type);
+ msg->pdnaddress.pdntypevalue = pdn_type;
+ LOG_TRACE(INFO, "ESM-SAP - pdn_addr is %u", dump_octet_string(pdn_addr));
+ msg->pdnaddress.pdnaddressinformation = *pdn_addr;
+
+ /* Optional - ESM cause code */
+ msg->presencemask = 0;
+
+ if (esm_cause != ESM_CAUSE_SUCCESS) {
+ msg->presencemask |=
+ ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_ESM_CAUSE_PRESENT;
+ msg->esmcause = esm_cause;
+ }
+
+ if (pco != NULL) {
+ msg->presencemask |=
+ ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT;
+ msg->protocolconfigurationoptions = *pco;
+ }
+
+#warning "TEST LG FORCE APN-AMBR"
+ LOG_TRACE(INFO, "ESM-SAP - FORCE APN-AMBR");
+ msg->presencemask |=
+ ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_APNAMBR_PRESENT;
+ msg->apnambr.apnambrfordownlink = 0xfe; // (8640kbps)
+ msg->apnambr.apnambrforuplink = 0xfe; // (8640kbps)
+ msg->apnambr.apnambrfordownlink_extended = 0xde; // (200Mbps)
+ msg->apnambr.apnambrforuplink_extended = 0x9e; // (100Mbps)
+ msg->apnambr.apnambrfordownlink_extended2 = 0;
+ msg->apnambr.apnambrforuplink_extended2 = 0;
+ msg->apnambr.extensions = 0 | APN_AGGREGATE_MAXIMUM_BIT_RATE_MAXIMUM_EXTENSION_PRESENT;
+
+ LOG_TRACE(INFO, "ESM-SAP - Send Activate Default EPS Bearer Context "
+ "Request message (pti=%d, ebi=%d)",
+ msg->proceduretransactionidentity, msg->epsbeareridentity);
+
+ LOG_FUNC_RETURN(RETURNok);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: esm_send_activate_dedicated_eps_bearer_context_request() **
+ ** **
+ ** Description: Builds Activate Dedicated EPS Bearer Context Request **
+ ** message **
+ ** **
+ ** The activate dedicated EPS bearer context request message **
+ ** is sent by the network to the UE to request activation of **
+ ** a dedicated EPS bearer context associated with the same **
+ ** PDN address(es) and APN as an already active default EPS **
+ ** bearer context. **
+ ** **
+ ** Inputs: pti: Procedure transaction identity **
+ ** ebi: EPS bearer identity **
+ ** linked_ebi: EPS bearer identity of the default bearer **
+ ** associated with the EPS dedicated bearer **
+ ** to be activated **
+ ** qos: EPS quality of service **
+ ** tft: Traffic flow template **
+ ** Others: None **
+ ** **
+ ** Outputs: msg: The ESM message to be sent **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int esm_send_activate_dedicated_eps_bearer_context_request(int pti, int ebi,
+ activate_dedicated_eps_bearer_context_request_msg *msg,
+ int linked_ebi, const EpsQualityOfService *qos,
+ PacketFilters *pkfs, int n_pkfs)
+{
+ int i;
+ LOG_FUNC_IN;
+
+ /* Mandatory - ESM message header */
+ msg->protocoldiscriminator = EPS_SESSION_MANAGEMENT_MESSAGE;
+ msg->epsbeareridentity = ebi;
+ msg->messagetype = ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST;
+ msg->proceduretransactionidentity = pti;
+
+ /* Mandatory - EPS QoS */
+ msg->epsqos = *qos;
+
+ /* Mandatory - traffic flow template */
+ msg->tft.tftoperationcode = TRAFFIC_FLOW_TEMPLATE_OPCODE_CREATE;
+ msg->tft.ebit = TRAFFIC_FLOW_TEMPLATE_PARAMETER_LIST_IS_NOT_INCLUDED;
+ msg->tft.numberofpacketfilters = n_pkfs;
+
+ for (i = 0; i < msg->tft.numberofpacketfilters; i++) {
+ msg->tft.packetfilterlist.createtft[i] = (*pkfs)[i];
+ }
+
+ /* Optional */
+ msg->presencemask = 0;
+
+ LOG_TRACE(INFO, "ESM-SAP - Send Activate Dedicated EPS Bearer Context "
+ "Request message (pti=%d, ebi=%d)",
+ msg->proceduretransactionidentity, msg->epsbeareridentity);
+
+ LOG_FUNC_RETURN(RETURNok);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: esm_send_deactivate_eps_bearer_context_request() **
+ ** **
+ ** Description: Builds Deactivate EPS Bearer Context Request message **
+ ** **
+ ** The deactivate EPS bearer context request message is sent **
+ ** by the network to request deactivation of an active EPS **
+ ** bearer context. **
+ ** **
+ ** Inputs: pti: Procedure transaction identity **
+ ** ebi: EPS bearer identity **
+ ** esm_cause: ESM cause code **
+ ** Others: None **
+ ** **
+ ** Outputs: msg: The ESM message to be sent **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int esm_send_deactivate_eps_bearer_context_request(int pti, int ebi,
+ deactivate_eps_bearer_context_request_msg *msg,
+ int esm_cause)
+{
+ LOG_FUNC_IN;
+
+ /* Mandatory - ESM message header */
+ msg->protocoldiscriminator = EPS_SESSION_MANAGEMENT_MESSAGE;
+ msg->epsbeareridentity = ebi;
+ msg->messagetype = DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST;
+ msg->proceduretransactionidentity = pti;
+
+ /* Mandatory - ESM cause code */
+ msg->esmcause = esm_cause;
+ /* Optional IEs */
+ msg->presencemask = 0;
+
+ LOG_TRACE(INFO, "ESM-SAP - Send Deactivate EPS Bearer Context Request "
+ "message (pti=%d, ebi=%d)",
+ msg->proceduretransactionidentity, msg->epsbeareridentity);
+
+ LOG_FUNC_RETURN(RETURNok);
+}
+
+/****************************************************************************/
+/********************* L O C A L F U N C T I O N S *********************/
+/****************************************************************************/
+
diff --git a/openair-cn/NAS/MME/ESM/SAP/esm_send.h b/openair-cn/NAS/MME/ESM/SAP/esm_send.h
new file mode 100644
index 0000000000..07c0af4635
--- /dev/null
+++ b/openair-cn/NAS/MME/ESM/SAP/esm_send.h
@@ -0,0 +1,119 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+Source esm_send.h
+
+Version 0.1
+
+Date 2013/02/11
+
+Product NAS stack
+
+Subsystem EPS Session Management
+
+Author Frederic Maurel
+
+Description Defines functions executed at the ESM Service Access
+ Point to send EPS Session Management messages to the
+ EPS Mobility Management sublayer.
+
+*****************************************************************************/
+#ifndef __ESM_SEND_H__
+#define __ESM_SEND_H__
+
+#include "EsmStatus.h"
+
+#include "PdnConnectivityReject.h"
+#include "PdnDisconnectReject.h"
+#include "BearerResourceAllocationReject.h"
+#include "BearerResourceModificationReject.h"
+
+#include "ActivateDefaultEpsBearerContextRequest.h"
+#include "ActivateDedicatedEpsBearerContextRequest.h"
+#include "ModifyEpsBearerContextRequest.h"
+#include "DeactivateEpsBearerContextRequest.h"
+
+#include "EsmInformationRequest.h"
+
+/****************************************************************************/
+/********************* G L O B A L C O N S T A N T S *******************/
+/****************************************************************************/
+
+/****************************************************************************/
+/************************ G L O B A L T Y P E S ************************/
+/****************************************************************************/
+
+/****************************************************************************/
+/******************** G L O B A L V A R I A B L E S ********************/
+/****************************************************************************/
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+/*
+ * --------------------------------------------------------------------------
+ * Functions executed by both the UE and the MME to send ESM messages
+ * --------------------------------------------------------------------------
+ */
+int esm_send_status(int pti, int ebi, esm_status_msg *msg, int esm_cause);
+
+
+/*
+ * --------------------------------------------------------------------------
+ * Functions executed by the MME to send ESM message to the UE
+ * --------------------------------------------------------------------------
+ */
+/*
+ * Transaction related messages
+ * ----------------------------
+ */
+int esm_send_pdn_connectivity_reject(int pti, pdn_connectivity_reject_msg *msg,
+ int esm_cause);
+
+int esm_send_pdn_disconnect_reject(int pti, pdn_disconnect_reject_msg *msg,
+ int esm_cause);
+
+/*
+ * Messages related to EPS bearer contexts
+ * ---------------------------------------
+ */
+int esm_send_activate_default_eps_bearer_context_request(int pti, int ebi,
+ activate_default_eps_bearer_context_request_msg *msg, const OctetString *apn,
+ const ProtocolConfigurationOptions *pco, int pdn_type, const OctetString *pdn_addr,
+ const EpsQualityOfService *qos, int esm_cause);
+
+int esm_send_activate_dedicated_eps_bearer_context_request(int pti, int ebi,
+ activate_dedicated_eps_bearer_context_request_msg *msg, int linked_ebi,
+ const EpsQualityOfService *qos, PacketFilters *pkfs, int n_pkfs);
+
+int esm_send_deactivate_eps_bearer_context_request(int pti, int ebi,
+ deactivate_eps_bearer_context_request_msg *msg, int esm_cause);
+
+#endif /* __ESM_SEND_H__*/
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/esmData.h b/openair-cn/NAS/MME/ESM/esmData.h
similarity index 91%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/esmData.h
rename to openair-cn/NAS/MME/ESM/esmData.h
index 4718597254..a5f839c1dc 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/esm/esmData.h
+++ b/openair-cn/NAS/MME/ESM/esmData.h
@@ -49,9 +49,7 @@ Description Defines internal private data handled by EPS Session
#include "OctetString.h"
#include "EpsBearerIdentity.h"
-#ifdef NAS_MME
#include "mme_api.h"
-#endif
#if defined(NAS_BUILT_IN_EPC)
# include "tree.h"
@@ -83,49 +81,38 @@ typedef enum {
ESM_EBR_INACTIVE, /* No EPS bearer context exists */
ESM_EBR_ACTIVE, /* The EPS bearer context is active,
* in the UE, in the network */
-#ifdef NAS_MME
ESM_EBR_INACTIVE_PENDING, /* The network has initiated an EPS bearer
* context deactivation towards the UE */
ESM_EBR_MODIFY_PENDING, /* The network has initiated an EPS bearer
* context modification towards the UE */
ESM_EBR_ACTIVE_PENDING, /* The network has initiated an EPS bearer
* context activation towards the UE */
-#endif
ESM_EBR_STATE_MAX
} esm_ebr_state;
-#ifdef NAS_MME
/* ESM message timer retransmission data */
-typedef struct {
+typedef struct esm_ebr_timer_data_s {
void *ctx;
unsigned int ueid; /* Lower layers UE identifier */
unsigned int ebi; /* EPS bearer identity */
unsigned int count; /* Retransmission counter */
OctetString msg; /* Encoded ESM message to re-transmit */
} esm_ebr_timer_data_t;
-#endif
/*
* -----------------------
* EPS bearer context data
* -----------------------
*/
-typedef struct {
+typedef struct esm_ebr_context_s {
unsigned char ebi; /* EPS bearer identity */
esm_ebr_state status; /* EPS bearer context status */
-#ifdef NAS_UE
- int is_default_ebr; /* TRUE if the bearer context is associated
- * to a default EPS bearer */
- char cid; /* Identifier of the PDN context the EPS
- * bearer context has been assigned to */
-#endif
-#ifdef NAS_MME
+
struct nas_timer_t timer; /* Retransmission timer */
esm_ebr_timer_data_t *args; /* Retransmission timer parameters data */
-#endif
} esm_ebr_context_t;
-typedef struct {
+typedef struct esm_ebr_data_s {
unsigned char index; /* Index of the next EPS bearer context
* identity to be used */
#define ESM_EBR_DATA_SIZE (ESM_EBI_MAX - ESM_EBI_MIN + 1)
@@ -147,7 +134,7 @@ typedef struct {
* butes. An EPS bearer corresponds to one Quality of Service policy
* applied within the EPC and E-UTRAN.
*/
-typedef struct {
+typedef struct esm_bearer_s {
int bid; /* Identifier of the EPS bearer */
unsigned int ebi; /* EPS bearer identity */
network_qos_t qos; /* EPS bearer level QoS parameters */
@@ -161,7 +148,7 @@ typedef struct {
* one IPv4 address and/or one IPv6 prefix and a PDN represented by
* an Access Point Name (APN).
*/
-typedef struct {
+typedef struct esm_pdn_s {
unsigned int pti; /* Identity of the procedure transaction executed
* to activate the PDN connection entry */
int is_emergency; /* Emergency bearer services indicator */
@@ -211,30 +198,18 @@ typedef struct esm_data_context_s {
esm_ebr_data_t ebr;
} esm_data_context_t;
-/*
- * --------------------------------------------------------------------------
- * ESM internal data handled by EPS Session Management sublayer in the UE
- * --------------------------------------------------------------------------
- */
-#ifdef NAS_UE
-/*
- * Structure of the ESM data
- * -------------------------
- */
-typedef esm_data_context_t esm_data_t;
-#endif // NAS_UE
+
/*
* --------------------------------------------------------------------------
* ESM internal data handled by EPS Session Management sublayer in the MME
* --------------------------------------------------------------------------
*/
-#ifdef NAS_MME
/*
* Structure of the ESM data
* -------------------------
*/
-typedef struct {
+typedef struct esm_data_s {
/*
* MME configuration
* -----------------
@@ -264,7 +239,6 @@ void esm_data_context_add(esm_data_t *esm_data, struct esm_data_context_s *elm);
# endif
-#endif //NAS_MME
/****************************************************************************/
/******************** G L O B A L V A R I A B L E S ********************/
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/esm_ebr.c b/openair-cn/NAS/MME/ESM/esm_ebr.c
similarity index 87%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/esm_ebr.c
rename to openair-cn/NAS/MME/ESM/esm_ebr.c
index 1b24bee2f6..720e69a5eb 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/esm/esm_ebr.c
+++ b/openair-cn/NAS/MME/ESM/esm_ebr.c
@@ -53,17 +53,14 @@ Description Defines functions used to handle state of EPS bearer contexts
#include "nas_log.h"
#include "mme_api.h"
+#include "msc.h"
/****************************************************************************/
/**************** E X T E R N A L D E F I N I T I O N S ****************/
/****************************************************************************/
-#ifdef NAS_UE
-#define ESM_EBR_NB_UE_MAX 1
-#endif
-#ifdef NAS_MME
+
#define ESM_EBR_NB_UE_MAX (MME_API_NB_UE_MAX + 1)
-#endif
/****************************************************************************/
/******************* L O C A L D E F I N I T I O N S *******************/
@@ -73,11 +70,9 @@ Description Defines functions used to handle state of EPS bearer contexts
static const char *_esm_ebr_state_str[ESM_EBR_STATE_MAX] = {
"BEARER CONTEXT INACTIVE",
"BEARER CONTEXT ACTIVE",
-#ifdef NAS_MME
"BEARER CONTEXT INACTIVE PENDING",
"BEARER CONTEXT MODIFY PENDING",
"BEARER CONTEXT ACTIVE PENDING"
-#endif
};
/*
@@ -95,37 +90,12 @@ static esm_ebr_data_t _esm_ebr_data[ESM_EBR_NB_UE_MAX];
* User notification data
* ----------------------
*/
-#ifdef NAS_UE
-/* User notification callback executed whenever an EPS bearer context becomes
- * active or inactive */
-static esm_indication_callback_t _esm_ebr_callback;
-/* PDN connection and EPS bearer status [NW/UE][Dedicated/Default][status] */
-static const network_pdn_state_t _esm_ebr_pdn_state[2][2][2] = {
- /* Status modification triggerer by the network */
- {
- /* Dedicated EPS bearer */
- {NET_PDN_NW_DEDICATED_DEACT, NET_PDN_NW_DEDICATED_ACT},
- /* Default EPS bearer */
- {NET_PDN_NW_DEFAULT_DEACT, 0}
- },
- /* Status modification triggered by the UE */
- {
- /* Dedicated EPS bearer */
- {NET_PDN_MT_DEDICATED_DEACT, NET_PDN_MT_DEDICATED_ACT},
- /* Default EPS bearer */
- {NET_PDN_MT_DEFAULT_DEACT, NET_PDN_MT_DEFAULT_ACT}
- }
-};
-#endif
+
/* Returns the index of the next available entry in the list of EPS bearer
* context data */
-#ifdef NAS_MME
static int _esm_ebr_get_available_entry(emm_data_context_t *ctx);
-#endif
-#ifdef NAS_UE
-static int _esm_ebr_get_available_entry(unsigned int ueid);
-#endif
+
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
@@ -145,10 +115,7 @@ static int _esm_ebr_get_available_entry(unsigned int ueid);
** Others: _esm_ebr_data **
** **
***************************************************************************/
-void esm_ebr_initialize(
-#ifdef NAS_UE
- esm_indication_callback_t cb
-#endif
+void esm_ebr_initialize(void
)
{
#if !defined(NAS_BUILT_IN_EPC)
@@ -164,12 +131,6 @@ void esm_ebr_initialize(
_esm_ebr_data[ueid].context[i] = NULL;
}
}
-
-# ifdef NAS_UE
- /* Initialize the user notification callback */
- _esm_ebr_callback = *cb;
-# endif
-
LOG_FUNC_OUT;
#endif
}
@@ -195,12 +156,7 @@ void esm_ebr_initialize(
** Others: _esm_ebr_data **
** **
***************************************************************************/
-#ifdef NAS_UE
-int esm_ebr_assign(int ebi, int cid, int default_ebr)
-#endif
-#ifdef NAS_MME
int esm_ebr_assign(emm_data_context_t *ctx, int ebi)
-#endif
{
esm_ebr_context_t *ebr_ctx = NULL;
unsigned int ueid = 0;
@@ -208,11 +164,7 @@ int esm_ebr_assign(emm_data_context_t *ctx, int ebi)
LOG_FUNC_IN;
-#if defined(NAS_UE)
- ebr_ctx = _esm_ebr_data[ueid].context[ebi - ESM_EBI_MIN];
-#else
ebr_ctx = ctx->esm_data_ctx.ebr.context[ebi - ESM_EBI_MIN];
-#endif
if (ebi != ESM_EBI_UNASSIGNED) {
if ( (ebi < ESM_EBI_MIN) || (ebi > ESM_EBI_MAX) ) {
@@ -227,11 +179,7 @@ int esm_ebr_assign(emm_data_context_t *ctx, int ebi)
i = ebi - ESM_EBI_MIN;
} else {
/* Search for an available EPS bearer identity */
-#ifdef NAS_UE
- i = _esm_ebr_get_available_entry(ueid);
-#else
i = _esm_ebr_get_available_entry(ctx);
-#endif
if (i < 0) {
LOG_FUNC_RETURN(ESM_EBI_UNASSIGNED);
@@ -256,28 +204,17 @@ int esm_ebr_assign(emm_data_context_t *ctx, int ebi)
#endif
/* Store the index of the next available EPS bearer identity */
-#ifdef NAS_MME
ctx->esm_data_ctx.ebr.index = i + 1;
-#else
- _esm_ebr_data[ueid].index = i + 1;
-#endif
+
/* Set the EPS bearer identity */
ebr_ctx->ebi = ebi;
/* Set the EPS bearer context status to INACTIVE */
ebr_ctx->status = ESM_EBR_INACTIVE;
-#ifdef NAS_UE
- /* Set the default EPS bearer indicator */
- ebr_ctx->is_default_ebr = default_ebr;
- /* Set the identifier of the PDN context the EPS bearer is assigned to */
- ebr_ctx->cid = cid;
-#endif
-#ifdef NAS_MME
/* Disable the retransmission timer */
ebr_ctx->timer.id = NAS_TIMER_INACTIVE_ID;
/* Setup retransmission timer parameters */
ebr_ctx->args = NULL;
-#endif
LOG_TRACE(INFO, "ESM-FSM - EPS bearer context %d assigned", ebi);
LOG_FUNC_RETURN(ebr_ctx->ebi);
@@ -302,14 +239,9 @@ int esm_ebr_assign(emm_data_context_t *ctx, int ebi)
** **
***************************************************************************/
int esm_ebr_release(
-#ifdef NAS_MME
emm_data_context_t *ctx,
-#endif
int ebi)
{
-#ifdef NAS_UE
- unsigned int ueid = 0;
-#endif
esm_ebr_context_t *ebr_ctx;
LOG_FUNC_IN;
@@ -319,11 +251,7 @@ int esm_ebr_release(
}
/* Get EPS bearer context data */
-#if defined(NAS_MME)
ebr_ctx = ctx->esm_data_ctx.ebr.context[ebi - ESM_EBI_MIN];
-#else
- ebr_ctx = _esm_ebr_data[ueid].context[ebi - ESM_EBI_MIN];
-#endif
if ( (ebr_ctx == NULL) || (ebr_ctx->ebi != ebi) ) {
/* EPS bearer context not assigned */
@@ -336,13 +264,12 @@ int esm_ebr_release(
LOG_FUNC_RETURN (RETURNerror);
}
-#ifdef NAS_MME
-
/* Stop the retransmission timer if still running */
if (ebr_ctx->timer.id != NAS_TIMER_INACTIVE_ID) {
LOG_TRACE(INFO, "ESM-FSM - Stop retransmission timer %d",
ebr_ctx->timer.id);
ebr_ctx->timer.id = nas_timer_stop(ebr_ctx->timer.id);
+ MSC_LOG_EVENT(MSC_NAS_ESM_MME, "0 Timer %x ebi %u stopped",ebr_ctx->timer.id, ebi);
}
/* Release the retransmisison timer parameters */
@@ -355,8 +282,6 @@ int esm_ebr_release(
ebr_ctx->args = NULL;
}
-#endif
-
/* Release EPS bearer context data */
free(ebr_ctx);
ebr_ctx = NULL;
@@ -365,7 +290,6 @@ int esm_ebr_release(
LOG_FUNC_RETURN (RETURNok);
}
-#ifdef NAS_MME
/****************************************************************************
** **
** Name: esm_ebr_start_timer() **
@@ -413,6 +337,7 @@ int esm_ebr_start_timer(emm_data_context_t *ctx, int ebi, const OctetString *msg
if (ebr_ctx->args) {
/* Re-start the retransmission timer */
ebr_ctx->timer.id = nas_timer_restart(ebr_ctx->timer.id);
+ MSC_LOG_EVENT(MSC_NAS_ESM_MME, "0 Timer %x ebi %u restarted",ebr_ctx->timer.id, ebi);
}
} else {
/* Setup the retransmission timer parameters */
@@ -437,6 +362,7 @@ int esm_ebr_start_timer(emm_data_context_t *ctx, int ebi, const OctetString *msg
/* Setup the retransmission timer to expire at the given
* time interval */
ebr_ctx->timer.id = nas_timer_start(sec, cb, ebr_ctx->args);
+ MSC_LOG_EVENT(MSC_NAS_ESM_MME, "0 Timer %x ebi %u started",ebr_ctx->timer.id, ebi);
ebr_ctx->timer.sec = sec;
}
}
@@ -493,6 +419,7 @@ int esm_ebr_stop_timer(emm_data_context_t *ctx, int ebi)
LOG_TRACE(INFO, "ESM-FSM - Stop retransmission timer %d",
ebr_ctx->timer.id);
ebr_ctx->timer.id = nas_timer_stop(ebr_ctx->timer.id);
+ MSC_LOG_EVENT(MSC_NAS_ESM_MME, "0 Timer %x ebi %u stopped",ebr_ctx->timer.id, ebi);
}
/* Release the retransmisison timer parameters */
@@ -552,7 +479,6 @@ int esm_ebr_get_pending_ebi(emm_data_context_t *ctx, esm_ebr_state status)
/* EPS bearer context entry not found */
LOG_FUNC_RETURN (ESM_EBI_UNASSIGNED);
}
-#endif
/****************************************************************************
** **
@@ -575,9 +501,7 @@ int esm_ebr_get_pending_ebi(emm_data_context_t *ctx, esm_ebr_state status)
** **
***************************************************************************/
int esm_ebr_set_status(
-#ifdef NAS_MME
emm_data_context_t *ctx,
-#endif
int ebi, esm_ebr_state status, int ue_requested)
{
esm_ebr_context_t *ebr_ctx;
@@ -585,31 +509,17 @@ int esm_ebr_set_status(
LOG_FUNC_IN;
-#ifdef NAS_UE
- unsigned int ueid = 0;
-
- if (ueid >= ESM_EBR_NB_UE_MAX) {
- LOG_FUNC_RETURN (RETURNerror);
- }
-
-#else
-
if (ctx == NULL) {
LOG_FUNC_RETURN (RETURNerror);
}
-#endif
if ( (ebi < ESM_EBI_MIN) || (ebi > ESM_EBI_MAX) ) {
LOG_FUNC_RETURN (RETURNerror);
}
/* Get EPS bearer context data */
-#ifdef NAS_UE
- ebr_ctx = _esm_ebr_data[ueid].context[ebi - ESM_EBI_MIN];
-#else
ebr_ctx = ctx->esm_data_ctx.ebr.context[ebi - ESM_EBI_MIN];
-#endif
if ( (ebr_ctx == NULL) || (ebr_ctx->ebi != ebi) ) {
/* EPS bearer context not assigned */
@@ -621,20 +531,18 @@ int esm_ebr_set_status(
old_status = ebr_ctx->status;
if (status < ESM_EBR_STATE_MAX) {
- LOG_TRACE(INFO, "ESM-FSM - Status of EPS bearer context %d changed:"
- " %s ===> %s", ebi,
- _esm_ebr_state_str[old_status], _esm_ebr_state_str[status]);
-
if (status != old_status) {
+ LOG_TRACE(INFO, "ESM-FSM - Status of EPS bearer context %d changed:"
+ " %s ===> %s", ebi,
+ _esm_ebr_state_str[old_status], _esm_ebr_state_str[status]);
+ MSC_LOG_EVENT(MSC_NAS_ESM_MME, "0 ESM state %s => %s "NAS_UE_ID_FMT" ",
+ _esm_ebr_state_str[old_status], _esm_ebr_state_str[status], ctx->ueid);
+
ebr_ctx->status = status;
-#ifdef NAS_UE
- /*
- * Notify the user that the state of the EPS bearer has changed
- */
- (*_esm_ebr_callback)(ebr_ctx->cid,
- _esm_ebr_pdn_state[ue_requested][ebr_ctx->is_default_ebr][status]);
-#endif
LOG_FUNC_RETURN (RETURNok);
+ } else {
+ LOG_TRACE(INFO, "ESM-FSM - Status of EPS bearer context %d unchanged:"
+ " %s ", ebi, _esm_ebr_state_str[status]);
}
}
@@ -658,7 +566,6 @@ int esm_ebr_set_status(
** Others: None **
** **
***************************************************************************/
-#ifdef NAS_MME
esm_ebr_state esm_ebr_get_status(
emm_data_context_t *ctx,
int ebi)
@@ -679,31 +586,7 @@ esm_ebr_state esm_ebr_get_status(
return (ctx->esm_data_ctx.ebr.context[ebi - ESM_EBI_MIN]->status);
}
-#endif
-#ifdef NAS_UE
-esm_ebr_state esm_ebr_get_status(
- int ebi)
-{
- unsigned int ueid = 0;
-
- if ( (ebi < ESM_EBI_MIN) || (ebi > ESM_EBI_MAX) ) {
- return (ESM_EBR_INACTIVE);
- }
-
- if (_esm_ebr_data[ueid].context[ebi - ESM_EBI_MIN] == NULL) {
- /* EPS bearer context not allocated */
- return (ESM_EBR_INACTIVE);
- }
-
- if (_esm_ebr_data[ueid].context[ebi - ESM_EBI_MIN]->ebi != ebi) {
- /* EPS bearer context not assigned */
- return (ESM_EBR_INACTIVE);
- }
-
- return (_esm_ebr_data[ueid].context[ebi - ESM_EBI_MIN]->status);
-}
-#endif
/****************************************************************************
** **
@@ -742,22 +625,13 @@ int esm_ebr_is_reserved(int ebi)
** **
***************************************************************************/
int esm_ebr_is_not_in_use(
-#ifdef NAS_MME
emm_data_context_t *ctx,
-#endif
int ebi)
{
-#ifdef NAS_UE
- unsigned int ueid = 0;
- return ( (ebi == ESM_EBI_UNASSIGNED) ||
- (_esm_ebr_data[ueid].context[ebi - ESM_EBI_MIN] == NULL) ||
- (_esm_ebr_data[ueid].context[ebi - ESM_EBI_MIN]->ebi) != ebi);
-#else
return ( (ebi == ESM_EBI_UNASSIGNED) ||
(ctx->esm_data_ctx.ebr.context[ebi - ESM_EBI_MIN] == NULL) ||
(ctx->esm_data_ctx.ebr.context[ebi - ESM_EBI_MIN]->ebi) != ebi);
-#endif
}
/****************************************************************************/
@@ -781,7 +655,6 @@ int esm_ebr_is_not_in_use(
** Others: None **
** **
***************************************************************************/
-#ifdef NAS_MME
static int _esm_ebr_get_available_entry(emm_data_context_t *ctx)
{
int i;
@@ -805,29 +678,3 @@ static int _esm_ebr_get_available_entry(emm_data_context_t *ctx)
/* No available EBI entry found */
return (-1);
}
-#endif
-#ifdef NAS_UE
-static int _esm_ebr_get_available_entry(unsigned int ueid)
-{
- int i;
-
- for (i = _esm_ebr_data[ueid].index; i < ESM_EBR_DATA_SIZE; i++) {
- if (_esm_ebr_data[ueid].context[i] != NULL) {
- continue;
- }
-
- return i;
- }
-
- for (i = 0; i < _esm_ebr_data[ueid].index; i++) {
- if (_esm_ebr_data[ueid].context[i] != NULL) {
- continue;
- }
-
- return i;
- }
-
- /* No available EBI entry found */
- return (-1);
-}
-#endif
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/esm_ebr.h b/openair-cn/NAS/MME/ESM/esm_ebr.h
similarity index 90%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/esm_ebr.h
rename to openair-cn/NAS/MME/ESM/esm_ebr.h
index 15f7523b3f..bacd62802c 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/esm/esm_ebr.h
+++ b/openair-cn/NAS/MME/ESM/esm_ebr.h
@@ -47,11 +47,6 @@ Description Defines functions used to handle state of EPS bearer contexts
#define __ESM_EBR_H__
#include "OctetString.h"
-
-#ifdef NAS_UE
-#include "networkDef.h"
-#endif
-
#include "nas_timer.h"
/****************************************************************************/
@@ -75,18 +70,6 @@ Description Defines functions used to handle state of EPS bearer contexts
int esm_ebr_is_reserved(int ebi);
-#ifdef NAS_UE
-void esm_ebr_initialize(esm_indication_callback_t cb);
-int esm_ebr_assign(int ebi, int cid, int default_ebr);
-int esm_ebr_release(int ebi);
-
-int esm_ebr_set_status(int ebi, esm_ebr_state status, int ue_requested);
-esm_ebr_state esm_ebr_get_status(int ebi);
-
-int esm_ebr_is_not_in_use(int ebi);
-#endif
-
-#ifdef NAS_MME
void esm_ebr_initialize(void);
int esm_ebr_assign(emm_data_context_t *ctx, int ebi);
int esm_ebr_release(emm_data_context_t *ctx, int ebi);
@@ -102,6 +85,5 @@ int esm_ebr_set_status(emm_data_context_t *ctx, int ebi, esm_ebr_state status,
esm_ebr_state esm_ebr_get_status(emm_data_context_t *ctx, int ebi);
int esm_ebr_is_not_in_use(emm_data_context_t *ctx, int ebi);
-#endif
#endif /* __ESM_EBR_H__*/
diff --git a/openair-cn/NAS/MME/ESM/esm_ebr_context.c b/openair-cn/NAS/MME/ESM/esm_ebr_context.c
new file mode 100644
index 0000000000..db0d99500f
--- /dev/null
+++ b/openair-cn/NAS/MME/ESM/esm_ebr_context.c
@@ -0,0 +1,431 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+Source esm_ebr_context.h
+
+Version 0.1
+
+Date 2013/05/28
+
+Product NAS stack
+
+Subsystem EPS Session Management
+
+Author Frederic Maurel
+
+Description Defines functions used to handle EPS bearer contexts.
+
+*****************************************************************************/
+#include // malloc, free
+#include // memset
+
+#include "commonDef.h"
+#include "nas_log.h"
+
+#include "emmData.h"
+#include "esm_ebr.h"
+
+#include "esm_ebr_context.h"
+
+#include "emm_sap.h"
+
+#if defined(ENABLE_ITTI)
+# include "assertions.h"
+#endif
+
+
+
+/****************************************************************************/
+/**************** E X T E R N A L D E F I N I T I O N S ****************/
+/****************************************************************************/
+
+/****************************************************************************/
+/******************* L O C A L D E F I N I T I O N S *******************/
+/****************************************************************************/
+
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+/****************************************************************************
+ ** **
+ ** Name: esm_ebr_context_create() **
+ ** **
+ ** Description: Creates a new EPS bearer context to the PDN with the spe- **
+ ** cified PDN connection identifier **
+ ** **
+ ** Inputs: ueid: UE identifier **
+ ** pid: PDN connection identifier **
+ ** ebi: EPS bearer identity **
+ ** is_default: TRUE if the new bearer is a default EPS **
+ ** bearer context **
+ ** esm_qos: EPS bearer level QoS parameters **
+ ** tft: Traffic flow template parameters **
+ ** Others: _esm_data **
+ ** **
+ ** Outputs: None **
+ ** Return: The EPS bearer identity of the default EPS **
+ ** bearer associated to the new EPS bearer **
+ ** context if successfully created; **
+ ** UNASSIGN EPS bearer value otherwise. **
+ ** Others: _esm_data **
+ ** **
+ ***************************************************************************/
+int esm_ebr_context_create(
+ emm_data_context_t *ctx,
+ int pid, int ebi, int is_default,
+ const network_qos_t *qos, const network_tft_t *tft)
+{
+ int bid = 0;
+ esm_data_context_t *esm_ctx = NULL;
+ esm_pdn_t *pdn = NULL;
+ unsigned int ueid = 0;
+
+ LOG_FUNC_IN;
+
+
+# if defined(NAS_BUILT_IN_EPC)
+ esm_ctx = &ctx->esm_data_ctx;
+# else
+
+ if (ueid < ESM_DATA_NB_UE_MAX) {
+ ctx = _esm_data.ctx[ueid];
+ } else {
+ LOG_FUNC_RETURN (ESM_EBI_UNASSIGNED);
+ }
+
+# endif
+
+ bid = ESM_DATA_EPS_BEARER_MAX;
+
+ LOG_TRACE(INFO, "ESM-PROC - Create new %s EPS bearer context (ebi=%d) "
+ "for PDN connection (pid=%d)",
+ (is_default)? "default" : "dedicated", ebi, pid);
+
+ if (pid < ESM_DATA_PDN_MAX) {
+ if (pid != esm_ctx->pdn[pid].pid) {
+ LOG_TRACE(ERROR, "ESM-PROC - PDN connection identifier %d is "
+ "not valid", pid);
+ } else if (esm_ctx->pdn[pid].data == NULL) {
+ LOG_TRACE(ERROR, "ESM-PROC - PDN connection %d has not been "
+ "allocated", pid);
+ }
+ /* Check the total number of active EPS bearers */
+ else if (esm_ctx->n_ebrs > ESM_DATA_EPS_BEARER_TOTAL) {
+ LOG_TRACE(WARNING, "ESM-PROC - The total number of active EPS"
+ "bearers is exceeded");
+ } else {
+ /* Get the PDN connection entry */
+ pdn = esm_ctx->pdn[pid].data;
+
+ if (is_default) {
+ /* Default EPS bearer entry is defined at index 0 */
+ bid = 0;
+
+ if (pdn->bearer[bid] != NULL) {
+ LOG_TRACE(ERROR, "ESM-PROC - A default EPS bearer context "
+ "is already allocated");
+ LOG_FUNC_RETURN (ESM_EBI_UNASSIGNED);
+ }
+ } else {
+ /* Search for an available EPS bearer context entry */
+ for (bid = 1; bid < ESM_DATA_EPS_BEARER_MAX; bid++) {
+ if (pdn->bearer[bid] != NULL) {
+ continue;
+ }
+
+ break;
+ }
+ }
+ }
+ }
+
+ if (bid < ESM_DATA_EPS_BEARER_MAX) {
+ /* Create new EPS bearer context */
+ esm_bearer_t *ebr = (esm_bearer_t *)malloc(sizeof(esm_bearer_t));
+
+ if (ebr != NULL) {
+ memset(ebr, 0 , sizeof(esm_bearer_t));
+ /* Increment the total number of active EPS bearers */
+ esm_ctx->n_ebrs += 1;
+ /* Increment the number of EPS bearer for this PDN connection */
+ pdn->n_bearers += 1;
+ /* Setup the EPS bearer data */
+ pdn->bearer[bid] = ebr;
+ ebr->bid = bid;
+ ebr->ebi = ebi;
+
+ if (qos != NULL) {
+ /* EPS bearer level QoS parameters */
+ ebr->qos = *qos;
+ }
+
+ if ( (tft != NULL) && (tft->n_pkfs < NET_PACKET_FILTER_MAX) ) {
+ int i;
+
+ /* Traffic flow template parameters */
+ for (i = 0; i < tft->n_pkfs; i++) {
+ ebr->tft.pkf[i] =
+ (network_pkf_t *)malloc(sizeof(network_pkf_t));
+
+ if (ebr->tft.pkf[i] != NULL) {
+ *(ebr->tft.pkf[i]) = *(tft->pkf[i]);
+ ebr->tft.n_pkfs += 1;
+ }
+ }
+ }
+
+ if (is_default) {
+ /* Set the PDN connection activation indicator */
+ esm_ctx->pdn[pid].is_active = TRUE;
+
+ /* Update the emergency bearer services indicator */
+ if (pdn->is_emergency) {
+ esm_ctx->emergency = TRUE;
+ }
+
+
+ }
+
+ /* Return the EPS bearer identity of the default EPS bearer
+ * associated to the new EPS bearer context */
+ LOG_FUNC_RETURN (pdn->bearer[0]->ebi);
+ }
+
+ LOG_TRACE(WARNING, "ESM-PROC - Failed to create new EPS bearer "
+ "context (ebi=%d)", ebi);
+ }
+
+ LOG_FUNC_RETURN (ESM_EBI_UNASSIGNED);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: esm_ebr_context_release() **
+ ** **
+ ** Description: Releases EPS bearer context entry previously allocated **
+ ** to the EPS bearer with the specified EPS bearer identity **
+ ** **
+ ** Inputs: ueid: UE identifier **
+ ** ebi: EPS bearer identity **
+ ** Others: _esm_data **
+ ** **
+ ** Outputs: pid: Identifier of the PDN connection entry the **
+ ** EPS bearer context belongs to **
+ ** bid: Identifier of the released EPS bearer con- **
+ ** text entry **
+ ** Return: The EPS bearer identity associated to the **
+ ** EPS bearer context if successfully relea- **
+ ** sed; UNASSIGN EPS bearer value otherwise. **
+ ** Others: _esm_data **
+ ** **
+ ***************************************************************************/
+int esm_ebr_context_release(
+ emm_data_context_t *ctx,
+ int ebi, int *pid, int *bid)
+{
+ int found = FALSE;
+ esm_pdn_t *pdn = NULL;
+ esm_data_context_t *esm_ctx;
+
+ unsigned int ueid = 0;
+
+ LOG_FUNC_IN;
+
+
+
+# if defined(NAS_BUILT_IN_EPC)
+ esm_ctx = &ctx->esm_data_ctx;
+# else
+
+ if (ueid < ESM_DATA_NB_UE_MAX) {
+ ctx = &_esm_data.ctx[ueid];
+ } else {
+ LOG_FUNC_RETURN (ESM_EBI_UNASSIGNED);
+ }
+
+# endif
+
+ if (ebi != ESM_EBI_UNASSIGNED) {
+ /*
+ * The identity of the EPS bearer to released is given;
+ * Release the EPS bearer context entry that match the specified EPS
+ * bearer identity
+ */
+
+ /* Search for active PDN connection */
+ for (*pid = 0; *pid < ESM_DATA_PDN_MAX; (*pid)++) {
+ if ( !esm_ctx->pdn[*pid].is_active ) {
+ continue;
+ }
+
+ /* An active PDN connection is found */
+ if (esm_ctx->pdn[*pid].data != NULL) {
+ pdn = esm_ctx->pdn[*pid].data;
+
+ /* Search for the specified EPS bearer context entry */
+ for (*bid = 0; *bid < pdn->n_bearers; (*bid)++) {
+ if (pdn->bearer[*bid] != NULL) {
+ if (pdn->bearer[*bid]->ebi != ebi) {
+ continue;
+ }
+
+ /* The EPS bearer context entry is found */
+ found = TRUE;
+ break;
+ }
+ }
+ }
+
+ if (found) {
+ break;
+ }
+ }
+ } else {
+ /*
+ * The identity of the EPS bearer to released is not given;
+ * Release the EPS bearer context entry allocated with the EPS
+ * bearer context identifier (bid) to establish connectivity to
+ * the PDN identified by the PDN connection identifier (pid).
+ * Default EPS bearer to a given PDN is always identified by the
+ * first EPS bearer context entry at index bid = 0
+ */
+ if (*pid < ESM_DATA_PDN_MAX) {
+ if (*pid != esm_ctx->pdn[*pid].pid) {
+ LOG_TRACE(ERROR, "ESM-PROC - PDN connection identifier %d "
+ "is not valid", *pid);
+ } else if (!esm_ctx->pdn[*pid].is_active) {
+ LOG_TRACE(WARNING,"ESM-PROC - PDN connection %d is not active",
+ *pid);
+ } else if (esm_ctx->pdn[*pid].data == NULL) {
+ LOG_TRACE(ERROR, "ESM-PROC - PDN connection %d has not been "
+ "allocated", *pid);
+ } else {
+ pdn = esm_ctx->pdn[*pid].data;
+
+ if (pdn->bearer[*bid] != NULL) {
+ ebi = pdn->bearer[*bid]->ebi;
+ found = TRUE;
+ }
+ }
+ }
+ }
+
+ if (found) {
+ int i, j;
+
+ /*
+ * Delete the specified EPS bearer context entry
+ */
+ if (pdn->bearer[*bid]->bid != *bid) {
+ LOG_TRACE(ERROR, "ESM-PROC - EPS bearer identifier %d is "
+ "not valid", *bid);
+ LOG_FUNC_RETURN (ESM_EBI_UNASSIGNED);
+ }
+
+ LOG_TRACE(WARNING, "ESM-PROC - Release EPS bearer context "
+ "(ebi=%d)", ebi);
+
+ /* Delete the TFT */
+ for (i = 0; i < pdn->bearer[*bid]->tft.n_pkfs; i++) {
+ free(pdn->bearer[*bid]->tft.pkf[i]);
+ }
+
+ /* Release the specified EPS bearer data */
+ free(pdn->bearer[*bid]);
+ pdn->bearer[*bid] = NULL;
+ /* Decrement the number of EPS bearer context allocated
+ * to the PDN connection */
+ pdn->n_bearers -= 1;
+ /* Decrement the total number of active EPS bearers */
+ esm_ctx->n_ebrs -= 1;
+
+ if (*bid == 0) {
+ /* 3GPP TS 24.301, section 6.4.4.3, 6.4.4.6
+ * If the EPS bearer identity is that of the default bearer to a
+ * PDN, the UE shall delete all EPS bearer contexts associated to
+ * that PDN connection.
+ */
+ for (i = 1; pdn->n_bearers > 0; i++) {
+ if (pdn->bearer[i]) {
+
+ LOG_TRACE(WARNING, "ESM-PROC - Release EPS bearer context "
+ "(ebi=%d)", pdn->bearer[i]->ebi);
+
+ /* Delete the TFT */
+ for (j = 0; j < pdn->bearer[i]->tft.n_pkfs; j++) {
+ free(pdn->bearer[i]->tft.pkf[j]);
+ }
+
+ /* Set the EPS bearer context state to INACTIVE */
+
+ (void) esm_ebr_set_status(ctx, pdn->bearer[i]->ebi,
+ ESM_EBR_INACTIVE, TRUE);
+
+ /* Release EPS bearer data */
+ (void) esm_ebr_release(ctx, pdn->bearer[i]->ebi);
+ // esm_ebr_release()
+ /* Release dedicated EPS bearer data */
+ free(pdn->bearer[i]);
+ pdn->bearer[i] = NULL;
+ /* Decrement the number of EPS bearer context allocated
+ * to the PDN connection */
+ pdn->n_bearers -= 1;
+ /* Decrement the total number of active EPS bearers */
+ esm_ctx->n_ebrs -= 1;
+ }
+ }
+
+ /* Reset the PDN connection activation indicator */
+ esm_ctx->pdn[*pid].is_active = FALSE;
+
+ /* Update the emergency bearer services indicator */
+ if (pdn->is_emergency) {
+ esm_ctx->emergency = FALSE;
+ }
+ }
+
+ if (esm_ctx->n_ebrs == 0) {
+ /* TODO: Release the PDN connection and marked the UE as inactive
+ * in the network for EPS services (is_attached = FALSE) */
+ }
+
+ LOG_FUNC_RETURN (ebi);
+ }
+
+ LOG_FUNC_RETURN (ESM_EBI_UNASSIGNED);
+}
+
+
+/****************************************************************************/
+/********************* L O C A L F U N C T I O N S *********************/
+/****************************************************************************/
+
+
diff --git a/openair-cn/NAS/MME/ESM/esm_ebr_context.h b/openair-cn/NAS/MME/ESM/esm_ebr_context.h
new file mode 100644
index 0000000000..c59661d768
--- /dev/null
+++ b/openair-cn/NAS/MME/ESM/esm_ebr_context.h
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+Source esm_ebr_context.h
+
+Version 0.1
+
+Date 2013/05/28
+
+Product NAS stack
+
+Subsystem EPS Session Management
+
+Author Frederic Maurel
+
+Description Defines functions used to handle EPS bearer contexts.
+
+*****************************************************************************/
+#ifndef __ESM_EBR_CONTEXT_H__
+#define __ESM_EBR_CONTEXT_H__
+
+#include "networkDef.h"
+
+/****************************************************************************/
+/********************* G L O B A L C O N S T A N T S *******************/
+/****************************************************************************/
+
+/****************************************************************************/
+/************************ G L O B A L T Y P E S ************************/
+/****************************************************************************/
+
+
+/****************************************************************************/
+/******************** G L O B A L V A R I A B L E S ********************/
+/****************************************************************************/
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+
+int esm_ebr_context_create(emm_data_context_t *ctx, int pid, int ebi, int is_default,
+ const network_qos_t *qos, const network_tft_t *tft);
+
+int esm_ebr_context_release(emm_data_context_t *ctx, int ebi, int *pid, int *bid);
+
+#endif /* __ESM_EBR_CONTEXT_H__ */
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/esm_ip.c b/openair-cn/NAS/MME/ESM/esm_ip.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/esm_ip.c
rename to openair-cn/NAS/MME/ESM/esm_ip.c
diff --git a/openair-cn/NAS/MME/ESM/esm_main.c b/openair-cn/NAS/MME/ESM/esm_main.c
new file mode 100644
index 0000000000..3e883527b9
--- /dev/null
+++ b/openair-cn/NAS/MME/ESM/esm_main.c
@@ -0,0 +1,134 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+Source esm_main.c
+
+Version 0.1
+
+Date 2012/12/04
+
+Product NAS stack
+
+Subsystem EPS Session Management
+
+Author Frederic Maurel
+
+Description Defines the EPS Session Management procedure call manager,
+ the main entry point for elementary ESM processing.
+
+*****************************************************************************/
+
+#include "esm_main.h"
+#include "commonDef.h"
+#include "nas_log.h"
+
+#include "emmData.h"
+#include "esmData.h"
+#include "esm_pt.h"
+#include "esm_ebr.h"
+
+/****************************************************************************/
+/**************** E X T E R N A L D E F I N I T I O N S ****************/
+/****************************************************************************/
+
+/****************************************************************************/
+/******************* L O C A L D E F I N I T I O N S *******************/
+/****************************************************************************/
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+
+/****************************************************************************
+ ** **
+ ** Name: esm_main_initialize() **
+ ** **
+ ** Description: Initializes ESM internal data **
+ ** **
+ ** Inputs: None **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: None **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+void esm_main_initialize(void)
+{
+ int i;
+
+ LOG_FUNC_IN;
+
+ /* Retreive MME supported configuration data */
+ if (mme_api_get_esm_config(&_esm_data.conf) != RETURNok) {
+ LOG_TRACE(ERROR, "ESM-MAIN - Failed to get MME configuration data");
+ }
+
+# if !defined(NAS_BUILT_IN_EPC)
+
+ /* Initialize ESM contexts */
+ for (i = 0; i < ESM_DATA_NB_UE_MAX; i++) {
+ _esm_data.ctx[i] = NULL;
+ }
+
+# endif
+
+ /* Initialize the EPS bearer context manager */
+ esm_ebr_initialize();
+
+ LOG_FUNC_OUT;
+}
+
+/****************************************************************************
+ ** **
+ ** Name: esm_main_cleanup() **
+ ** **
+ ** Description: Performs the EPS Session Management clean up procedure **
+ ** **
+ ** Inputs: None **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: None **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+void esm_main_cleanup(void)
+{
+ LOG_FUNC_IN;
+
+ LOG_FUNC_OUT;
+}
+
+
+/****************************************************************************/
+/********************* L O C A L F U N C T I O N S *********************/
+/****************************************************************************/
+
diff --git a/openair3/RAL-LTE/RAL-DUMMY/INCLUDE/eRALlte_subscribe.h b/openair-cn/NAS/MME/ESM/esm_main.h
similarity index 75%
rename from openair3/RAL-LTE/RAL-DUMMY/INCLUDE/eRALlte_subscribe.h
rename to openair-cn/NAS/MME/ESM/esm_main.h
index 4f649998ae..feb80c1c45 100644
--- a/openair3/RAL-LTE/RAL-DUMMY/INCLUDE/eRALlte_subscribe.h
+++ b/openair-cn/NAS/MME/ESM/esm_main.h
@@ -23,23 +23,31 @@
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@eurecom.fr
- Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
+ Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
*******************************************************************************/
-/*! \file eRALlte_subscribe.h
- * \brief
- * \author BRIZZOLA Davide, GAUTHIER Lionel, MAUREL Frederic, WETTERWALD Michelle
- * \date 2012
- * \version
- * \note
- * \bug
- * \warning
- */
+/*****************************************************************************
+Source esm_main.h
-#ifndef __RAL_LTE_SUBSCRIBE_H__
-#define __RAL_LTE_SUBSCRIBE_H__
+Version 0.1
-#include "MIH_C.h"
+Date 2012/12/04
+
+Product NAS stack
+
+Subsystem EPS Session Management
+
+Author Frederic Maurel
+
+Description Defines the EPS Session Management procedure call manager,
+ the main entry point for elementary ESM processing.
+
+*****************************************************************************/
+
+#ifndef __ESM_MAIN_H__
+#define __ESM_MAIN_H__
+
+#include "networkDef.h"
/****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/
@@ -57,8 +65,9 @@
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
-void eRALlte_subscribe_request(MIH_C_Message_Link_Event_Subscribe_request_t* msgP);
-void eRALlte_unsubscribe_request(MIH_C_Message_Link_Event_Unsubscribe_request_t* msgP);
+void esm_main_initialize(void);
+void esm_main_cleanup(void);
-#endif
+
+#endif /* __ESM_MAIN_H__*/
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/esm_proc.h b/openair-cn/NAS/MME/ESM/esm_proc.h
similarity index 73%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/esm_proc.h
rename to openair-cn/NAS/MME/ESM/esm_proc.h
index e44379a4df..3015be6543 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/esm/esm_proc.h
+++ b/openair-cn/NAS/MME/ESM/esm_proc.h
@@ -49,6 +49,7 @@ Description Defines the EPS Session Management procedures executed at
#include "networkDef.h"
#include "OctetString.h"
#include "emmData.h"
+#include "ProtocolConfigurationOptions.h"
/****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/
@@ -58,15 +59,9 @@ Description Defines the EPS Session Management procedures executed at
* ESM retransmission timers
* -------------------------
*/
-#ifdef NAS_UE
-#define T3482_DEFAULT_VALUE 8 /* PDN connectivity request */
-#define T3492_DEFAULT_VALUE 6 /* PDN disconnect request */
-#endif
-#ifdef NAS_MME
#define T3485_DEFAULT_VALUE 8 /* Activate EPS bearer request */
#define T3495_DEFAULT_VALUE 8 /* Deactivate EPS bearer request */
-#endif
/* Type of PDN address */
typedef enum {
@@ -90,12 +85,7 @@ typedef enum {
* Type of the ESM procedure callback executed when requested by the UE
* or initiated by the network
*/
-#ifdef NAS_UE
-typedef int (*esm_proc_procedure_t) (int, int, OctetString *, int);
-#endif
-#ifdef NAS_MME
typedef int (*esm_proc_procedure_t) (int, emm_data_context_t *, int, OctetString *, int);
-#endif
/* EPS bearer level QoS parameters */
typedef network_qos_t esm_proc_qos_t;
@@ -103,6 +93,8 @@ typedef network_qos_t esm_proc_qos_t;
/* Traffic Flow Template for packet filtering */
typedef network_tft_t esm_proc_tft_t;
+typedef ProtocolConfigurationOptions esm_proc_pco_t;
+
/* PDN connection and EPS bearer context data */
typedef struct {
OctetString apn;
@@ -110,6 +102,7 @@ typedef struct {
OctetString pdn_addr;
esm_proc_qos_t qos;
esm_proc_tft_t tft;
+ esm_proc_pco_t pco;
} esm_proc_data_t;
/****************************************************************************/
@@ -125,17 +118,11 @@ typedef struct {
* ESM status procedure
* --------------------------------------------------------------------------
*/
-#ifdef NAS_UE
-int esm_proc_status_ind(int pti, int ebi, int *esm_cause);
-int esm_proc_status(int is_standalone, int pti, OctetString *msg,
- int sent_by_ue);
-#endif
-#ifdef NAS_MME
+
int esm_proc_status_ind(emm_data_context_t *ctx, int pti, int ebi, int *esm_cause);
int esm_proc_status(int is_standalone, emm_data_context_t *ctx, int pti,
OctetString *msg, int sent_by_ue);
-#endif
/*
@@ -143,20 +130,7 @@ int esm_proc_status(int is_standalone, emm_data_context_t *ctx, int pti,
* PDN connectivity procedure
* --------------------------------------------------------------------------
*/
-#ifdef NAS_UE
-int esm_proc_pdn_connectivity(int cid, int to_define,
- esm_proc_pdn_type_t pdn_type, const OctetString *apn, int is_emergency,
- unsigned int *pti);
-int esm_proc_pdn_connectivity_request(int is_standalone, int pti,
- OctetString *msg, int sent_by_ue);
-int esm_proc_pdn_connectivity_accept(int pti, esm_proc_pdn_type_t pdn_type,
- const OctetString *pdn_address, const OctetString *apn, int *esm_cause);
-int esm_proc_pdn_connectivity_reject(int pti, int *esm_cause);
-int esm_proc_pdn_connectivity_complete(void);
-int esm_proc_pdn_connectivity_failure(int is_pending);
-#endif
-#ifdef NAS_MME
int esm_proc_pdn_connectivity_request(emm_data_context_t *ctx, int pti,
esm_proc_pdn_request_t request_type, OctetString *apn,
esm_proc_pdn_type_t pdn_type, OctetString *pdn_addr, esm_proc_qos_t *esm_qos,
@@ -165,36 +139,24 @@ int esm_proc_pdn_connectivity_request(emm_data_context_t *ctx, int pti,
int esm_proc_pdn_connectivity_reject(int is_standalone, emm_data_context_t *ctx,
int ebi, OctetString *msg, int ue_triggered);
int esm_proc_pdn_connectivity_failure(emm_data_context_t *ctx, int pid);
-#endif
/*
* --------------------------------------------------------------------------
* PDN disconnect procedure
* --------------------------------------------------------------------------
*/
-#ifdef NAS_UE
-int esm_proc_pdn_disconnect(int cid, unsigned int *pti, unsigned int *ebi);
-int esm_proc_pdn_disconnect_request(int is_standalone, int pti,
- OctetString *msg, int sent_by_ue);
-int esm_proc_pdn_disconnect_accept(int pti, int *esm_cause);
-int esm_proc_pdn_disconnect_reject(int pti, int *esm_cause);
-#endif
-
-#ifdef NAS_MME
int esm_proc_pdn_disconnect_request(emm_data_context_t *ctx, int pti, int *esm_cause);
int esm_proc_pdn_disconnect_accept(emm_data_context_t *ctx, int pid, int *esm_cause);
int esm_proc_pdn_disconnect_reject(int is_standalone, emm_data_context_t *ctx,
int ebi, OctetString *msg, int ue_triggered);
-#endif
/*
* --------------------------------------------------------------------------
* Default EPS bearer context activation procedure
* --------------------------------------------------------------------------
*/
-#ifdef NAS_MME
int esm_proc_default_eps_bearer_context(emm_data_context_t *ctx, int pid,
unsigned int *ebi, const esm_proc_qos_t *esm_qos, int *esm_cause);
int esm_proc_default_eps_bearer_context_request(int is_standalone,
@@ -205,26 +167,13 @@ int esm_proc_default_eps_bearer_context_accept(emm_data_context_t *ctx, int ebi,
int *esm_cause);
int esm_proc_default_eps_bearer_context_reject(emm_data_context_t *ctx, int ebi,
int *esm_cause);
-#endif
-#ifdef NAS_UE
-int esm_proc_default_eps_bearer_context_request(int pid, int ebi,
- const esm_proc_qos_t *esm_qos, int *esm_cause);
-int esm_proc_default_eps_bearer_context_complete(void);
-int esm_proc_default_eps_bearer_context_failure(void);
-
-int esm_proc_default_eps_bearer_context_accept(int is_standalone, int ebi,
- OctetString *msg, int ue_triggered);
-int esm_proc_default_eps_bearer_context_reject(int is_standalone, int ebi,
- OctetString *msg, int ue_triggered);
-#endif
/*
* --------------------------------------------------------------------------
* Dedicated EPS bearer context activation procedure
* --------------------------------------------------------------------------
*/
-#ifdef NAS_MME
int esm_proc_dedicated_eps_bearer_context(emm_data_context_t *ctx, int pid,
unsigned int *ebi, unsigned int *default_ebi, const esm_proc_qos_t *qos,
const esm_proc_tft_t *tft, int *esm_cause);
@@ -235,24 +184,13 @@ int esm_proc_dedicated_eps_bearer_context_accept(emm_data_context_t *ctx, int eb
int *esm_cause);
int esm_proc_dedicated_eps_bearer_context_reject(emm_data_context_t *ctx, int ebi,
int *esm_cause);
-#endif
-#ifdef NAS_UE
-int esm_proc_dedicated_eps_bearer_context_request(int ebi, int default_ebi,
- const esm_proc_qos_t *qos, const esm_proc_tft_t *tft, int *esm_cause);
-
-int esm_proc_dedicated_eps_bearer_context_accept(int is_standalone, int ebi,
- OctetString *msg, int ue_triggered);
-int esm_proc_dedicated_eps_bearer_context_reject(int is_standalone, int ebi,
- OctetString *msg, int ue_triggered);
-#endif
/*
* --------------------------------------------------------------------------
* EPS bearer context deactivation procedure
* --------------------------------------------------------------------------
*/
-#ifdef NAS_MME
int esm_proc_eps_bearer_context_deactivate(emm_data_context_t *ctx, int is_local,
int ebi, int *pid, int *bid,
int *esm_cause);
@@ -260,15 +198,7 @@ int esm_proc_eps_bearer_context_deactivate_request(int is_standalone,
emm_data_context_t *ctx, int ebi, OctetString *msg, int ue_triggered);
int esm_proc_eps_bearer_context_deactivate_accept(emm_data_context_t *ctx, int ebi,
int *esm_cause);
-#endif
-#ifdef NAS_UE
-int esm_proc_eps_bearer_context_deactivate(int is_local, int ebi, int *pid,
- int *bid);
-int esm_proc_eps_bearer_context_deactivate_request(int ebi, int *esm_cause);
-int esm_proc_eps_bearer_context_deactivate_accept(int is_standalone, int ebi,
- OctetString *msg, int ue_triggered);
-#endif
#endif /* __ESM_PROC_H__*/
diff --git a/openair-cn/NAS/MME/ESM/esm_pt.c b/openair-cn/NAS/MME/ESM/esm_pt.c
new file mode 100644
index 0000000000..d9e1be5150
--- /dev/null
+++ b/openair-cn/NAS/MME/ESM/esm_pt.c
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+Source esm_pt.c
+
+Version 0.1
+
+Date 2013/01/03
+
+Product NAS stack
+
+Subsystem EPS Session Management
+
+Author Frederic Maurel
+
+Description Defines functions used to handle ESM procedure transactions.
+
+*****************************************************************************/
+
+#include "esm_pt.h"
+
+
+/****************************************************************************/
+/**************** E X T E R N A L D E F I N I T I O N S ****************/
+/****************************************************************************/
+
+/*
+ * Minimal and maximal value of a procedure transaction identity:
+ * The Procedure Transaction Identity (PTI) identifies bi-directional
+ * messages flows
+ */
+#define ESM_PTI_MIN (PROCEDURE_TRANSACTION_IDENTITY_FIRST)
+#define ESM_PTI_MAX (PROCEDURE_TRANSACTION_IDENTITY_LAST)
+
+/****************************************************************************/
+/******************* L O C A L D E F I N I T I O N S *******************/
+/****************************************************************************/
+
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+
+
+/****************************************************************************
+ ** **
+ ** Name: esm_pt_is_reserved() **
+ ** **
+ ** Description: Check whether the given procedure transaction identity is **
+ ** a reserved value **
+ ** **
+ ** Inputs: pti: The identity of the procedure transaction **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: TRUE, FALSE **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int esm_pt_is_reserved(int pti)
+{
+ return ( (pti != ESM_PT_UNASSIGNED) && (pti > ESM_PTI_MAX) );
+}
+
+/****************************************************************************/
+/********************* L O C A L F U N C T I O N S *********************/
+/****************************************************************************/
+
diff --git a/openair3/RAL-LTE/RAL-DUMMY/INCLUDE/eRALlte_action.h b/openair-cn/NAS/MME/ESM/esm_pt.h
similarity index 74%
rename from openair3/RAL-LTE/RAL-DUMMY/INCLUDE/eRALlte_action.h
rename to openair-cn/NAS/MME/ESM/esm_pt.h
index fbb4e82d7c..2a2cf81202 100644
--- a/openair3/RAL-LTE/RAL-DUMMY/INCLUDE/eRALlte_action.h
+++ b/openair-cn/NAS/MME/ESM/esm_pt.h
@@ -23,33 +23,42 @@
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@eurecom.fr
- Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
+ Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
*******************************************************************************/
-/*! \file eRALlte_action.h
- * \brief
- * \author BRIZZOLA Davide, GAUTHIER Lionel, MAUREL Frederic, WETTERWALD Michelle
- * \date 2012
- * \version
- * \note
- * \bug
- * \warning
- */
+/*****************************************************************************
+Source esm_pt.h
-#ifndef __RAL_LTE_ACTION_H__
-#define __RAL_LTE_ACTION_H__
+Version 0.1
-#include "MIH_C_msg_codec.h"
-#include "MIH_C_Link_Messages.h"
+Date 2013/01/03
+
+Product NAS stack
+
+Subsystem EPS Session Management
+
+Author Frederic Maurel
+
+Description Defines functions used to handle ESM procedure transactions.
+
+*****************************************************************************/
+#ifndef __ESM_PT_H__
+#define __ESM_PT_H__
+
+#include "ProcedureTransactionIdentity.h"
/****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/
/****************************************************************************/
+/* Unassigned procedure transaction identity value */
+#define ESM_PT_UNASSIGNED (PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED)
+
/****************************************************************************/
/************************ G L O B A L T Y P E S ************************/
/****************************************************************************/
+
/****************************************************************************/
/******************** G L O B A L V A R I A B L E S ********************/
/****************************************************************************/
@@ -58,6 +67,8 @@
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
-void eRALlte_action_request(MIH_C_Message_Link_Action_request_t* messageP);
+int esm_pt_is_reserved(int pti);
-#endif
+
+
+#endif /* __ESM_PT_H__*/
diff --git a/openair-cn/NAS/EURECOM-NAS/src/MMEprocess.c b/openair-cn/NAS/MME/MMEprocess.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/MMEprocess.c
rename to openair-cn/NAS/MME/MMEprocess.c
diff --git a/openair-cn/NAS/nas_defs.h b/openair-cn/NAS/MME/nas_defs.h
similarity index 100%
rename from openair-cn/NAS/nas_defs.h
rename to openair-cn/NAS/MME/nas_defs.h
diff --git a/openair-cn/NAS/MME/nas_itti_messaging.c b/openair-cn/NAS/MME/nas_itti_messaging.c
new file mode 100644
index 0000000000..c22f408954
--- /dev/null
+++ b/openair-cn/NAS/MME/nas_itti_messaging.c
@@ -0,0 +1,211 @@
+/*******************************************************************************
+ 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 "intertask_interface.h"
+#include "nas_itti_messaging.h"
+#include "msc.h"
+
+
+#define TASK_ORIGIN TASK_NAS_MME
+
+
+#if defined(NAS_BUILT_IN_EPC)
+static const uint8_t emm_message_ids[] = {
+ ATTACH_REQUEST,
+ ATTACH_ACCEPT,
+ ATTACH_COMPLETE,
+ ATTACH_REJECT,
+ DETACH_REQUEST,
+ DETACH_ACCEPT,
+ TRACKING_AREA_UPDATE_REQUEST,
+ TRACKING_AREA_UPDATE_ACCEPT,
+ TRACKING_AREA_UPDATE_COMPLETE,
+ TRACKING_AREA_UPDATE_REJECT,
+ EXTENDED_SERVICE_REQUEST,
+ SERVICE_REQUEST,
+ SERVICE_REJECT,
+ GUTI_REALLOCATION_COMMAND,
+ GUTI_REALLOCATION_COMPLETE,
+ AUTHENTICATION_REQUEST,
+ AUTHENTICATION_RESPONSE,
+ AUTHENTICATION_REJECT,
+ AUTHENTICATION_FAILURE,
+ IDENTITY_REQUEST,
+ IDENTITY_RESPONSE,
+ SECURITY_MODE_COMMAND,
+ SECURITY_MODE_COMPLETE,
+ SECURITY_MODE_REJECT,
+ EMM_STATUS,
+ EMM_INFORMATION,
+ DOWNLINK_NAS_TRANSPORT,
+ UPLINK_NAS_TRANSPORT,
+ CS_SERVICE_NOTIFICATION,
+};
+
+static const uint8_t esm_message_ids[] = {
+ ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST,
+ ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT,
+ ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT,
+ ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST,
+ ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT,
+ ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT,
+ MODIFY_EPS_BEARER_CONTEXT_REQUEST,
+ MODIFY_EPS_BEARER_CONTEXT_ACCEPT,
+ MODIFY_EPS_BEARER_CONTEXT_REJECT,
+ DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST,
+ DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT,
+ PDN_CONNECTIVITY_REQUEST,
+ PDN_CONNECTIVITY_REJECT,
+ PDN_DISCONNECT_REQUEST,
+ PDN_DISCONNECT_REJECT,
+ BEARER_RESOURCE_ALLOCATION_REQUEST,
+ BEARER_RESOURCE_ALLOCATION_REJECT,
+ BEARER_RESOURCE_MODIFICATION_REQUEST,
+ BEARER_RESOURCE_MODIFICATION_REJECT,
+ ESM_INFORMATION_REQUEST,
+ ESM_INFORMATION_RESPONSE,
+ ESM_STATUS,
+};
+
+static int _nas_find_message_index(const uint8_t message_id, const uint8_t *message_ids, const int ids_number)
+{
+ int i;
+
+ for(i = 0; i < ids_number; i ++) {
+ if (message_id == message_ids[i]) {
+ return (2 + i);
+ }
+ }
+
+ return (1);
+}
+
+int nas_itti_plain_msg(const char *buffer, const nas_message_t *msg, const int length, const int down_link)
+{
+ MessageDef *message_p;
+ int data_length = length < NAS_DATA_LENGHT_MAX ? length : NAS_DATA_LENGHT_MAX;
+ int message_type = -1;
+ MessagesIds messageId_raw = -1;
+ MessagesIds messageId_plain = -1;
+
+ /* Define message ids */
+ if (msg->header.protocol_discriminator == EPS_MOBILITY_MANAGEMENT_MESSAGE) {
+ message_type = 0;
+ messageId_raw = down_link ? NAS_DL_EMM_RAW_MSG : NAS_UL_EMM_RAW_MSG;
+ messageId_plain = down_link ? NAS_DL_EMM_PLAIN_MSG : NAS_UL_EMM_PLAIN_MSG;
+ } else {
+ if (msg->header.protocol_discriminator == EPS_SESSION_MANAGEMENT_MESSAGE) {
+ message_type = 1;
+ messageId_raw = down_link ? NAS_DL_ESM_RAW_MSG : NAS_UL_ESM_RAW_MSG;
+ messageId_plain = down_link ? NAS_DL_ESM_PLAIN_MSG : NAS_UL_ESM_PLAIN_MSG;
+ }
+ }
+
+ if (message_type >= 0) {
+ /* Create and send the RAW message */
+ message_p = itti_alloc_new_message(TASK_ORIGIN, messageId_raw);
+
+ NAS_DL_EMM_RAW_MSG(message_p).lenght = length;
+ memset ((void *) &(NAS_DL_EMM_RAW_MSG(message_p).data), 0, NAS_DATA_LENGHT_MAX);
+ memcpy ((void *) &(NAS_DL_EMM_RAW_MSG(message_p).data), buffer, data_length);
+
+ itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
+
+ /* Create and send the plain message */
+ if (message_type == 0) {
+ message_p = itti_alloc_new_message(TASK_ORIGIN, messageId_plain);
+
+ NAS_DL_EMM_PLAIN_MSG(message_p).present = _nas_find_message_index(msg->plain.emm.header.message_type, emm_message_ids, sizeof(emm_message_ids) / sizeof(emm_message_ids[0]));
+ memcpy ((void *) &(NAS_DL_EMM_PLAIN_MSG(message_p).choice), &msg->plain.emm, sizeof (EMM_msg));
+ } else {
+ message_p = itti_alloc_new_message(TASK_ORIGIN, messageId_plain);
+
+ NAS_DL_ESM_PLAIN_MSG(message_p).present = _nas_find_message_index(msg->plain.esm.header.message_type, esm_message_ids, sizeof(esm_message_ids) / sizeof(esm_message_ids[0]));
+ memcpy ((void *) &(NAS_DL_ESM_PLAIN_MSG(message_p).choice), &msg->plain.esm, sizeof (ESM_msg));
+ }
+
+ return itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
+ }
+
+ return EXIT_FAILURE;
+}
+
+int nas_itti_protected_msg(const char *buffer, const nas_message_t *msg, const int length, const int down_link)
+{
+ MessageDef *message_p = NULL;
+
+ if (msg->header.protocol_discriminator == EPS_MOBILITY_MANAGEMENT_MESSAGE) {
+ message_p = itti_alloc_new_message(TASK_ORIGIN, down_link ? NAS_DL_EMM_PROTECTED_MSG : NAS_UL_EMM_PROTECTED_MSG);
+
+ memcpy ((void *) &(NAS_DL_EMM_PROTECTED_MSG(message_p).header), &msg->header, sizeof (nas_message_security_header_t));
+ NAS_DL_EMM_PROTECTED_MSG(message_p).present = _nas_find_message_index(msg->security_protected.plain.emm.header.message_type, emm_message_ids, sizeof(emm_message_ids) / sizeof(emm_message_ids[0]));
+ memcpy ((void *) &(NAS_DL_EMM_PROTECTED_MSG(message_p).choice), &msg->security_protected.plain.emm, sizeof (EMM_msg));
+ } else {
+ if (msg->header.protocol_discriminator == EPS_SESSION_MANAGEMENT_MESSAGE) {
+ message_p = itti_alloc_new_message(TASK_ORIGIN, down_link ? NAS_DL_ESM_PROTECTED_MSG : NAS_UL_ESM_PROTECTED_MSG);
+
+ memcpy ((void *) &(NAS_DL_ESM_PROTECTED_MSG(message_p).header), &msg->header, sizeof (nas_message_security_header_t));
+ NAS_DL_ESM_PROTECTED_MSG(message_p).present = _nas_find_message_index(msg->security_protected.plain.esm.header.message_type, esm_message_ids, sizeof(esm_message_ids) / sizeof(esm_message_ids[0]));
+ memcpy ((void *) &(NAS_DL_ESM_PROTECTED_MSG(message_p).choice), &msg->security_protected.plain.esm, sizeof (ESM_msg));
+ }
+ }
+
+ if (message_p != NULL) {
+ return itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
+ }
+
+ return EXIT_FAILURE;
+}
+#endif
+
+#if defined(NAS_BUILT_IN_EPC)
+int nas_itti_dl_data_req(const uint32_t ue_id, void *const data,
+ const uint32_t length)
+{
+ MessageDef *message_p;
+
+ message_p = itti_alloc_new_message(TASK_NAS_MME, NAS_DOWNLINK_DATA_REQ);
+
+ NAS_DL_DATA_REQ(message_p).UEid = ue_id;
+ NAS_DL_DATA_REQ(message_p).nasMsg.data = data;
+ NAS_DL_DATA_REQ(message_p).nasMsg.length = length;
+
+ MSC_LOG_TX_MESSAGE(
+ MSC_NAS_MME,
+ MSC_S1AP_MME,
+ NULL,0,
+ "0 NAS_DOWNLINK_DATA_REQ ue id "NAS_UE_ID_FMT" len %u", ue_id, length);
+
+ return itti_send_msg_to_task(TASK_S1AP, INSTANCE_DEFAULT, message_p);
+}
+
+#endif
+
+
diff --git a/openair-cn/NAS/nas_itti_messaging.h b/openair-cn/NAS/MME/nas_itti_messaging.h
similarity index 84%
rename from openair-cn/NAS/nas_itti_messaging.h
rename to openair-cn/NAS/MME/nas_itti_messaging.h
index b9d422a613..e18741f815 100644
--- a/openair-cn/NAS/nas_itti_messaging.h
+++ b/openair-cn/NAS/MME/nas_itti_messaging.h
@@ -38,7 +38,7 @@
#ifndef NAS_ITTI_MESSAGING_H_
#define NAS_ITTI_MESSAGING_H_
-# if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE)))
+# if defined(NAS_BUILT_IN_EPC)
int nas_itti_plain_msg(
const char *buffer,
const nas_message_t *msg,
@@ -52,7 +52,7 @@ int nas_itti_protected_msg(
const int instance);
# endif
-# if defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)
+# if defined(NAS_BUILT_IN_EPC)
#include "conversions.h"
int nas_itti_dl_data_req(
@@ -68,6 +68,8 @@ static inline void nas_itti_pdn_connectivity_req(
esm_proc_pdn_request_t request_typeP)
{
MessageDef *message_p = NULL;
+ uint8_t i;
+ uint8_t index;
AssertFatal(imsi_pP != NULL, "imsi_pP param is NULL");
AssertFatal(proc_data_pP != NULL, "proc_data_pP param is NULL");
@@ -125,6 +127,30 @@ static inline void nas_itti_pdn_connectivity_req(
NAS_PDN_CONNECTIVITY_REQ(message_p).request_type = request_typeP;
+ if (proc_data_pP->pco.num_protocol_id_or_container_id <= PROTOCOL_CONFIGURATION_OPTIONS_MAXIMUM_PROTOCOL_ID_OR_CONTAINER_ID) {
+ NAS_PDN_CONNECTIVITY_REQ(message_p).pco.byte[0] = ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_IEI;
+ NAS_PDN_CONNECTIVITY_REQ(message_p).pco.byte[1] = 1 + 3 * proc_data_pP->pco.num_protocol_id_or_container_id;
+ NAS_PDN_CONNECTIVITY_REQ(message_p).pco.byte[2] = 0x80; // do it fast
+ i = 0;
+ index = 3;
+ while (( i < proc_data_pP->pco.num_protocol_id_or_container_id) &&
+ ((index + proc_data_pP->pco.protocolidcontents[i].length) <= PROTOCOL_CONFIGURATION_OPTIONS_MAXIMUM_LENGTH)){
+ NAS_PDN_CONNECTIVITY_REQ(message_p).pco.byte[1] += proc_data_pP->pco.lengthofprotocolid[i];
+ NAS_PDN_CONNECTIVITY_REQ(message_p).pco.byte[index++] = (proc_data_pP->pco.protocolid[i] >> 8);
+ NAS_PDN_CONNECTIVITY_REQ(message_p).pco.byte[index++] = (proc_data_pP->pco.protocolid[i] & 0x00FF);
+ NAS_PDN_CONNECTIVITY_REQ(message_p).pco.byte[index++] = proc_data_pP->pco.lengthofprotocolid[i];
+ if (proc_data_pP->pco.lengthofprotocolid[i] > 0) {
+ memcpy( &NAS_PDN_CONNECTIVITY_REQ(message_p).pco.byte[index],
+ proc_data_pP->pco.protocolidcontents[i].value,
+ proc_data_pP->pco.lengthofprotocolid[i]);
+ index += proc_data_pP->pco.lengthofprotocolid[i];
+ }
+ i++;
+ }
+ NAS_PDN_CONNECTIVITY_REQ(message_p).pco.length = index;
+ }
+
+
MSC_LOG_TX_MESSAGE(
MSC_NAS_MME,
MSC_MMEAPP_MME,
@@ -253,13 +279,5 @@ static inline void nas_itti_establish_rej(
}
# endif
-# if defined(NAS_BUILT_IN_UE) && defined(NAS_UE)
-int nas_itti_cell_info_req(const plmn_t plmnID, const Byte_t rat);
-int nas_itti_nas_establish_req(as_cause_t cause, as_call_type_t type, as_stmsi_t s_tmsi, plmn_t plmnID, Byte_t *data_pP, UInt32_t lengthP);
-
-int nas_itti_ul_data_req(const uint32_t ue_idP, void *const data_pP, const uint32_t lengthP);
-
-int nas_itti_rab_establish_rsp(const as_stmsi_t s_tmsi, const as_rab_id_t rabID, const nas_error_code_t errCode);
-# endif
#endif /* NAS_ITTI_MESSAGING_H_ */
diff --git a/openair-cn/NAS/nas_main.c b/openair-cn/NAS/MME/nas_mme_task.c
similarity index 99%
rename from openair-cn/NAS/nas_main.c
rename to openair-cn/NAS/MME/nas_mme_task.c
index e2f9000285..88939f93c2 100644
--- a/openair-cn/NAS/nas_main.c
+++ b/openair-cn/NAS/MME/nas_mme_task.c
@@ -34,8 +34,8 @@
#include "intertask_interface.h"
#include "mme_config.h"
-
#include "nas_defs.h"
+#include "msc.h"
#if !defined(DISABLE_USE_NAS)
# include "nas_network.h"
@@ -52,6 +52,7 @@
static void *nas_intertask_interface(void *args_p)
{
itti_mark_task_ready(TASK_NAS_MME);
+ MSC_START_USE();
while(1) {
MessageDef *received_message_p;
diff --git a/openair-cn/NAS/MME/nas_network.c b/openair-cn/NAS/MME/nas_network.c
new file mode 100644
index 0000000000..0af3aa3425
--- /dev/null
+++ b/openair-cn/NAS/MME/nas_network.c
@@ -0,0 +1,208 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+Source nas_network.h
+
+Version 0.1
+
+Date 2012/09/20
+
+Product NAS stack
+
+Subsystem NAS main process
+
+Author Frederic Maurel
+
+Description NAS procedure functions triggered by the network
+
+*****************************************************************************/
+
+#include "nas_network.h"
+#include "commonDef.h"
+#include "nas_log.h"
+#include "nas_timer.h"
+
+#include "as_message.h"
+#include "nas_proc.h"
+
+/****************************************************************************/
+/**************** E X T E R N A L D E F I N I T I O N S ****************/
+/****************************************************************************/
+
+/****************************************************************************/
+/******************* L O C A L D E F I N I T I O N S *******************/
+/****************************************************************************/
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+/****************************************************************************
+ ** **
+ ** Name: nas_network_initialize() **
+ ** **
+ ** Description: Initializes network internal data **
+ ** **
+ ** Inputs: None **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: None **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+#if defined(NAS_BUILT_IN_EPC)
+void nas_network_initialize(mme_config_t *mme_config_p)
+#else
+void nas_network_initialize(void)
+#endif
+{
+ LOG_FUNC_IN;
+
+ /* Initialize the internal NAS processing data */
+# if defined(NAS_BUILT_IN_EPC)
+ nas_timer_init();
+ nas_proc_initialize(mme_config_p);
+# else
+ nas_proc_initialize();
+# endif
+
+ LOG_FUNC_OUT;
+}
+
+/****************************************************************************
+ ** **
+ ** Name: nas_network_cleanup() **
+ ** **
+ ** Description: Performs clean up procedure before the system is shutdown **
+ ** **
+ ** Inputs: None **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: None **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+void nas_network_cleanup(void)
+{
+ LOG_FUNC_IN;
+
+ nas_proc_cleanup();
+
+ LOG_FUNC_OUT;
+}
+
+/****************************************************************************
+ ** **
+ ** Name: nas_network_process_data() **
+ ** **
+ ** Description: Process Access Stratum messages received from the network **
+ ** and call applicable NAS procedure function. **
+ ** **
+ ** Inputs: msg_id: AS message identifier **
+ ** data: Generic pointer to data structure that has **
+ ** to be processed **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok if the message has been success- **
+ ** fully processed; RETURNerror otherwise **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int nas_network_process_data(int msg_id, const void *data)
+{
+ LOG_FUNC_IN;
+
+ const as_message_t *msg = (as_message_t *)(data);
+ int rc = RETURNok;
+
+ /* Sanity check */
+ if (msg_id != msg->msgID) {
+ LOG_TRACE(ERROR, "NET-MAIN - Message identifier 0x%x to process "
+ "is different from that of the network data (0x%x)",
+ msg_id, msg->msgID);
+ LOG_FUNC_RETURN (RETURNerror);
+ }
+
+ switch (msg_id) {
+
+
+ case AS_NAS_ESTABLISH_IND: {
+ /* Received NAS signalling connection establishment indication */
+ const nas_establish_ind_t *indication = &msg->msg.nas_establish_ind;
+ rc = nas_proc_establish_ind(indication->UEid,
+ indication->tac,
+ indication->initialNasMsg.data,
+ indication->initialNasMsg.length);
+ break;
+ }
+
+ case AS_DL_INFO_TRANSFER_CNF: {
+ const dl_info_transfer_cnf_t *info = &msg->msg.dl_info_transfer_cnf;
+
+ /* Received downlink data transfer confirm */
+ if (info->errCode != AS_SUCCESS) {
+ LOG_TRACE(WARNING, "NET-MAIN - "
+ "Downlink NAS message not delivered");
+ rc = nas_proc_dl_transfer_rej(info->UEid);
+ } else {
+ rc = nas_proc_dl_transfer_cnf(info->UEid);
+ }
+
+ break;
+ }
+
+ case AS_UL_INFO_TRANSFER_IND: {
+ const ul_info_transfer_ind_t *info = &msg->msg.ul_info_transfer_ind;
+ /* Received uplink data transfer indication */
+ rc = nas_proc_ul_transfer_ind(info->UEid,
+ info->nasMsg.data,
+ info->nasMsg.length);
+ break;
+ }
+
+ case AS_RAB_ESTABLISH_CNF:
+ break;
+
+ default:
+ LOG_TRACE(ERROR, "NET-MAIN - Unexpected AS message type: 0x%x",
+ msg_id);
+ rc = RETURNerror;
+ break;
+ }
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************/
+/********************* L O C A L F U N C T I O N S *********************/
+/****************************************************************************/
+
diff --git a/openair-cn/NAS/EURECOM-NAS/src/nas_network.h b/openair-cn/NAS/MME/nas_network.h
similarity index 96%
rename from openair-cn/NAS/EURECOM-NAS/src/nas_network.h
rename to openair-cn/NAS/MME/nas_network.h
index 193d98784a..ef235dcdb7 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/nas_network.h
+++ b/openair-cn/NAS/MME/nas_network.h
@@ -43,7 +43,7 @@ Description NAS procedure functions triggered by the network
*****************************************************************************/
-#if defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)
+#if defined(NAS_BUILT_IN_EPC)
# include "mme_config.h"
#endif
@@ -66,7 +66,7 @@ Description NAS procedure functions triggered by the network
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
-#if defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)
+#if defined(NAS_BUILT_IN_EPC)
void nas_network_initialize(mme_config_t *mme_config_p);
#else
void nas_network_initialize(void);
diff --git a/openair-cn/NAS/MME/nas_parser.c b/openair-cn/NAS/MME/nas_parser.c
new file mode 100644
index 0000000000..af87d1ce97
--- /dev/null
+++ b/openair-cn/NAS/MME/nas_parser.c
@@ -0,0 +1,243 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+Source nas_parser.c
+
+Version 0.1
+
+Date 2012/02/27
+
+Product NAS stack
+
+Subsystem NAS main process
+
+Author Frederic Maurel
+
+Description NAS command line parser
+
+*****************************************************************************/
+
+#include "nas_parser.h"
+#include "parser.h"
+
+#include // fprintf
+#include // atoi
+
+/****************************************************************************/
+/**************** E X T E R N A L D E F I N I T I O N S ****************/
+/****************************************************************************/
+
+/****************************************************************************/
+/******************* L O C A L D E F I N I T I O N S *******************/
+/****************************************************************************/
+
+/*
+ * Identifiers of the NAS command line options
+ */
+enum {
+ NAS_PARSER_TRACE_LEVEL, /* Logging trace level */
+ NAS_PARSER_NETWORK_HOST, /* Network layer's hostname */
+ NAS_PARSER_NETWORK_PORT, /* Network layer's port number */
+ NAS_PARSER_NB_OPTIONS
+};
+
+/* -----------------------------------------------------
+ * Definition of the internal NAS command line structure
+ * -----------------------------------------------------
+ * The command line is defined with a name (default is "NASprocess"
+ * but it will be replaced by the command name actually used at
+ * runtime), a number of options and the list of options.
+ * An option is defined with a name, an argument following the name,
+ * the usage displayed by the usage function and a default value.
+ */
+static parser_command_line_t nasParserCommandLine = {
+ "NASprocess", /* Command name */
+ NAS_PARSER_NB_OPTIONS, /* Number of options */
+ { /* Command line options */
+ {
+ "-trace", "", "Logging trace level\t\t",
+ NAS_PARSER_DEFAULT_TRACE_LEVEL
+ },
+ {
+ "-nhost", "", "Network layer's hostname\t",
+ NAS_PARSER_DEFAULT_NETWORK_HOSTNAME
+ },
+ {
+ "-nport", "", "Network layer's port number\t",
+ NAS_PARSER_DEFAULT_NETWORK_PORT_NUMBER
+ },
+ }
+};
+
+/*
+ * Converts a string, containing hexadecimal formatted integer, to an integer
+ */
+static int atohex(const char *a_char);
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+/****************************************************************************
+ ** **
+ ** Name: nas_parser_print_usage() **
+ ** **
+ ** Description: Displays the command line options used to run the NAS **
+ ** process and the firmware version defined at compilation **
+ ** time **
+ ** **
+ ** Inputs: version: Firmware version **
+ ** Others: None **
+ ** **
+ ** Outputs: Return: None **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+void nas_parser_print_usage(const char *version)
+{
+ parser_print_usage(&nasParserCommandLine);
+ fprintf(stderr, "Version: %s\n", version);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: nas_parser_get_options() **
+ ** **
+ ** Description: Gets the command line options used to run the NAS process **
+ ** **
+ ** Inputs: argc: Number of options **
+ ** argv: Pointer to the list of options **
+ ** Others: None **
+ ** **
+ ** Outputs: Return: RETURNerror, RETURNok **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int nas_parser_get_options(int argc, const char **argv)
+{
+ return parser_get_options(argc, argv, &nasParserCommandLine);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: nas_parser_get_nb_options() **
+ ** **
+ ** Description: Returns the number of the command line options used to **
+ ** run the NAS process **
+ ** **
+ ** Inputs: None **
+ ** Others: None **
+ ** **
+ ** Outputs: Return: Number of command line options **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int nas_parser_get_nb_options(void)
+{
+ return nasParserCommandLine.nb_options;
+}
+
+/****************************************************************************
+ ** **
+ ** Name: nas_parser_get_trace_level() **
+ ** **
+ ** Description: Returns the value of the logging trace level **
+ ** **
+ ** Inputs: None **
+ ** Others: None **
+ ** **
+ ** Outputs: Return: Value of the logging trace level **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int nas_parser_get_trace_level(void)
+{
+ return atohex( nasParserCommandLine.options[NAS_PARSER_TRACE_LEVEL].pvalue );
+}
+
+/****************************************************************************
+ ** **
+ ** Name: nas_parser_get_network_host() **
+ ** **
+ ** Description: Returns the value of the network layer hostname **
+ ** **
+ ** Inputs: None **
+ ** Others: None **
+ ** **
+ ** Outputs: Return: Value of the network layer hostname **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+const char *nas_parser_get_network_host(void)
+{
+ return nasParserCommandLine.options[NAS_PARSER_NETWORK_HOST].pvalue;
+}
+
+/****************************************************************************
+ ** **
+ ** Name: nas_parser_get_network_port() **
+ ** **
+ ** Description: Returns the value of the network layer port number **
+ ** **
+ ** Inputs: None **
+ ** Others: None **
+ ** **
+ ** Outputs: Return: Value of the network layer port number **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+const char *nas_parser_get_network_port(void)
+{
+ return nasParserCommandLine.options[NAS_PARSER_NETWORK_PORT].pvalue;
+}
+
+
+
+/****************************************************************************/
+/********************* L O C A L F U N C T I O N S *********************/
+/****************************************************************************/
+
+static int atohex(const char *a_char)
+{
+ int result;
+
+ for (result=0; a_char; a_char++) {
+ if (*a_char >= '0' && *a_char <= '9') {
+ result = (result << 4) + (*a_char - '0');
+ } else if (*a_char >= 'A' && *a_char <= 'F') {
+ result = (result << 4) + (*a_char - 'A' + 10);
+ } else if (*a_char >= 'a' && *a_char <= 'f') {
+ result = (result << 4) + (*a_char - 'a' + 10);
+ } else {
+ break;
+ }
+ }
+
+ return result;
+}
diff --git a/openair-cn/NAS/MME/nas_parser.h b/openair-cn/NAS/MME/nas_parser.h
new file mode 100644
index 0000000000..c536c1375c
--- /dev/null
+++ b/openair-cn/NAS/MME/nas_parser.h
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+Source nas_parser.h
+
+Version 0.1
+
+Date 2012/02/27
+
+Product NAS stack
+
+Subsystem NAS main process
+
+Author Frederic Maurel
+
+Description NAS command line parser
+
+*****************************************************************************/
+#ifndef __NAS_PARSER_H__
+#define __NAS_PARSER_H__
+
+/****************************************************************************/
+/********************* G L O B A L C O N S T A N T S *******************/
+/****************************************************************************/
+
+/* Logging trace level default value */
+#define NAS_PARSER_DEFAULT_TRACE_LEVEL "0" /* No trace */
+
+/* Network layer default hostname */
+#define NAS_PARSER_DEFAULT_NETWORK_HOSTNAME "localhost"
+
+/* Network layer default port number */
+#define NAS_PARSER_DEFAULT_NETWORK_PORT_NUMBER "12000"
+
+
+
+/****************************************************************************/
+/************************ G L O B A L T Y P E S ************************/
+/****************************************************************************/
+
+/****************************************************************************/
+/******************** G L O B A L V A R I A B L E S ********************/
+/****************************************************************************/
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+void nas_parser_print_usage(const char *version);
+int nas_parser_get_options(int argc, const char **argv);
+
+int nas_parser_get_nb_options(void);
+int nas_parser_get_trace_level(void);
+const char *nas_parser_get_network_host(void);
+const char *nas_parser_get_network_port(void);
+
+
+#endif /* __NAS_PARSER_H__*/
diff --git a/openair-cn/NAS/MME/nas_proc.c b/openair-cn/NAS/MME/nas_proc.c
new file mode 100644
index 0000000000..7fae146a89
--- /dev/null
+++ b/openair-cn/NAS/MME/nas_proc.c
@@ -0,0 +1,443 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+Source nas_proc.c
+
+Version 0.1
+
+Date 2012/09/20
+
+Product NAS stack
+
+Subsystem NAS main process
+
+Author Frederic Maurel
+
+Description NAS procedure call manager
+
+*****************************************************************************/
+
+#include "nas_proc.h"
+#include "nas_log.h"
+
+#include "emm_main.h"
+#include "emm_sap.h"
+
+#include "esm_main.h"
+#include "esm_sap.h"
+#include "msc.h"
+
+#include // sprintf
+
+/****************************************************************************/
+/**************** E X T E R N A L D E F I N I T I O N S ****************/
+/****************************************************************************/
+
+/****************************************************************************/
+/******************* L O C A L D E F I N I T I O N S *******************/
+/****************************************************************************/
+
+
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+/****************************************************************************
+ ** **
+ ** Name: nas_proc_initialize() **
+ ** **
+ ** Description: **
+ ** **
+ ** Inputs: None **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: None **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+# if defined(NAS_BUILT_IN_EPC)
+void nas_proc_initialize(mme_config_t *mme_config_p)
+{
+ LOG_FUNC_IN;
+
+ /* Initialize the EMM procedure manager */
+ emm_main_initialize(mme_config_p);
+
+ /* Initialize the ESM procedure manager */
+ esm_main_initialize();
+
+ LOG_FUNC_OUT;
+}
+# else
+void nas_proc_initialize(void)
+{
+ LOG_FUNC_IN;
+
+ /* Initialize the EMM procedure manager */
+ emm_main_initialize();
+
+ /* Initialize the ESM procedure manager */
+ esm_main_initialize();
+
+ LOG_FUNC_OUT;
+}
+# endif
+
+/****************************************************************************
+ ** **
+ ** Name: nas_proc_cleanup() **
+ ** **
+ ** Description: Performs clean up procedure before the system is shutdown **
+ ** **
+ ** Inputs: None **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: None **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+void nas_proc_cleanup(void)
+{
+ LOG_FUNC_IN;
+
+ /* Perform the EPS Mobility Manager's clean up procedure */
+ emm_main_cleanup();
+
+ /* Perform the EPS Session Manager's clean up procedure */
+ esm_main_cleanup();
+
+ LOG_FUNC_OUT;
+}
+
+/*
+ * --------------------------------------------------------------------------
+ * NAS procedures triggered by the user
+ * --------------------------------------------------------------------------
+ */
+
+
+/****************************************************************************
+ ** **
+ ** Name: nas_proc_establish_ind() **
+ ** **
+ ** Description: Processes the NAS signalling connection establishment **
+ ** indication message received from the network **
+ ** **
+ ** Inputs: ueid: UE identifier **
+ ** tac: The code of the tracking area the initia- **
+ ** ting UE belongs to **
+ ** data: The initial NAS message transfered within **
+ ** the message **
+ ** len: The length of the initial NAS message **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int nas_proc_establish_ind(uint32_t ueid, tac_t tac,
+ const Byte_t *data, uint32_t len)
+{
+ LOG_FUNC_IN;
+
+ int rc = RETURNerror;
+
+ if (len > 0) {
+ emm_sap_t emm_sap;
+
+ MSC_LOG_TX_MESSAGE(
+ MSC_NAS_MME,
+ MSC_NAS_EMM_MME,
+ NULL,0,
+ "0 EMMAS_ESTABLISH_REQ ue id "NAS_UE_ID_FMT" tac %u", ueid, tac);
+ /*
+ * Notify the EMM procedure call manager that NAS signalling
+ * connection establishment indication message has been received
+ * from the Access-Stratum sublayer
+ */
+ emm_sap.primitive = EMMAS_ESTABLISH_REQ;
+ emm_sap.u.emm_as.u.establish.ueid = ueid;
+ emm_sap.u.emm_as.u.establish.NASmsg.length = len;
+ emm_sap.u.emm_as.u.establish.NASmsg.value = (uint8_t *)data;
+ rc = emm_sap_send(&emm_sap);
+ }
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: nas_proc_dl_transfer_cnf() **
+ ** **
+ ** Description: Processes the downlink data transfer confirm message re- **
+ ** ceived from the network while NAS message has been succes-**
+ ** sfully delivered to the NAS sublayer on the receiver side.**
+ ** **
+ ** Inputs: ueid: UE identifier **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int nas_proc_dl_transfer_cnf(uint32_t ueid)
+{
+ LOG_FUNC_IN;
+
+ emm_sap_t emm_sap;
+ int rc;
+
+ MSC_LOG_TX_MESSAGE(
+ MSC_NAS_MME,
+ MSC_NAS_EMM_MME,
+ NULL,0,
+ "0 EMMAS_DATA_IND dl_transfer_conf ue id "NAS_UE_ID_FMT" ", ueid);
+
+ /*
+ * Notify the EMM procedure call manager that downlink NAS message
+ * has been successfully delivered to the NAS sublayer on the
+ * receiver side
+ */
+ emm_sap.primitive = EMMAS_DATA_IND;
+ emm_sap.u.emm_as.u.data.ueid = ueid;
+ emm_sap.u.emm_as.u.data.delivered = TRUE;
+ emm_sap.u.emm_as.u.data.NASmsg.length = 0;
+ rc = emm_sap_send(&emm_sap);
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: nas_proc_dl_transfer_rej() **
+ ** **
+ ** Description: Processes the downlink data transfer confirm message re- **
+ ** ceived from the network while NAS message has not been **
+ ** delivered to the NAS sublayer on the receiver side. **
+ ** **
+ ** Inputs: ueid: UE identifier **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int nas_proc_dl_transfer_rej(uint32_t ueid)
+{
+ LOG_FUNC_IN;
+
+ emm_sap_t emm_sap;
+ int rc;
+
+ MSC_LOG_TX_MESSAGE(
+ MSC_NAS_MME,
+ MSC_NAS_EMM_MME,
+ NULL,0,
+ "0 EMMAS_DATA_IND dl_transfer_reject ue id "NAS_UE_ID_FMT" ", ueid);
+
+ /*
+ * Notify the EMM procedure call manager that transmission
+ * failure of downlink NAS message indication has been received
+ * from lower layers
+ */
+ emm_sap.primitive = EMMAS_DATA_IND;
+ emm_sap.u.emm_as.u.data.ueid = ueid;
+ emm_sap.u.emm_as.u.data.delivered = FALSE;
+ emm_sap.u.emm_as.u.data.NASmsg.length = 0;
+ rc = emm_sap_send(&emm_sap);
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: nas_proc_ul_transfer_ind() **
+ ** **
+ ** Description: Processes uplink data transfer indication message recei- **
+ ** ved from the network **
+ ** **
+ ** Inputs: ueid: UE identifier **
+ ** data: The transfered NAS message **
+ ** len: The length of the NAS message **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int nas_proc_ul_transfer_ind(uint32_t ueid, const Byte_t *data, uint32_t len)
+{
+ int rc = RETURNerror;
+
+ LOG_FUNC_IN;
+
+ if (len > 0) {
+ emm_sap_t emm_sap;
+ /*
+ * Notify the EMM procedure call manager that data transfer
+ * indication has been received from the Access-Stratum sublayer
+ */
+ MSC_LOG_TX_MESSAGE(
+ MSC_NAS_MME,
+ MSC_NAS_EMM_MME,
+ NULL,0,
+ "0 EMMAS_DATA_IND ue id "NAS_UE_ID_FMT" len %u", ueid, len);
+
+ emm_sap.primitive = EMMAS_DATA_IND;
+ emm_sap.u.emm_as.u.data.ueid = ueid;
+ emm_sap.u.emm_as.u.data.delivered = TRUE;
+ emm_sap.u.emm_as.u.data.NASmsg.length = len;
+ emm_sap.u.emm_as.u.data.NASmsg.value = (uint8_t *)data;
+ rc = emm_sap_send(&emm_sap);
+ }
+
+ LOG_FUNC_RETURN (rc);
+}
+
+# if defined(NAS_BUILT_IN_EPC)
+int nas_proc_auth_param_res(emm_cn_auth_res_t *emm_cn_auth_res)
+{
+ int rc = RETURNerror;
+ emm_sap_t emm_sap;
+
+ LOG_FUNC_IN;
+
+ MSC_LOG_TX_MESSAGE(
+ MSC_NAS_MME,
+ MSC_NAS_EMM_MME,
+ NULL,0,
+ "0 EMMCN_AUTHENTICATION_PARAM_RES");
+
+ emm_sap.primitive = EMMCN_AUTHENTICATION_PARAM_RES;
+ emm_sap.u.emm_cn.u.auth_res = emm_cn_auth_res;
+
+ rc = emm_sap_send(&emm_sap);
+
+ LOG_FUNC_RETURN (rc);
+}
+
+int nas_proc_auth_param_fail(emm_cn_auth_fail_t *emm_cn_auth_fail)
+{
+ int rc = RETURNerror;
+ emm_sap_t emm_sap;
+
+ LOG_FUNC_IN;
+
+ MSC_LOG_TX_MESSAGE(
+ MSC_NAS_MME,
+ MSC_NAS_EMM_MME,
+ NULL,0,
+ "0 EMMCN_AUTHENTICATION_PARAM_FAIL");
+
+ emm_sap.primitive = EMMCN_AUTHENTICATION_PARAM_FAIL;
+ emm_sap.u.emm_cn.u.auth_fail = emm_cn_auth_fail;
+
+ rc = emm_sap_send(&emm_sap);
+
+ LOG_FUNC_RETURN (rc);
+}
+
+int nas_proc_deregister_ue(uint32_t ue_id)
+{
+ int rc = RETURNerror;
+ emm_sap_t emm_sap;
+
+ LOG_FUNC_IN;
+
+ MSC_LOG_TX_MESSAGE(
+ MSC_NAS_MME,
+ MSC_NAS_EMM_MME,
+ NULL,0,
+ "0 EMMCN_DEREGISTER_UE ue_id "NAS_UE_ID_FMT" ",ue_id);
+
+ emm_sap.primitive = EMMCN_DEREGISTER_UE;
+ emm_sap.u.emm_cn.u.deregister.UEid = ue_id;
+
+ rc = emm_sap_send(&emm_sap);
+
+ LOG_FUNC_RETURN (rc);
+}
+
+int nas_proc_pdn_connectivity_res(emm_cn_pdn_res_t *emm_cn_pdn_res)
+{
+ int rc = RETURNerror;
+ emm_sap_t emm_sap;
+
+ LOG_FUNC_IN;
+
+ MSC_LOG_TX_MESSAGE(
+ MSC_NAS_MME,
+ MSC_NAS_EMM_MME,
+ NULL,0,
+ "0 EMMCN_PDN_CONNECTIVITY_RES");
+
+ emm_sap.primitive = EMMCN_PDN_CONNECTIVITY_RES;
+ emm_sap.u.emm_cn.u.emm_cn_pdn_res = emm_cn_pdn_res;
+
+ rc = emm_sap_send(&emm_sap);
+
+ LOG_FUNC_RETURN (rc);
+}
+
+int nas_proc_pdn_connectivity_fail(emm_cn_pdn_fail_t *emm_cn_pdn_fail)
+{
+ int rc = RETURNerror;
+ emm_sap_t emm_sap;
+
+ LOG_FUNC_IN;
+
+ MSC_LOG_TX_MESSAGE(
+ MSC_NAS_MME,
+ MSC_NAS_EMM_MME,
+ NULL,0,
+ "0 EMMCN_PDN_CONNECTIVITY_FAIL");
+
+ emm_sap.primitive = EMMCN_PDN_CONNECTIVITY_FAIL;
+ emm_sap.u.emm_cn.u.emm_cn_pdn_fail = emm_cn_pdn_fail;
+
+ rc = emm_sap_send(&emm_sap);
+
+ LOG_FUNC_RETURN (rc);
+}
+
+
+
+# endif
+
+/****************************************************************************/
+/********************* L O C A L F U N C T I O N S *********************/
+/****************************************************************************/
+
diff --git a/openair-cn/NAS/MME/nas_proc.h b/openair-cn/NAS/MME/nas_proc.h
new file mode 100644
index 0000000000..a00060ed9d
--- /dev/null
+++ b/openair-cn/NAS/MME/nas_proc.h
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+Source nas_proc.h
+
+Version 0.1
+
+Date 2012/09/20
+
+Product NAS stack
+
+Subsystem NAS main process
+
+Author Frederic Maurel
+
+Description NAS procedure call manager
+
+*****************************************************************************/
+#ifndef __NAS_PROC_H__
+#define __NAS_PROC_H__
+
+#if defined(NAS_BUILT_IN_EPC)
+# include "mme_config.h"
+# include "emm_cnDef.h"
+#endif
+
+#include "commonDef.h"
+#include "networkDef.h"
+
+/****************************************************************************/
+/********************* G L O B A L C O N S T A N T S *******************/
+/****************************************************************************/
+
+/****************************************************************************/
+/************************ G L O B A L T Y P E S ************************/
+/****************************************************************************/
+
+/****************************************************************************/
+/******************** G L O B A L V A R I A B L E S ********************/
+/****************************************************************************/
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+
+# if defined(NAS_BUILT_IN_EPC)
+void nas_proc_initialize(mme_config_t *mme_config_p);
+# else
+void nas_proc_initialize(void);
+# endif
+
+void nas_proc_cleanup(void);
+
+/*
+ * --------------------------------------------------------------------------
+ * NAS procedures triggered by the user
+ * --------------------------------------------------------------------------
+ */
+
+
+/*
+ * --------------------------------------------------------------------------
+ * NAS procedures triggered by the network
+ * --------------------------------------------------------------------------
+ */
+
+
+
+int nas_proc_establish_ind(uint32_t ueid, tac_t tac, const Byte_t *data,
+ uint32_t len);
+
+int nas_proc_dl_transfer_cnf(uint32_t ueid);
+int nas_proc_dl_transfer_rej(uint32_t ueid);
+int nas_proc_ul_transfer_ind(uint32_t ueid, const Byte_t *data, uint32_t len);
+
+/*
+ * --------------------------------------------------------------------------
+ * NAS procedures triggered by the mme applicative layer
+ * --------------------------------------------------------------------------
+ */
+#if defined(NAS_BUILT_IN_EPC)
+int nas_proc_auth_param_res(emm_cn_auth_res_t *emm_cn_auth_res);
+int nas_proc_auth_param_fail(emm_cn_auth_fail_t *emm_cn_auth_fail);
+int nas_proc_deregister_ue(uint32_t ue_id);
+int nas_proc_pdn_connectivity_res(nas_pdn_connectivity_rsp_t *nas_pdn_connectivity_rsp);
+int nas_proc_pdn_connectivity_fail(nas_pdn_connectivity_fail_t *nas_pdn_connectivity_fail);
+#endif
+
+#endif /* __NAS_PROC_H__*/
diff --git a/openair-cn/NAS/Makefile.UE b/openair-cn/NAS/Makefile.UE
deleted file mode 100644
index 7700c683d0..0000000000
--- a/openair-cn/NAS/Makefile.UE
+++ /dev/null
@@ -1,341 +0,0 @@
-################################################################################
-# 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.
-#
-################################################################################
-PROJDIR = $(UE_NAS_DIR)/EURECOM-NAS
-
-include $(UE_NAS_DIR)/EURECOM-NAS/Makefile.inc
-
-libnas_INCLUDES = \
- -I$(OPENAIR2_DIR) \
- -I$(UE_NAS_DIR) \
- -I$(SRCDIR) \
- -I$(INCDIR) \
- -I$(UTILDIR) \
- -I$(USERAPIDIR) \
- -I$(NETAPIDIR) \
- -I$(EMMDIR) \
- -I$(EMMMSGDIR) \
- -I$(EMMSAPDIR) \
- -I$(ESMDIR) \
- -I$(ESMMSGDIR) \
- -I$(ESMSAPDIR) \
- -I$(MMEAPIDIR) \
- -I$(USIMAPIDIR) \
- -I$(IESDIR) \
- -I$(SECU_DIR) \
- -I$(OPENAIRCN_DIR)/COMMON \
- -I$(OPENAIRCN_DIR)/UTILS
-
-OUTDIR = $(UE_NAS_DIR)/ue_objs
-
-libnas_api_OBJS = \
- EURECOM-NAS/src/api/mme/mme_api.o \
- EURECOM-NAS/src/api/network/nas_message.o
-
-libnas_emm_OBJS = \
- EURECOM-NAS/src/emm/Attach.o \
- EURECOM-NAS/src/emm/Authentication.o \
- EURECOM-NAS/src/emm/Detach.o \
- EURECOM-NAS/src/emm/EmmCommon.o \
- EURECOM-NAS/src/emm/emm_data_ctx.o \
- EURECOM-NAS/src/emm/emm_main.o \
- EURECOM-NAS/src/emm/EmmStatusHdl.o \
- EURECOM-NAS/src/emm/Identification.o \
- EURECOM-NAS/src/emm/IdleMode.o \
- EURECOM-NAS/src/emm/LowerLayer.o \
- EURECOM-NAS/src/emm/SecurityModeControl.o \
- EURECOM-NAS/src/emm/ServiceRequestHdl.o \
- EURECOM-NAS/src/emm/TrackingAreaUpdate.o
-
-libnas_emm_msg_OBJS = \
- EURECOM-NAS/src/emm/msg/AttachAccept.o \
- EURECOM-NAS/src/emm/msg/AuthenticationFailure.o \
- EURECOM-NAS/src/emm/msg/CsServiceNotification.o \
- EURECOM-NAS/src/emm/msg/ExtendedServiceRequest.o \
- EURECOM-NAS/src/emm/msg/IdentityResponse.o \
- EURECOM-NAS/src/emm/msg/EmmInformation.o \
- EURECOM-NAS/src/emm/msg/ServiceReject.o \
- EURECOM-NAS/src/emm/msg/TrackingAreaUpdateReject.o \
- EURECOM-NAS/src/emm/msg/AttachComplete.o \
- EURECOM-NAS/src/emm/msg/AuthenticationReject.o \
- EURECOM-NAS/src/emm/msg/DetachAccept.o \
- EURECOM-NAS/src/emm/msg/GutiReallocationCommand.o \
- EURECOM-NAS/src/emm/msg/emm_msg.o \
- EURECOM-NAS/src/emm/msg/SecurityModeCommand.o \
- EURECOM-NAS/src/emm/msg/ServiceRequest.o \
- EURECOM-NAS/src/emm/msg/TrackingAreaUpdateRequest.o \
- EURECOM-NAS/src/emm/msg/AttachReject.o \
- EURECOM-NAS/src/emm/msg/AuthenticationRequest.o \
- EURECOM-NAS/src/emm/msg/DetachRequest.o \
- EURECOM-NAS/src/emm/msg/GutiReallocationComplete.o \
- EURECOM-NAS/src/emm/msg/SecurityModeComplete.o \
- EURECOM-NAS/src/emm/msg/TrackingAreaUpdateAccept.o \
- EURECOM-NAS/src/emm/msg/UplinkNasTransport.o \
- EURECOM-NAS/src/emm/msg/AttachRequest.o \
- EURECOM-NAS/src/emm/msg/AuthenticationResponse.o \
- EURECOM-NAS/src/emm/msg/DownlinkNasTransport.o \
- EURECOM-NAS/src/emm/msg/EmmStatus.o \
- EURECOM-NAS/src/emm/msg/IdentityRequest.o \
- EURECOM-NAS/src/emm/msg/SecurityModeReject.o \
- EURECOM-NAS/src/emm/msg/TrackingAreaUpdateComplete.o
-
-libnas_emm_sap_OBJS = \
- EURECOM-NAS/src/emm/sap/emm_as.o \
- EURECOM-NAS/src/emm/sap/emm_cn.o \
- EURECOM-NAS/src/emm/sap/EmmDeregisteredNoImsi.o \
- EURECOM-NAS/src/emm/sap/emm_reg.o \
- EURECOM-NAS/src/emm/sap/EmmRegisteredUpdateNeeded.o \
- EURECOM-NAS/src/emm/sap/EmmDeregisteredNormalService.o \
- EURECOM-NAS/src/emm/sap/emm_sap.o \
- EURECOM-NAS/src/emm/sap/EmmDeregisteredPlmnSearch.o \
- EURECOM-NAS/src/emm/sap/emm_esm.o \
- EURECOM-NAS/src/emm/sap/EmmRegisteredAttemptingToUpdate.o \
- EURECOM-NAS/src/emm/sap/emm_send.o \
- EURECOM-NAS/src/emm/sap/EmmCommonProcedureInitiated.o \
- EURECOM-NAS/src/emm/sap/EmmRegistered.o \
- EURECOM-NAS/src/emm/sap/EmmDeregisteredAttachNeeded.o \
- EURECOM-NAS/src/emm/sap/EmmRegisteredImsiDetachInitiated.o \
- EURECOM-NAS/src/emm/sap/EmmServiceRequestInitiated.o \
- EURECOM-NAS/src/emm/sap/EmmDeregisteredAttemptingToAttach.o \
- EURECOM-NAS/src/emm/sap/emm_fsm.o \
- EURECOM-NAS/src/emm/sap/EmmRegisteredInitiated.o \
- EURECOM-NAS/src/emm/sap/EmmTrackingAreaUpdatingInitiated.o \
- EURECOM-NAS/src/emm/sap/EmmDeregistered.o \
- EURECOM-NAS/src/emm/sap/EmmRegisteredLimitedService.o \
- EURECOM-NAS/src/emm/sap/EmmDeregisteredInitiated.o \
- EURECOM-NAS/src/emm/sap/EmmNull.o \
- EURECOM-NAS/src/emm/sap/EmmRegisteredNoCellAvailable.o \
- EURECOM-NAS/src/emm/sap/EmmDeregisteredLimitedService.o \
- EURECOM-NAS/src/emm/sap/emm_recv.o \
- EURECOM-NAS/src/emm/sap/EmmRegisteredNormalService.o \
- EURECOM-NAS/src/emm/sap/EmmDeregisteredNoCellAvailable.o \
- EURECOM-NAS/src/emm/sap/EmmRegisteredPlmnSearch.o
-
-libnas_esm_OBJS = \
- EURECOM-NAS/src/esm/esm_ebr_context.o \
- EURECOM-NAS/src/esm/PdnConnectivity.o \
- EURECOM-NAS/src/esm/esm_ebr.o \
- EURECOM-NAS/src/esm/EpsBearerContextDeactivation.o \
- EURECOM-NAS/src/esm/DefaultEpsBearerContextActivation.o \
- EURECOM-NAS/src/esm/DedicatedEpsBearerContextActivation.o \
- EURECOM-NAS/src/esm/PdnDisconnect.o \
- EURECOM-NAS/src/esm/EsmStatusHdl.o \
- EURECOM-NAS/src/esm/esm_main.o \
- EURECOM-NAS/src/esm/esm_pt.o \
- EURECOM-NAS/src/esm/esm_ip.o
-
-libnas_esm_msg_OBJS = \
- EURECOM-NAS/src/esm/msg/ModifyEpsBearerContextRequest.o \
- EURECOM-NAS/src/esm/msg/DeactivateEpsBearerContextRequest.o \
- EURECOM-NAS/src/esm/msg/BearerResourceAllocationReject.o \
- EURECOM-NAS/src/esm/msg/BearerResourceModificationRequest.o \
- EURECOM-NAS/src/esm/msg/ActivateDedicatedEpsBearerContextRequest.o \
- EURECOM-NAS/src/esm/msg/EsmInformationResponse.o \
- EURECOM-NAS/src/esm/msg/PdnDisconnectReject.o \
- EURECOM-NAS/src/esm/msg/ActivateDedicatedEpsBearerContextAccept.o \
- EURECOM-NAS/src/esm/msg/PdnDisconnectRequest.o \
- EURECOM-NAS/src/esm/msg/BearerResourceModificationReject.o \
- EURECOM-NAS/src/esm/msg/ActivateDefaultEpsBearerContextAccept.o \
- EURECOM-NAS/src/esm/msg/ActivateDedicatedEpsBearerContextReject.o \
- EURECOM-NAS/src/esm/msg/ModifyEpsBearerContextAccept.o \
- EURECOM-NAS/src/esm/msg/DeactivateEpsBearerContextAccept.o \
- EURECOM-NAS/src/esm/msg/esm_msg.o \
- EURECOM-NAS/src/esm/msg/EsmInformationRequest.o \
- EURECOM-NAS/src/esm/msg/ActivateDefaultEpsBearerContextRequest.o \
- EURECOM-NAS/src/esm/msg/ModifyEpsBearerContextReject.o \
- EURECOM-NAS/src/esm/msg/EsmStatus.o \
- EURECOM-NAS/src/esm/msg/PdnConnectivityReject.o \
- EURECOM-NAS/src/esm/msg/ActivateDefaultEpsBearerContextReject.o \
- EURECOM-NAS/src/esm/msg/PdnConnectivityRequest.o \
- EURECOM-NAS/src/esm/msg/BearerResourceAllocationRequest.o
-
-libnas_esm_sap_OBJS = \
- EURECOM-NAS/src/esm/sap/esm_recv.o \
- EURECOM-NAS/src/esm/sap/esm_send.o \
- EURECOM-NAS/src/esm/sap/esm_sap.o
-
-libnas_ies_OBJS = \
- EURECOM-NAS/src/ies/UeSecurityCapability.o \
- EURECOM-NAS/src/ies/SecurityHeaderType.o \
- EURECOM-NAS/src/ies/RadioPriority.o \
- EURECOM-NAS/src/ies/EpsAttachResult.o \
- EURECOM-NAS/src/ies/ImeisvRequest.o \
- EURECOM-NAS/src/ies/EmergencyNumberList.o \
- EURECOM-NAS/src/ies/SupportedCodecList.o \
- EURECOM-NAS/src/ies/EsmCause.o \
- EURECOM-NAS/src/ies/NetworkName.o \
- EURECOM-NAS/src/ies/AuthenticationResponseParameter.o \
- EURECOM-NAS/src/ies/Cli.o \
- EURECOM-NAS/src/ies/AccessPointName.o \
- EURECOM-NAS/src/ies/DaylightSavingTime.o \
- EURECOM-NAS/src/ies/LcsIndicator.o \
- EURECOM-NAS/src/ies/PagingIdentity.o \
- EURECOM-NAS/src/ies/EpsMobileIdentity.o \
- EURECOM-NAS/src/ies/GutiType.o \
- EURECOM-NAS/src/ies/NasKeySetIdentifier.o \
- EURECOM-NAS/src/ies/CsfbResponse.o \
- EURECOM-NAS/src/ies/PacketFlowIdentifier.o \
- EURECOM-NAS/src/ies/ApnAggregateMaximumBitRate.o \
- EURECOM-NAS/src/ies/EpsBearerContextStatus.o \
- EURECOM-NAS/src/ies/MobileIdentity.o \
- EURECOM-NAS/src/ies/AuthenticationFailureParameter.o \
- EURECOM-NAS/src/ies/EpsUpdateResult.o \
- EURECOM-NAS/src/ies/TimeZone.o \
- EURECOM-NAS/src/ies/MessageType.o \
- EURECOM-NAS/src/ies/EmmCause.o \
- EURECOM-NAS/src/ies/MobileStationClassmark2.o \
- EURECOM-NAS/src/ies/AuthenticationParameterRand.o \
- EURECOM-NAS/src/ies/PdnAddress.o \
- EURECOM-NAS/src/ies/MobileStationClassmark3.o \
- EURECOM-NAS/src/ies/ServiceType.o \
- EURECOM-NAS/src/ies/NasRequestType.o \
- EURECOM-NAS/src/ies/PlmnList.o \
- EURECOM-NAS/src/ies/EpsQualityOfService.o \
- EURECOM-NAS/src/ies/NasMessageContainer.o \
- EURECOM-NAS/src/ies/EsmInformationTransferFlag.o \
- EURECOM-NAS/src/ies/TrafficFlowTemplate.o \
- EURECOM-NAS/src/ies/LinkedEpsBearerIdentity.o \
- EURECOM-NAS/src/ies/NasSecurityAlgorithms.o \
- EURECOM-NAS/src/ies/LlcServiceAccessPointIdentifier.o \
- EURECOM-NAS/src/ies/ShortMac.o \
- EURECOM-NAS/src/ies/TrafficFlowAggregateDescription.o \
- EURECOM-NAS/src/ies/PTmsiSignature.o \
- EURECOM-NAS/src/ies/ProtocolDiscriminator.o \
- EURECOM-NAS/src/ies/EpsBearerIdentity.o \
- EURECOM-NAS/src/ies/TimeZoneAndTime.o \
- EURECOM-NAS/src/ies/TrackingAreaIdentityList.o \
- EURECOM-NAS/src/ies/QualityOfService.o \
- EURECOM-NAS/src/ies/EpsUpdateType.o \
- EURECOM-NAS/src/ies/PdnType.o \
- EURECOM-NAS/src/ies/UeRadioCapabilityInformationUpdateNeeded.o \
- EURECOM-NAS/src/ies/AuthenticationParameterAutn.o \
- EURECOM-NAS/src/ies/EpsAttachType.o \
- EURECOM-NAS/src/ies/IdentityType2.o \
- EURECOM-NAS/src/ies/LcsClientIdentity.o \
- EURECOM-NAS/src/ies/DetachType.o \
- EURECOM-NAS/src/ies/LocationAreaIdentification.o \
- EURECOM-NAS/src/ies/TrackingAreaIdentity.o \
- EURECOM-NAS/src/ies/CipheringKeySequenceNumber.o \
- EURECOM-NAS/src/ies/MsNetworkCapability.o \
- EURECOM-NAS/src/ies/UeNetworkCapability.o \
- EURECOM-NAS/src/ies/ProtocolConfigurationOptions.o \
- EURECOM-NAS/src/ies/AdditionalUpdateType.o \
- EURECOM-NAS/src/ies/TmsiStatus.o \
- EURECOM-NAS/src/ies/EsmMessageContainer.o \
- EURECOM-NAS/src/ies/Nonce.o \
- EURECOM-NAS/src/ies/ProcedureTransactionIdentity.o \
- EURECOM-NAS/src/ies/TransactionIdentifier.o \
- EURECOM-NAS/src/ies/AdditionalUpdateResult.o \
- EURECOM-NAS/src/ies/GprsTimer.o \
- EURECOM-NAS/src/ies/EpsNetworkFeatureSupport.o \
- EURECOM-NAS/src/ies/SsCode.o \
- EURECOM-NAS/src/ies/DrxParameter.o \
- EURECOM-NAS/src/ies/KsiAndSequenceNumber.o \
- EURECOM-NAS/src/ies/VoiceDomainPreferenceAndUeUsageSetting.o
-
-libnas_utils_OBJS = \
- EURECOM-NAS/src/util/device.o \
- EURECOM-NAS/src/util/memory.o \
- EURECOM-NAS/src/util/nas_log.o \
- EURECOM-NAS/src/util/nas_timer.o \
- EURECOM-NAS/src/util/socket.o \
- EURECOM-NAS/src/util/stty.o \
- EURECOM-NAS/src/util/TLVEncoder.o \
- EURECOM-NAS/src/util/TLVDecoder.o \
- EURECOM-NAS/src/util/OctetString.o
-
-libnas_user_OBJS = \
- EURECOM-NAS/src/api/user/user_api.o \
- EURECOM-NAS/src/api/user/user_indication.o \
- EURECOM-NAS/src/api/user/at_command.o \
- EURECOM-NAS/src/api/user/at_error.o \
- EURECOM-NAS/src/api/user/at_response.o
-
-libnas_usim_OBJS = \
- EURECOM-NAS/src/api/usim/aka_functions.o \
- EURECOM-NAS/src/api/usim/usim_api.o
-
-libnas_OBJS = \
- nas_ue_task.o \
- nas_itti_messaging.o \
- EURECOM-NAS/src/nas_parser.o \
- EURECOM-NAS/src/nas_proc.o \
- EURECOM-NAS/src/nas_user.o \
- $(libnas_utils_OBJS) \
- $(libnas_user_OBJS) \
- $(libnas_usim_OBJS) \
- $(libnas_emm_OBJS) \
- $(libnas_emm_msg_OBJS) \
- $(libnas_emm_sap_OBJS) \
- $(libnas_esm_OBJS) \
- $(libnas_esm_msg_OBJS) \
- $(libnas_esm_sap_OBJS) \
- $(libnas_ies_OBJS) \
- $(libnas_api_OBJS)
-
-NAS_UE_COMPILED_OBJS = $(addprefix $(OUTDIR)/,$(libnas_OBJS))
-
-# pull in dependency info for *existing* .o files
--include $(NAS_UE_COMPILED_OBJS:.o=.d)
-
-CFLAGS = \
- -g \
- -Wall \
- -DNAS_UE \
- -DNAS_BUILT_IN_UE \
- -Wuninitialized \
- -Werror=implicit-function-declaration \
- $(UENAS_CFLAGS) \
- $(libnas_INCLUDES)
-
-.SECONDEXPANSION:
-$(NAS_UE_COMPILED_OBJS): %.o : $$(subst $(OUTDIR), $(UE_NAS_DIR), $$*.c)
- @echo "Compiling $<"
- @if [ ! -d $(dir $@) ]; then mkdir -p $(dir $@); fi;
- @$(CC) -c $(CFLAGS) -o $@ $<
- @$(CC) -MM $(CFLAGS) $< > $(basename $@).d
- @mv -f $(basename $@).d $(basename $@).d.tmp
- @sed -e 's|.*:|$@:|' < $(basename $@).d.tmp > $(basename $@).d
- @sed -e 's/.*://' -e 's/\\$$//' < $(basename $@).d.tmp | fmt -1 | \
- sed -e 's/^ *//' -e 's/$$/:/' >> $(basename $@).d
- @rm -f $(basename $@).d.tmp
-
-$(OUTDIR)/libuenas.a: $(NAS_UE_COMPILED_OBJS)
- @echo Creating UE_NAS archive
- @$(AR) rcs $@ $(addprefix $(OUTDIR)/,$(libnas_OBJS))
-
-clean:
- @$(RM_F_V) -r $(OUTDIR)/*.o
- @$(RM_F_V) -r $(OUTDIR)/*.d
- @$(RM_F_V) $(OUTDIR)/libuenas.a
-
-cleanall:
- @$(RM_F_V) -r $(OUTDIR)
-
-showcflags:
- @echo uenas cflags: $(CFLAGS)
diff --git a/openair-cn/NAS/Makefile.am b/openair-cn/NAS/Makefile.am
deleted file mode 100644
index 4e71ef5e72..0000000000
--- a/openair-cn/NAS/Makefile.am
+++ /dev/null
@@ -1,67 +0,0 @@
-################################################################################
-# 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.
-#
-################################################################################
-noinst_LTLIBRARIES = libnas.la
-
-libnas_la_LDFLAGS = -all-static
-
-AM_CFLAGS = \
- @ADD_CFLAGS@ \
- -DNAS_MME \
- -DNAS_BUILT_IN_EPC \
- -DENABLE_ITTI \
- -I$(top_srcdir)/COMMON \
- -I$(top_srcdir)/SECU \
- -I$(top_srcdir)/INTERTASK_INTERFACE \
- -I$(top_srcdir)/NAS/EURECOM-NAS/src/api/user \
- -I$(top_srcdir)/NAS/EURECOM-NAS/src/api/mme \
- -I$(top_srcdir)/NAS/EURECOM-NAS/src/api/network \
- -I$(top_srcdir)/NAS/EURECOM-NAS/src/emm/msg \
- -I$(top_srcdir)/NAS/EURECOM-NAS/src/emm/sap \
- -I$(top_srcdir)/NAS/EURECOM-NAS/src/emm \
- -I$(top_srcdir)/NAS/EURECOM-NAS/src/esm/msg \
- -I$(top_srcdir)/NAS/EURECOM-NAS/src/esm/sap/msg \
- -I$(top_srcdir)/NAS/EURECOM-NAS/src/esm/sap \
- -I$(top_srcdir)/NAS/EURECOM-NAS/src/esm \
- -I$(top_srcdir)/NAS/EURECOM-NAS/src/ies \
- -I$(top_srcdir)/NAS/EURECOM-NAS/src/include \
- -I$(top_srcdir)/NAS/EURECOM-NAS/src/util \
- -I$(top_srcdir)/NAS/EURECOM-NAS/src/ \
- -I$(top_srcdir)/UTILS
-
-if DISABLE_USE_NAS
-libnas_la_SOURCES = \
- nas_main.c
-else
-include Makefile.inc
-libnas_la_SOURCES = \
- nas_main.c \
- nas_itti_messaging.c \
- nas_itti_messaging.h \
- $(libnas_SRCS)
-endif
\ No newline at end of file
diff --git a/openair-cn/NAS/Makefile.inc b/openair-cn/NAS/Makefile.inc
deleted file mode 100644
index d4518ae573..0000000000
--- a/openair-cn/NAS/Makefile.inc
+++ /dev/null
@@ -1,429 +0,0 @@
-################################################################################
-# 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.
-#
-################################################################################
-libnas_api_SRCS = \
- EURECOM-NAS/src/api/mme/mme_api.c \
- EURECOM-NAS/src/api/mme/mme_api.h \
- EURECOM-NAS/src/api/network/nas_message.c \
- EURECOM-NAS/src/api/network/nas_message.h
-
-libnas_emm_SRCS = \
- EURECOM-NAS/src/emm/Attach.c \
- EURECOM-NAS/src/emm/Authentication.c \
- EURECOM-NAS/src/emm/Detach.c \
- EURECOM-NAS/src/emm/EmmCommon.c \
- EURECOM-NAS/src/emm/EmmCommon.h \
- EURECOM-NAS/src/emm/emmData.h \
- EURECOM-NAS/src/emm/emm_data_ctx.c \
- EURECOM-NAS/src/emm/emm_main.c \
- EURECOM-NAS/src/emm/emm_main.h \
- EURECOM-NAS/src/emm/emm_proc.h \
- EURECOM-NAS/src/emm/EmmStatusHdl.c \
- EURECOM-NAS/src/emm/Identification.c \
- EURECOM-NAS/src/emm/IdleMode.c \
- EURECOM-NAS/src/emm/IdleMode.h \
- EURECOM-NAS/src/emm/LowerLayer.c \
- EURECOM-NAS/src/emm/LowerLayer.h \
- EURECOM-NAS/src/emm/SecurityModeControl.c \
- EURECOM-NAS/src/emm/ServiceRequestHdl.c \
- EURECOM-NAS/src/emm/TrackingAreaUpdate.c
-
-libnas_emm_msg_SRCS = \
- EURECOM-NAS/src/emm/msg/AttachAccept.c \
- EURECOM-NAS/src/emm/msg/AuthenticationFailure.c \
- EURECOM-NAS/src/emm/msg/CsServiceNotification.c \
- EURECOM-NAS/src/emm/msg/emm_cause.h \
- EURECOM-NAS/src/emm/msg/ExtendedServiceRequest.c \
- EURECOM-NAS/src/emm/msg/IdentityResponse.c \
- EURECOM-NAS/src/emm/msg/SecurityModeReject.h \
- EURECOM-NAS/src/emm/msg/TrackingAreaUpdateComplete.h \
- EURECOM-NAS/src/emm/msg/AttachAccept.h \
- EURECOM-NAS/src/emm/msg/AuthenticationFailure.h \
- EURECOM-NAS/src/emm/msg/CsServiceNotification.h \
- EURECOM-NAS/src/emm/msg/EmmInformation.c \
- EURECOM-NAS/src/emm/msg/ExtendedServiceRequest.h \
- EURECOM-NAS/src/emm/msg/IdentityResponse.h \
- EURECOM-NAS/src/emm/msg/ServiceReject.c \
- EURECOM-NAS/src/emm/msg/TrackingAreaUpdateReject.c \
- EURECOM-NAS/src/emm/msg/AttachComplete.c \
- EURECOM-NAS/src/emm/msg/AuthenticationReject.c \
- EURECOM-NAS/src/emm/msg/DetachAccept.c \
- EURECOM-NAS/src/emm/msg/EmmInformation.h \
- EURECOM-NAS/src/emm/msg/GutiReallocationCommand.c \
- EURECOM-NAS/src/emm/msg/ServiceReject.h \
- EURECOM-NAS/src/emm/msg/TrackingAreaUpdateReject.h \
- EURECOM-NAS/src/emm/msg/AttachComplete.h \
- EURECOM-NAS/src/emm/msg/AuthenticationReject.h \
- EURECOM-NAS/src/emm/msg/DetachAccept.h \
- EURECOM-NAS/src/emm/msg/emm_msg.c \
- EURECOM-NAS/src/emm/msg/GutiReallocationCommand.h \
- EURECOM-NAS/src/emm/msg/SecurityModeCommand.c \
- EURECOM-NAS/src/emm/msg/ServiceRequest.c \
- EURECOM-NAS/src/emm/msg/TrackingAreaUpdateRequest.c \
- EURECOM-NAS/src/emm/msg/AttachReject.c \
- EURECOM-NAS/src/emm/msg/AuthenticationRequest.c \
- EURECOM-NAS/src/emm/msg/DetachRequest.c \
- EURECOM-NAS/src/emm/msg/emm_msgDef.h \
- EURECOM-NAS/src/emm/msg/GutiReallocationComplete.c \
- EURECOM-NAS/src/emm/msg/NASSecurityModeCommand.h \
- EURECOM-NAS/src/emm/msg/ServiceRequest.h \
- EURECOM-NAS/src/emm/msg/TrackingAreaUpdateRequest.h \
- EURECOM-NAS/src/emm/msg/AttachReject.h \
- EURECOM-NAS/src/emm/msg/AuthenticationRequest.h \
- EURECOM-NAS/src/emm/msg/DetachRequest.h \
- EURECOM-NAS/src/emm/msg/emm_msg.h \
- EURECOM-NAS/src/emm/msg/GutiReallocationComplete.h \
- EURECOM-NAS/src/emm/msg/SecurityModeComplete.c \
- EURECOM-NAS/src/emm/msg/TrackingAreaUpdateAccept.c \
- EURECOM-NAS/src/emm/msg/UplinkNasTransport.c \
- EURECOM-NAS/src/emm/msg/AttachRequest.c \
- EURECOM-NAS/src/emm/msg/AuthenticationResponse.c \
- EURECOM-NAS/src/emm/msg/DownlinkNasTransport.c \
- EURECOM-NAS/src/emm/msg/EmmStatus.c \
- EURECOM-NAS/src/emm/msg/IdentityRequest.c \
- EURECOM-NAS/src/emm/msg/NASSecurityModeComplete.h \
- EURECOM-NAS/src/emm/msg/TrackingAreaUpdateAccept.h \
- EURECOM-NAS/src/emm/msg/UplinkNasTransport.h \
- EURECOM-NAS/src/emm/msg/AttachRequest.h \
- EURECOM-NAS/src/emm/msg/AuthenticationResponse.h \
- EURECOM-NAS/src/emm/msg/DownlinkNasTransport.h \
- EURECOM-NAS/src/emm/msg/EmmStatus.h \
- EURECOM-NAS/src/emm/msg/IdentityRequest.h \
- EURECOM-NAS/src/emm/msg/SecurityModeReject.c \
- EURECOM-NAS/src/emm/msg/TrackingAreaUpdateComplete.c
-
-libnas_emm_sap_SRCS = \
- EURECOM-NAS/src/emm/sap/emm_as.c \
- EURECOM-NAS/src/emm/sap/emm_cn.c \
- EURECOM-NAS/src/emm/sap/emm_cn.h \
- EURECOM-NAS/src/emm/sap/EmmDeregisteredNoImsi.c \
- EURECOM-NAS/src/emm/sap/emm_reg.c \
- EURECOM-NAS/src/emm/sap/EmmRegisteredUpdateNeeded.c \
- EURECOM-NAS/src/emm/sap/emm_asDef.h \
- EURECOM-NAS/src/emm/sap/EmmDeregisteredNormalService.c \
- EURECOM-NAS/src/emm/sap/emm_regDef.h \
- EURECOM-NAS/src/emm/sap/emm_sap.c \
- EURECOM-NAS/src/emm/sap/EmmDeregisteredPlmnSearch.c \
- EURECOM-NAS/src/emm/sap/emm_reg.h \
- EURECOM-NAS/src/emm/sap/emm_sap.h \
- EURECOM-NAS/src/emm/sap/emm_as.h \
- EURECOM-NAS/src/emm/sap/emm_esm.c \
- EURECOM-NAS/src/emm/sap/EmmRegisteredAttemptingToUpdate.c \
- EURECOM-NAS/src/emm/sap/emm_send.c \
- EURECOM-NAS/src/emm/sap/EmmCommonProcedureInitiated.c \
- EURECOM-NAS/src/emm/sap/emm_esmDef.h \
- EURECOM-NAS/src/emm/sap/EmmRegistered.c \
- EURECOM-NAS/src/emm/sap/emm_send.h \
- EURECOM-NAS/src/emm/sap/EmmDeregisteredAttachNeeded.c \
- EURECOM-NAS/src/emm/sap/emm_esm.h \
- EURECOM-NAS/src/emm/sap/EmmRegisteredImsiDetachInitiated.c \
- EURECOM-NAS/src/emm/sap/EmmServiceRequestInitiated.c \
- EURECOM-NAS/src/emm/sap/EmmDeregisteredAttemptingToAttach.c \
- EURECOM-NAS/src/emm/sap/emm_fsm.c \
- EURECOM-NAS/src/emm/sap/EmmRegisteredInitiated.c \
- EURECOM-NAS/src/emm/sap/EmmTrackingAreaUpdatingInitiated.c \
- EURECOM-NAS/src/emm/sap/EmmDeregistered.c \
- EURECOM-NAS/src/emm/sap/emm_fsm.h \
- EURECOM-NAS/src/emm/sap/EmmRegisteredLimitedService.c \
- EURECOM-NAS/src/emm/sap/EmmDeregisteredInitiated.c \
- EURECOM-NAS/src/emm/sap/EmmNull.c \
- EURECOM-NAS/src/emm/sap/EmmRegisteredNoCellAvailable.c \
- EURECOM-NAS/src/emm/sap/EmmDeregisteredLimitedService.c \
- EURECOM-NAS/src/emm/sap/emm_recv.c \
- EURECOM-NAS/src/emm/sap/EmmRegisteredNormalService.c \
- EURECOM-NAS/src/emm/sap/EmmDeregisteredNoCellAvailable.c \
- EURECOM-NAS/src/emm/sap/emm_recv.h \
- EURECOM-NAS/src/emm/sap/EmmRegisteredPlmnSearch.c
-
-libnas_esm_SRCS = \
- EURECOM-NAS/src/esm/esm_ebr_context.c \
- EURECOM-NAS/src/esm/PdnConnectivity.c \
- EURECOM-NAS/src/esm/sap/esm_recv.c \
- EURECOM-NAS/src/esm/sap/esm_send.c \
- EURECOM-NAS/src/esm/sap/esm_sap.c \
- EURECOM-NAS/src/esm/esm_ebr.c \
- EURECOM-NAS/src/esm/EpsBearerContextDeactivation.c \
- EURECOM-NAS/src/esm/DefaultEpsBearerContextActivation.c \
- EURECOM-NAS/src/esm/DedicatedEpsBearerContextActivation.c \
- EURECOM-NAS/src/esm/PdnDisconnect.c \
- EURECOM-NAS/src/esm/EsmStatusHdl.c \
- EURECOM-NAS/src/esm/esm_main.c \
- EURECOM-NAS/src/esm/esm_pt.c \
- EURECOM-NAS/src/esm/esm_proc.h \
- EURECOM-NAS/src/esm/esm_main.h \
- EURECOM-NAS/src/esm/sap/esm_recv.h \
- EURECOM-NAS/src/esm/sap/esm_sap.h \
- EURECOM-NAS/src/esm/sap/esm_send.h \
- EURECOM-NAS/src/esm/sap/esm_sapDef.h \
- EURECOM-NAS/src/esm/esm_ebr_context.h \
- EURECOM-NAS/src/esm/esmData.h \
- EURECOM-NAS/src/esm/esm_pt.h \
- EURECOM-NAS/src/esm/esm_ebr.h \
- EURECOM-NAS/src/esm/esm_ip.c
-
-libnas_esm_msg_SRCS = \
- EURECOM-NAS/src/esm/msg/EsmInformationRequest.h \
- EURECOM-NAS/src/esm/msg/EsmStatus.h \
- EURECOM-NAS/src/esm/msg/DeactivateEpsBearerContextAccept.h \
- EURECOM-NAS/src/esm/msg/BearerResourceAllocationReject.h \
- EURECOM-NAS/src/esm/msg/ActivateDefaultEpsBearerContextReject.h \
- EURECOM-NAS/src/esm/msg/BearerResourceModificationReject.h \
- EURECOM-NAS/src/esm/msg/PdnConnectivityReject.h \
- EURECOM-NAS/src/esm/msg/PdnDisconnectRequest.h \
- EURECOM-NAS/src/esm/msg/DeactivateEpsBearerContextRequest.h \
- EURECOM-NAS/src/esm/msg/PdnConnectivityRequest.h \
- EURECOM-NAS/src/esm/msg/BearerResourceModificationRequest.h \
- EURECOM-NAS/src/esm/msg/PdnDisconnectReject.h \
- EURECOM-NAS/src/esm/msg/ActivateDedicatedEpsBearerContextRequest.h \
- EURECOM-NAS/src/esm/msg/ActivateDefaultEpsBearerContextAccept.h \
- EURECOM-NAS/src/esm/msg/ActivateDedicatedEpsBearerContextReject.h \
- EURECOM-NAS/src/esm/msg/esm_msg.h \
- EURECOM-NAS/src/esm/msg/ModifyEpsBearerContextAccept.h \
- EURECOM-NAS/src/esm/msg/ModifyEpsBearerContextReject.h \
- EURECOM-NAS/src/esm/msg/EsmInformationResponse.h \
- EURECOM-NAS/src/esm/msg/ModifyEpsBearerContextRequest.h \
- EURECOM-NAS/src/esm/msg/ActivateDedicatedEpsBearerContextAccept.h \
- EURECOM-NAS/src/esm/msg/esm_cause.h \
- EURECOM-NAS/src/esm/msg/BearerResourceAllocationRequest.h \
- EURECOM-NAS/src/esm/msg/ActivateDefaultEpsBearerContextRequest.h \
- EURECOM-NAS/src/esm/msg/esm_msgDef.h \
- EURECOM-NAS/src/esm/msg/ModifyEpsBearerContextRequest.c \
- EURECOM-NAS/src/esm/msg/DeactivateEpsBearerContextRequest.c \
- EURECOM-NAS/src/esm/msg/BearerResourceAllocationReject.c \
- EURECOM-NAS/src/esm/msg/BearerResourceModificationRequest.c \
- EURECOM-NAS/src/esm/msg/ActivateDedicatedEpsBearerContextRequest.c \
- EURECOM-NAS/src/esm/msg/EsmInformationResponse.c \
- EURECOM-NAS/src/esm/msg/PdnDisconnectReject.c \
- EURECOM-NAS/src/esm/msg/ActivateDedicatedEpsBearerContextAccept.c \
- EURECOM-NAS/src/esm/msg/PdnDisconnectRequest.c \
- EURECOM-NAS/src/esm/msg/BearerResourceModificationReject.c \
- EURECOM-NAS/src/esm/msg/ActivateDefaultEpsBearerContextAccept.c \
- EURECOM-NAS/src/esm/msg/ActivateDedicatedEpsBearerContextReject.c \
- EURECOM-NAS/src/esm/msg/ModifyEpsBearerContextAccept.c \
- EURECOM-NAS/src/esm/msg/DeactivateEpsBearerContextAccept.c \
- EURECOM-NAS/src/esm/msg/esm_msg.c \
- EURECOM-NAS/src/esm/msg/EsmInformationRequest.c \
- EURECOM-NAS/src/esm/msg/ActivateDefaultEpsBearerContextRequest.c \
- EURECOM-NAS/src/esm/msg/ModifyEpsBearerContextReject.c \
- EURECOM-NAS/src/esm/msg/EsmStatus.c \
- EURECOM-NAS/src/esm/msg/PdnConnectivityReject.c \
- EURECOM-NAS/src/esm/msg/ActivateDefaultEpsBearerContextReject.c \
- EURECOM-NAS/src/esm/msg/PdnConnectivityRequest.c \
- EURECOM-NAS/src/esm/msg/BearerResourceAllocationRequest.c
-
-libnas_esm_sap_SRCS = \
- EURECOM-NAS/src/esm/sap/esm_recv.c \
- EURECOM-NAS/src/esm/sap/esm_send.c \
- EURECOM-NAS/src/esm/sap/esm_sap.c
-
-libnas_ies_SRCS = \
- EURECOM-NAS/src/ies/UeSecurityCapability.c \
- EURECOM-NAS/src/ies/SecurityHeaderType.c \
- EURECOM-NAS/src/ies/RadioPriority.c \
- EURECOM-NAS/src/ies/EpsAttachResult.c \
- EURECOM-NAS/src/ies/ImeisvRequest.c \
- EURECOM-NAS/src/ies/EmergencyNumberList.c \
- EURECOM-NAS/src/ies/SupportedCodecList.c \
- EURECOM-NAS/src/ies/EsmCause.c \
- EURECOM-NAS/src/ies/NetworkName.c \
- EURECOM-NAS/src/ies/AuthenticationResponseParameter.c \
- EURECOM-NAS/src/ies/Cli.c \
- EURECOM-NAS/src/ies/AccessPointName.c \
- EURECOM-NAS/src/ies/DaylightSavingTime.c \
- EURECOM-NAS/src/ies/LcsIndicator.c \
- EURECOM-NAS/src/ies/PagingIdentity.c \
- EURECOM-NAS/src/ies/EpsMobileIdentity.c \
- EURECOM-NAS/src/ies/GutiType.c \
- EURECOM-NAS/src/ies/NasKeySetIdentifier.c \
- EURECOM-NAS/src/ies/CsfbResponse.c \
- EURECOM-NAS/src/ies/PacketFlowIdentifier.c \
- EURECOM-NAS/src/ies/ApnAggregateMaximumBitRate.c \
- EURECOM-NAS/src/ies/EpsBearerContextStatus.c \
- EURECOM-NAS/src/ies/MobileIdentity.c \
- EURECOM-NAS/src/ies/AuthenticationFailureParameter.c \
- EURECOM-NAS/src/ies/EpsUpdateResult.c \
- EURECOM-NAS/src/ies/TimeZone.c \
- EURECOM-NAS/src/ies/MessageType.c \
- EURECOM-NAS/src/ies/EmmCause.c \
- EURECOM-NAS/src/ies/MobileStationClassmark2.c \
- EURECOM-NAS/src/ies/AuthenticationParameterRand.c \
- EURECOM-NAS/src/ies/PdnAddress.c \
- EURECOM-NAS/src/ies/MobileStationClassmark3.c \
- EURECOM-NAS/src/ies/ServiceType.c \
- EURECOM-NAS/src/ies/NasRequestType.c \
- EURECOM-NAS/src/ies/PlmnList.c \
- EURECOM-NAS/src/ies/EpsQualityOfService.c \
- EURECOM-NAS/src/ies/NasMessageContainer.c \
- EURECOM-NAS/src/ies/EsmInformationTransferFlag.c \
- EURECOM-NAS/src/ies/TrafficFlowTemplate.c \
- EURECOM-NAS/src/ies/LinkedEpsBearerIdentity.c \
- EURECOM-NAS/src/ies/NasSecurityAlgorithms.c \
- EURECOM-NAS/src/ies/LlcServiceAccessPointIdentifier.c \
- EURECOM-NAS/src/ies/ShortMac.c \
- EURECOM-NAS/src/ies/TrafficFlowAggregateDescription.c \
- EURECOM-NAS/src/ies/PTmsiSignature.c \
- EURECOM-NAS/src/ies/ProtocolDiscriminator.c \
- EURECOM-NAS/src/ies/EpsBearerIdentity.c \
- EURECOM-NAS/src/ies/TimeZoneAndTime.c \
- EURECOM-NAS/src/ies/TrackingAreaIdentityList.c \
- EURECOM-NAS/src/ies/QualityOfService.c \
- EURECOM-NAS/src/ies/EpsUpdateType.c \
- EURECOM-NAS/src/ies/PdnType.c \
- EURECOM-NAS/src/ies/UeRadioCapabilityInformationUpdateNeeded.c \
- EURECOM-NAS/src/ies/AuthenticationParameterAutn.c \
- EURECOM-NAS/src/ies/EpsAttachType.c \
- EURECOM-NAS/src/ies/IdentityType2.c \
- EURECOM-NAS/src/ies/LcsClientIdentity.c \
- EURECOM-NAS/src/ies/DetachType.c \
- EURECOM-NAS/src/ies/LocationAreaIdentification.c \
- EURECOM-NAS/src/ies/TrackingAreaIdentity.c \
- EURECOM-NAS/src/ies/CipheringKeySequenceNumber.c \
- EURECOM-NAS/src/ies/MsNetworkCapability.c \
- EURECOM-NAS/src/ies/UeNetworkCapability.c \
- EURECOM-NAS/src/ies/ProtocolConfigurationOptions.c \
- EURECOM-NAS/src/ies/AdditionalUpdateType.c \
- EURECOM-NAS/src/ies/TmsiStatus.c \
- EURECOM-NAS/src/ies/EsmMessageContainer.c \
- EURECOM-NAS/src/ies/Nonce.c \
- EURECOM-NAS/src/ies/ProcedureTransactionIdentity.c \
- EURECOM-NAS/src/ies/TransactionIdentifier.c \
- EURECOM-NAS/src/ies/AdditionalUpdateResult.c \
- EURECOM-NAS/src/ies/GprsTimer.c \
- EURECOM-NAS/src/ies/EpsNetworkFeatureSupport.c \
- EURECOM-NAS/src/ies/SsCode.c \
- EURECOM-NAS/src/ies/DrxParameter.c \
- EURECOM-NAS/src/ies/KsiAndSequenceNumber.c \
- EURECOM-NAS/src/ies/EpsBearerContextStatus.h \
- EURECOM-NAS/src/ies/MobileStationClassmark2.h \
- EURECOM-NAS/src/ies/LcsClientIdentity.h \
- EURECOM-NAS/src/ies/ServiceType.h \
- EURECOM-NAS/src/ies/Cli.h \
- EURECOM-NAS/src/ies/GprsTimer.h \
- EURECOM-NAS/src/ies/AuthenticationParameterAutn.h \
- EURECOM-NAS/src/ies/EmmCause.h \
- EURECOM-NAS/src/ies/PdnAddress.h \
- EURECOM-NAS/src/ies/QualityOfService.h \
- EURECOM-NAS/src/ies/LocationAreaIdentification.h \
- EURECOM-NAS/src/ies/EmergencyNumberList.h \
- EURECOM-NAS/src/ies/UeRadioCapabilityInformationUpdateNeeded.h \
- EURECOM-NAS/src/ies/SupportedCodecList.h \
- EURECOM-NAS/src/ies/AuthenticationFailureParameter.h \
- EURECOM-NAS/src/ies/MobileIdentity.h \
- EURECOM-NAS/src/ies/UeNetworkCapability.h \
- EURECOM-NAS/src/ies/ShortMac.h \
- EURECOM-NAS/src/ies/MessageType.h \
- EURECOM-NAS/src/ies/AdditionalUpdateType.h \
- EURECOM-NAS/src/ies/NasMessageContainer.h \
- EURECOM-NAS/src/ies/TrafficFlowAggregateDescription.h \
- EURECOM-NAS/src/ies/NasKeySetIdentifier.h \
- EURECOM-NAS/src/ies/NasSecurityAlgorithms.h \
- EURECOM-NAS/src/ies/GutiType.h \
- EURECOM-NAS/src/ies/EpsMobileIdentity.h \
- EURECOM-NAS/src/ies/EpsUpdateType.h \
- EURECOM-NAS/src/ies/TrackingAreaIdentity.h \
- EURECOM-NAS/src/ies/TimeZoneAndTime.h \
- EURECOM-NAS/src/ies/AccessPointName.h \
- EURECOM-NAS/src/ies/PdnType.h \
- EURECOM-NAS/src/ies/LlcServiceAccessPointIdentifier.h \
- EURECOM-NAS/src/ies/DaylightSavingTime.h \
- EURECOM-NAS/src/ies/PagingIdentity.h \
- EURECOM-NAS/src/ies/CsfbResponse.h \
- EURECOM-NAS/src/ies/LcsIndicator.h \
- EURECOM-NAS/src/ies/EsmInformationTransferFlag.h \
- EURECOM-NAS/src/ies/EsmMessageContainer.h \
- EURECOM-NAS/src/ies/ImeisvRequest.h \
- EURECOM-NAS/src/ies/PTmsiSignature.h \
- EURECOM-NAS/src/ies/SsCode.h \
- EURECOM-NAS/src/ies/EpsAttachResult.h \
- EURECOM-NAS/src/ies/UeSecurityCapability.h \
- EURECOM-NAS/src/ies/TimeZone.h \
- EURECOM-NAS/src/ies/EpsBearerIdentity.h \
- EURECOM-NAS/src/ies/IdentityType2.h \
- EURECOM-NAS/src/ies/LinkedEpsBearerIdentity.h \
- EURECOM-NAS/src/ies/PacketFlowIdentifier.h \
- EURECOM-NAS/src/ies/RadioPriority.h \
- EURECOM-NAS/src/ies/Nonce.h \
- EURECOM-NAS/src/ies/KsiAndSequenceNumber.h \
- EURECOM-NAS/src/ies/NasRequestType.h \
- EURECOM-NAS/src/ies/ProtocolConfigurationOptions.h \
- EURECOM-NAS/src/ies/AuthenticationResponseParameter.h \
- EURECOM-NAS/src/ies/MobileStationClassmark3.h \
- EURECOM-NAS/src/ies/EpsQualityOfService.h \
- EURECOM-NAS/src/ies/DrxParameter.h \
- EURECOM-NAS/src/ies/EsmCause.h \
- EURECOM-NAS/src/ies/ProcedureTransactionIdentity.h \
- EURECOM-NAS/src/ies/TransactionIdentifier.h \
- EURECOM-NAS/src/ies/ProtocolDiscriminator.h \
- EURECOM-NAS/src/ies/EpsAttachType.h \
- EURECOM-NAS/src/ies/AdditionalUpdateResult.h \
- EURECOM-NAS/src/ies/SecurityHeaderType.h \
- EURECOM-NAS/src/ies/TrafficFlowTemplate.h \
- EURECOM-NAS/src/ies/NetworkName.h \
- EURECOM-NAS/src/ies/PlmnList.h \
- EURECOM-NAS/src/ies/TrackingAreaIdentityList.h \
- EURECOM-NAS/src/ies/DetachType.h \
- EURECOM-NAS/src/ies/AuthenticationParameterRand.h \
- EURECOM-NAS/src/ies/EpsUpdateResult.h \
- EURECOM-NAS/src/ies/MsNetworkCapability.h \
- EURECOM-NAS/src/ies/TmsiStatus.h \
- EURECOM-NAS/src/ies/CipheringKeySequenceNumber.h \
- EURECOM-NAS/src/ies/ApnAggregateMaximumBitRate.h \
- EURECOM-NAS/src/ies/EpsNetworkFeatureSupport.h \
- EURECOM-NAS/src/ies/VoiceDomainPreferenceAndUeUsageSetting.c \
- EURECOM-NAS/src/ies/VoiceDomainPreferenceAndUeUsageSetting.h
-
-libnas_utils_SRCS = \
- EURECOM-NAS/src/util/nas_log.h \
- EURECOM-NAS/src/util/nas_log.c \
- EURECOM-NAS/src/util/nas_timer.h \
- EURECOM-NAS/src/util/nas_timer.c \
- EURECOM-NAS/src/util/TLVEncoder.h \
- EURECOM-NAS/src/util/TLVEncoder.c \
- EURECOM-NAS/src/util/TLVDecoder.h \
- EURECOM-NAS/src/util/TLVDecoder.c \
- EURECOM-NAS/src/util/OctetString.h \
- EURECOM-NAS/src/util/OctetString.c
-
-libnas_SRCS = \
- EURECOM-NAS/src/nas_network.c \
- EURECOM-NAS/src/nas_network.h \
- EURECOM-NAS/src/nas_parser.c \
- EURECOM-NAS/src/nas_parser.h \
- EURECOM-NAS/src/nas_proc.c \
- EURECOM-NAS/src/nas_proc.h \
- EURECOM-NAS/src/nas_user.c \
- EURECOM-NAS/src/nas_user.h \
- $(libnas_utils_SRCS) \
- $(libnas_emm_SRCS) \
- $(libnas_emm_msg_SRCS) \
- $(libnas_emm_sap_SRCS) \
- $(libnas_esm_SRCS) \
- $(libnas_esm_msg_SRCS) \
- $(libnas_esm_sap_SRCS) \
- $(libnas_ies_SRCS) \
- $(libnas_api_SRCS)
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/COPYING b/openair-cn/NAS/TEST/AS_SIMULATOR/COPYING
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/COPYING
rename to openair-cn/NAS/TEST/AS_SIMULATOR/COPYING
diff --git a/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/Makefile b/openair-cn/NAS/TEST/AS_SIMULATOR/Makefile
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/tst/as_simulator/Makefile
rename to openair-cn/NAS/TEST/AS_SIMULATOR/Makefile
diff --git a/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/as_data.c b/openair-cn/NAS/TEST/AS_SIMULATOR/as_data.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/tst/as_simulator/as_data.c
rename to openair-cn/NAS/TEST/AS_SIMULATOR/as_data.c
diff --git a/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/as_data.h b/openair-cn/NAS/TEST/AS_SIMULATOR/as_data.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/tst/as_simulator/as_data.h
rename to openair-cn/NAS/TEST/AS_SIMULATOR/as_data.h
diff --git a/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/as_process.c b/openair-cn/NAS/TEST/AS_SIMULATOR/as_process.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/tst/as_simulator/as_process.c
rename to openair-cn/NAS/TEST/AS_SIMULATOR/as_process.c
diff --git a/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/as_process.h b/openair-cn/NAS/TEST/AS_SIMULATOR/as_process.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/tst/as_simulator/as_process.h
rename to openair-cn/NAS/TEST/AS_SIMULATOR/as_process.h
diff --git a/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/as_simulator.c b/openair-cn/NAS/TEST/AS_SIMULATOR/as_simulator.c
similarity index 99%
rename from openair-cn/NAS/EURECOM-NAS/tst/as_simulator/as_simulator.c
rename to openair-cn/NAS/TEST/AS_SIMULATOR/as_simulator.c
index 39139e11df..20c49981bd 100644
--- a/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/as_simulator.c
+++ b/openair-cn/NAS/TEST/AS_SIMULATOR/as_simulator.c
@@ -57,12 +57,12 @@ Description Implements the Access-Stratum simulator operating between
/*
* Direction of the message to be transfered to the UE NAS process
*/
-static UInt8_t _as_simulator_ue_transfer = AS_SIMULATOR_NO_TRANSFER;
+static uint8_t _as_simulator_ue_transfer = AS_SIMULATOR_NO_TRANSFER;
/*
* Direction of the message to be transfered to the MME NAS process
*/
-static UInt8_t _as_simulator_mme_transfer = AS_SIMULATOR_NO_TRANSFER;
+static uint8_t _as_simulator_mme_transfer = AS_SIMULATOR_NO_TRANSFER;
/*
* Size of the message to be transfered to the UE NAS process
diff --git a/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/as_simulator_parser.c b/openair-cn/NAS/TEST/AS_SIMULATOR/as_simulator_parser.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/tst/as_simulator/as_simulator_parser.c
rename to openair-cn/NAS/TEST/AS_SIMULATOR/as_simulator_parser.c
diff --git a/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/as_simulator_parser.h b/openair-cn/NAS/TEST/AS_SIMULATOR/as_simulator_parser.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/tst/as_simulator/as_simulator_parser.h
rename to openair-cn/NAS/TEST/AS_SIMULATOR/as_simulator_parser.h
diff --git a/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/nas_data.c b/openair-cn/NAS/TEST/AS_SIMULATOR/nas_data.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/tst/as_simulator/nas_data.c
rename to openair-cn/NAS/TEST/AS_SIMULATOR/nas_data.c
diff --git a/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/nas_data.h b/openair-cn/NAS/TEST/AS_SIMULATOR/nas_data.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/tst/as_simulator/nas_data.h
rename to openair-cn/NAS/TEST/AS_SIMULATOR/nas_data.h
diff --git a/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/nas_process.c b/openair-cn/NAS/TEST/AS_SIMULATOR/nas_process.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/tst/as_simulator/nas_process.c
rename to openair-cn/NAS/TEST/AS_SIMULATOR/nas_process.c
diff --git a/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/nas_process.h b/openair-cn/NAS/TEST/AS_SIMULATOR/nas_process.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/tst/as_simulator/nas_process.h
rename to openair-cn/NAS/TEST/AS_SIMULATOR/nas_process.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/COPYING b/openair-cn/NAS/TEST/COPYING
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/msg/COPYING
rename to openair-cn/NAS/TEST/COPYING
diff --git a/openair-cn/NAS/EURECOM-NAS/tst/MSC/ActivatePDN.png b/openair-cn/NAS/TEST/MSC/ActivatePDN.png
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/tst/MSC/ActivatePDN.png
rename to openair-cn/NAS/TEST/MSC/ActivatePDN.png
diff --git a/openair-cn/NAS/EURECOM-NAS/tst/MSC/AuthenticationReject.png b/openair-cn/NAS/TEST/MSC/AuthenticationReject.png
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/tst/MSC/AuthenticationReject.png
rename to openair-cn/NAS/TEST/MSC/AuthenticationReject.png
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/COPYING b/openair-cn/NAS/TEST/MSC/COPYING
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/sap/COPYING
rename to openair-cn/NAS/TEST/MSC/COPYING
diff --git a/openair-cn/NAS/EURECOM-NAS/tst/MSC/DeactivatePDN.png b/openair-cn/NAS/TEST/MSC/DeactivatePDN.png
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/tst/MSC/DeactivatePDN.png
rename to openair-cn/NAS/TEST/MSC/DeactivatePDN.png
diff --git a/openair-cn/NAS/EURECOM-NAS/tst/MSC/InitialAttach.png b/openair-cn/NAS/TEST/MSC/InitialAttach.png
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/tst/MSC/InitialAttach.png
rename to openair-cn/NAS/TEST/MSC/InitialAttach.png
diff --git a/openair-cn/NAS/EURECOM-NAS/tst/MSC/InitialAttachReject.png b/openair-cn/NAS/TEST/MSC/InitialAttachReject.png
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/tst/MSC/InitialAttachReject.png
rename to openair-cn/NAS/TEST/MSC/InitialAttachReject.png
diff --git a/openair-cn/NAS/EURECOM-NAS/tst/MSC/NomalDetach.png b/openair-cn/NAS/TEST/MSC/NomalDetach.png
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/tst/MSC/NomalDetach.png
rename to openair-cn/NAS/TEST/MSC/NomalDetach.png
diff --git a/openair-cn/NAS/EURECOM-NAS/tst/MSC/README b/openair-cn/NAS/TEST/MSC/README
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/tst/MSC/README
rename to openair-cn/NAS/TEST/MSC/README
diff --git a/openair-cn/NAS/EURECOM-NAS/tst/MSC/SwitchOffDetach.png b/openair-cn/NAS/TEST/MSC/SwitchOffDetach.png
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/tst/MSC/SwitchOffDetach.png
rename to openair-cn/NAS/TEST/MSC/SwitchOffDetach.png
diff --git a/openair-cn/NAS/EURECOM-NAS/tst/MSC/msc_gen.py b/openair-cn/NAS/TEST/MSC/msc_gen.py
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/tst/MSC/msc_gen.py
rename to openair-cn/NAS/TEST/MSC/msc_gen.py
diff --git a/openair-cn/NAS/EURECOM-NAS/tst/MSC/mscgen b/openair-cn/NAS/TEST/MSC/mscgen
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/tst/MSC/mscgen
rename to openair-cn/NAS/TEST/MSC/mscgen
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/COPYING b/openair-cn/NAS/TEST/NETWORK/COPYING
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/COPYING
rename to openair-cn/NAS/TEST/NETWORK/COPYING
diff --git a/openair-cn/NAS/EURECOM-NAS/tst/network/Makefile b/openair-cn/NAS/TEST/NETWORK/Makefile
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/tst/network/Makefile
rename to openair-cn/NAS/TEST/NETWORK/Makefile
diff --git a/openair-cn/NAS/EURECOM-NAS/tst/network/README b/openair-cn/NAS/TEST/NETWORK/README
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/tst/network/README
rename to openair-cn/NAS/TEST/NETWORK/README
diff --git a/openair-cn/NAS/EURECOM-NAS/tst/network/network_parser.c b/openair-cn/NAS/TEST/NETWORK/network_parser.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/tst/network/network_parser.c
rename to openair-cn/NAS/TEST/NETWORK/network_parser.c
diff --git a/openair-cn/NAS/EURECOM-NAS/tst/network/network_parser.h b/openair-cn/NAS/TEST/NETWORK/network_parser.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/tst/network/network_parser.h
rename to openair-cn/NAS/TEST/NETWORK/network_parser.h
diff --git a/openair-cn/NAS/EURECOM-NAS/tst/network/network_simulator.c b/openair-cn/NAS/TEST/NETWORK/network_simulator.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/tst/network/network_simulator.c
rename to openair-cn/NAS/TEST/NETWORK/network_simulator.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/COPYING b/openair-cn/NAS/TEST/USER/COPYING
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/msg/COPYING
rename to openair-cn/NAS/TEST/USER/COPYING
diff --git a/openair-cn/NAS/EURECOM-NAS/tst/user/Makefile b/openair-cn/NAS/TEST/USER/Makefile
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/tst/user/Makefile
rename to openair-cn/NAS/TEST/USER/Makefile
diff --git a/openair-cn/NAS/EURECOM-NAS/tst/user/user_parser.c b/openair-cn/NAS/TEST/USER/user_parser.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/tst/user/user_parser.c
rename to openair-cn/NAS/TEST/USER/user_parser.c
diff --git a/openair-cn/NAS/EURECOM-NAS/tst/user/user_parser.h b/openair-cn/NAS/TEST/USER/user_parser.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/tst/user/user_parser.h
rename to openair-cn/NAS/TEST/USER/user_parser.h
diff --git a/openair-cn/NAS/EURECOM-NAS/tst/user/user_simulator.c b/openair-cn/NAS/TEST/USER/user_simulator.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/tst/user/user_simulator.c
rename to openair-cn/NAS/TEST/USER/user_simulator.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/sap/COPYING b/openair-cn/NAS/TOOLS/COPYING
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/sap/COPYING
rename to openair-cn/NAS/TOOLS/COPYING
diff --git a/openair-cn/NAS/EURECOM-NAS/tools/Makefile b/openair-cn/NAS/TOOLS/Makefile
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/tools/Makefile
rename to openair-cn/NAS/TOOLS/Makefile
diff --git a/openair-cn/NAS/EURECOM-NAS/tools/network.h b/openair-cn/NAS/TOOLS/network.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/tools/network.h
rename to openair-cn/NAS/TOOLS/network.h
diff --git a/openair-cn/NAS/EURECOM-NAS/tools/ue_data.c b/openair-cn/NAS/TOOLS/ue_data.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/tools/ue_data.c
rename to openair-cn/NAS/TOOLS/ue_data.c
diff --git a/openair-cn/NAS/EURECOM-NAS/tools/usim_data.c b/openair-cn/NAS/TOOLS/usim_data.c
similarity index 99%
rename from openair-cn/NAS/EURECOM-NAS/tools/usim_data.c
rename to openair-cn/NAS/TOOLS/usim_data.c
index 5354ebac88..ea867fef3c 100644
--- a/openair-cn/NAS/EURECOM-NAS/tools/usim_data.c
+++ b/openair-cn/NAS/TOOLS/usim_data.c
@@ -515,9 +515,9 @@ static void _display_usim_data(const usim_data_t* data)
memcpy(kasme, data->securityctx.Kasme.value, USIM_K_ASME_SIZE);
printf("\tKasme\t: \"%s\"\n", kasme);
printf("\tulNAScount\t: 0x%.8x\n",
- *(UInt32_t*)data->securityctx.ulNAScount.value);
+ *(uint32_t*)data->securityctx.ulNAScount.value);
printf("\tdlNAScount\t: 0x%.8x\n",
- *(UInt32_t*)data->securityctx.dlNAScount.value);
+ *(uint32_t*)data->securityctx.dlNAScount.value);
printf("\talgorithmID\t: 0x%.2x\n\n",
data->securityctx.algorithmID.value[0]);
diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/COPYING b/openair-cn/NAS/UE/API/USER/COPYING
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/ies/COPYING
rename to openair-cn/NAS/UE/API/USER/COPYING
diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/user/Makefile b/openair-cn/NAS/UE/API/USER/Makefile
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/api/user/Makefile
rename to openair-cn/NAS/UE/API/USER/Makefile
diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/user/at_command.c b/openair-cn/NAS/UE/API/USER/at_command.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/api/user/at_command.c
rename to openair-cn/NAS/UE/API/USER/at_command.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/user/at_command.h b/openair-cn/NAS/UE/API/USER/at_command.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/api/user/at_command.h
rename to openair-cn/NAS/UE/API/USER/at_command.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/user/at_error.c b/openair-cn/NAS/UE/API/USER/at_error.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/api/user/at_error.c
rename to openair-cn/NAS/UE/API/USER/at_error.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/user/at_error.h b/openair-cn/NAS/UE/API/USER/at_error.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/api/user/at_error.h
rename to openair-cn/NAS/UE/API/USER/at_error.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/user/at_response.c b/openair-cn/NAS/UE/API/USER/at_response.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/api/user/at_response.c
rename to openair-cn/NAS/UE/API/USER/at_response.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/user/at_response.h b/openair-cn/NAS/UE/API/USER/at_response.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/api/user/at_response.h
rename to openair-cn/NAS/UE/API/USER/at_response.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/user/tst/Makefile b/openair-cn/NAS/UE/API/USER/tst/Makefile
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/api/user/tst/Makefile
rename to openair-cn/NAS/UE/API/USER/tst/Makefile
diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/user/tst/at_parser.c b/openair-cn/NAS/UE/API/USER/tst/at_parser.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/api/user/tst/at_parser.c
rename to openair-cn/NAS/UE/API/USER/tst/at_parser.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/user/tst/at_parser.in b/openair-cn/NAS/UE/API/USER/tst/at_parser.in
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/api/user/tst/at_parser.in
rename to openair-cn/NAS/UE/API/USER/tst/at_parser.in
diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/user/tst/at_parser.in.bis b/openair-cn/NAS/UE/API/USER/tst/at_parser.in.bis
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/api/user/tst/at_parser.in.bis
rename to openair-cn/NAS/UE/API/USER/tst/at_parser.in.bis
diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/user/tst/at_parser.out b/openair-cn/NAS/UE/API/USER/tst/at_parser.out
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/api/user/tst/at_parser.out
rename to openair-cn/NAS/UE/API/USER/tst/at_parser.out
diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/user/tst/at_parser.out.bis b/openair-cn/NAS/UE/API/USER/tst/at_parser.out.bis
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/api/user/tst/at_parser.out.bis
rename to openair-cn/NAS/UE/API/USER/tst/at_parser.out.bis
diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/user/tst/smartcom.txt b/openair-cn/NAS/UE/API/USER/tst/smartcom.txt
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/api/user/tst/smartcom.txt
rename to openair-cn/NAS/UE/API/USER/tst/smartcom.txt
diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/user/user_api.c b/openair-cn/NAS/UE/API/USER/user_api.c
similarity index 99%
rename from openair-cn/NAS/EURECOM-NAS/src/api/user/user_api.c
rename to openair-cn/NAS/UE/API/USER/user_api.c
index f8a522de40..42e7cb1538 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/api/user/user_api.c
+++ b/openair-cn/NAS/UE/API/USER/user_api.c
@@ -45,7 +45,6 @@ Description Implements the API used by the NAS layer running in the UE
*****************************************************************************/
-#ifdef NAS_UE
#include "user_api.h"
#include "nas_log.h"
@@ -850,4 +849,3 @@ static int _user_api_pdn_connection_handler(unsigned char id, const void* data,
LOG_FUNC_RETURN (bytes);
}
-#endif // NAS_UE
diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/user/user_api.h b/openair-cn/NAS/UE/API/USER/user_api.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/api/user/user_api.h
rename to openair-cn/NAS/UE/API/USER/user_api.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/user/user_indication.c b/openair-cn/NAS/UE/API/USER/user_indication.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/api/user/user_indication.c
rename to openair-cn/NAS/UE/API/USER/user_indication.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/user/user_indication.h b/openair-cn/NAS/UE/API/USER/user_indication.h
similarity index 98%
rename from openair-cn/NAS/EURECOM-NAS/src/api/user/user_indication.h
rename to openair-cn/NAS/UE/API/USER/user_indication.h
index 799b021148..4cf762b609 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/api/user/user_indication.h
+++ b/openair-cn/NAS/UE/API/USER/user_indication.h
@@ -90,7 +90,7 @@ typedef struct {
* has activated or desactivated a PDN connection
*/
typedef struct {
- UInt8_t cid; /* PDN connection identifier */
+ uint8_t cid; /* PDN connection identifier */
network_pdn_state_t status; /* PDN connection status */
} user_ind_pdn_t;
diff --git a/openair-cn/NAS/EURECOM-NAS/src/include/COPYING b/openair-cn/NAS/UE/API/USIM/COPYING
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/include/COPYING
rename to openair-cn/NAS/UE/API/USIM/COPYING
diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/usim/Makefile b/openair-cn/NAS/UE/API/USIM/Makefile
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/api/usim/Makefile
rename to openair-cn/NAS/UE/API/USIM/Makefile
diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/usim/aka_functions.c b/openair-cn/NAS/UE/API/USIM/aka_functions.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/api/usim/aka_functions.c
rename to openair-cn/NAS/UE/API/USIM/aka_functions.c
diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/usim/aka_functions.h b/openair-cn/NAS/UE/API/USIM/aka_functions.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/api/usim/aka_functions.h
rename to openair-cn/NAS/UE/API/USIM/aka_functions.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/usim/usim_api.c b/openair-cn/NAS/UE/API/USIM/usim_api.c
similarity index 96%
rename from openair-cn/NAS/EURECOM-NAS/src/api/usim/usim_api.c
rename to openair-cn/NAS/UE/API/USIM/usim_api.c
index c9900ac68f..e69e78ddec 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/api/usim/usim_api.c
+++ b/openair-cn/NAS/UE/API/USIM/usim_api.c
@@ -45,7 +45,6 @@ Description Implements the API used by the NAS layer to read/write
*****************************************************************************/
-#ifdef NAS_UE
#include "usim_api.h"
#include "nas_log.h"
@@ -80,7 +79,7 @@ Description Implements the API used by the NAS layer to read/write
#define USIM_API_K_SIZE 16
#define USIM_API_K_VALUE "8BAF473F2F8FD09487CCCBD7097C6862"
-static UInt8_t _usim_api_k[USIM_API_K_SIZE];
+static uint8_t _usim_api_k[USIM_API_K_SIZE];
/*
@@ -88,16 +87,16 @@ static UInt8_t _usim_api_k[USIM_API_K_SIZE];
*/
static struct _usim_api_data_s {
/* Highest sequence number the USIM has ever accepted */
- UInt32_t sqn_ms;
+ uint32_t sqn_ms;
/* List of the last used sequence numbers */
#define USIM_API_SQN_LIST_SIZE 32
- UInt8_t n_sqns;
- UInt32_t sqn[USIM_API_SQN_LIST_SIZE];
+ uint8_t n_sqns;
+ uint32_t sqn[USIM_API_SQN_LIST_SIZE];
} _usim_api_data;
-static UInt8_t _usim_api_hex_char_to_hex_value (char c);
-static void _usim_api_hex_string_to_hex_value (UInt8_t *hex_value, const char *hex_string, int size);
-static int _usim_api_check_sqn(UInt32_t seq, UInt8_t ind);
+static uint8_t _usim_api_hex_char_to_hex_value (char c);
+static void _usim_api_hex_string_to_hex_value (uint8_t *hex_value, const char *hex_string, int size);
+static int _usim_api_check_sqn(uint32_t seq, uint8_t ind);
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
@@ -275,7 +274,7 @@ int usim_api_authenticate(const OctetString* rand_pP, const OctetString* autn_pP
}
/* Verify that the received sequence number SQN is in the correct range */
- rc = _usim_api_check_sqn(*(UInt32_t*)(sqn), sqn[USIM_API_SQN_SIZE - 1]);
+ rc = _usim_api_check_sqn(*(uint32_t*)(sqn), sqn[USIM_API_SQN_SIZE - 1]);
if (rc != RETURNok) {
/* Synchronisation failure; compute the AUTS parameter */
@@ -292,7 +291,7 @@ int usim_api_authenticate(const OctetString* rand_pP, const OctetString* autn_pP
for (i = 0; i < USIM_API_SQN_MS_SIZE; i++) {
#warning "LG:BUG HERE TODO"
sqn_ms[USIM_API_SQNMS_SIZE - i] =
- ((UInt8_t*)(_usim_api_data.sqn_ms))[USIM_API_SQN_MS_SIZE - i];
+ ((uint8_t*)(_usim_api_data.sqn_ms))[USIM_API_SQN_MS_SIZE - i];
}
u8 sqnms[USIM_API_SQNMS_SIZE];
@@ -341,7 +340,7 @@ int usim_api_authenticate(const OctetString* rand_pP, const OctetString* autn_pP
** Others: None **
** **
***************************************************************************/
-static UInt8_t _usim_api_hex_char_to_hex_value (char c)
+static uint8_t _usim_api_hex_char_to_hex_value (char c)
{
if (c >= 'A') {
/* Remove case bit */
@@ -369,7 +368,7 @@ static UInt8_t _usim_api_hex_char_to_hex_value (char c)
** Others: None **
** **
***************************************************************************/
-static void _usim_api_hex_string_to_hex_value (UInt8_t *hex_value, const char *hex_string, int size)
+static void _usim_api_hex_string_to_hex_value (uint8_t *hex_value, const char *hex_string, int size)
{
int i;
@@ -397,10 +396,9 @@ static void _usim_api_hex_string_to_hex_value (UInt8_t *hex_value, const char *h
** Others: None **
** **
***************************************************************************/
-static int _usim_api_check_sqn(UInt32_t seq, UInt8_t ind)
+static int _usim_api_check_sqn(uint32_t seq, uint8_t ind)
{
/* TODO */
return (RETURNok);
}
-#endif // NAS_UE
diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/usim/usim_api.h b/openair-cn/NAS/UE/API/USIM/usim_api.h
similarity index 97%
rename from openair-cn/NAS/EURECOM-NAS/src/api/usim/usim_api.h
rename to openair-cn/NAS/UE/API/USIM/usim_api.h
index e2c09c41a6..7b5a767d98 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/api/usim/usim_api.h
+++ b/openair-cn/NAS/UE/API/USIM/usim_api.h
@@ -63,7 +63,7 @@ Description Implements the API used by the NAS layer to read/write
* USIM TLV parameter structure
* ----------------------------
*/
-#define USIM_TLV_T(SIZE) struct {UInt8_t type; UInt8_t length; Byte_t value[SIZE];}
+#define USIM_TLV_T(SIZE) struct {uint8_t type; uint8_t length; Byte_t value[SIZE];}
/*
* Non Access Stratum Configuration
@@ -123,7 +123,7 @@ typedef struct {
typedef struct {
/* Length of all subsequent data */
#define USIM_EPS_NAS_SECURITY_CONTEXT_TAG 0xA0U
- UInt8_t length;
+ uint8_t length;
/* Key set identifier KSI_ASME */
#define USIM_KSI_ASME_TAG 0x80U
USIM_TLV_T(1) KSIasme;
@@ -197,7 +197,7 @@ typedef struct {
tac_t start;
tac_t end;
/* PLMN Network Name Record Identifier */
- UInt8_t record_id;
+ uint8_t record_id;
} usim_opl_t;
/*
@@ -212,7 +212,7 @@ typedef struct {
#define USIM_ACT_CDMA_1xRTT 0x1000
#define USIM_ACT_UTRAN 0x0080
#define USIM_ACT_EUTRAN 0x0040
- UInt16_t AcT;
+ uint16_t AcT;
} usim_plmn_act_t;
/*
@@ -220,7 +220,7 @@ typedef struct {
* ------------------------------
*/
typedef struct {
- UInt32_t tmsi; /* Temporary Mobile Subscriber Identity */
+ uint32_t tmsi; /* Temporary Mobile Subscriber Identity */
lai_t lai; /* Location Area Identity */
Byte_t reserved; /* Reserved for future use */
#define USIM_LOCI_UPDATED 0x00
@@ -235,7 +235,7 @@ typedef struct {
* ----------------------------------------------
*/
typedef struct {
- UInt32_t p_tmsi; /* Packet Temporary Mobile Subscriber Identity */
+ uint32_t p_tmsi; /* Packet Temporary Mobile Subscriber Identity */
Byte_t signature[3]; /* P-TMSI signature value */
RAI_t rai; /* Routing Area Identity */
#define USIM_PSLOCI_UPDATED 0x00
@@ -280,7 +280,7 @@ typedef struct {
#define USIM_MAINTENANCE_MODE 0x02U
#define USIM_CELL_TEST_MODE 0x04U
Byte_t UE_Operation_Mode; /* Mode of operation for the UE */
- UInt16_t Additional_Info; /* Additional information depending on
+ uint16_t Additional_Info; /* Additional information depending on
* the UE operation mode */
Byte_t MNC_Length; /* Number of digits used for extracting
* the MNC from the IMSI */
diff --git a/openair-cn/NAS/UE/EMM/Attach.c b/openair-cn/NAS/UE/EMM/Attach.c
new file mode 100755
index 0000000000..3a0c079685
--- /dev/null
+++ b/openair-cn/NAS/UE/EMM/Attach.c
@@ -0,0 +1,1198 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+
+Source Attach.c
+
+Version 0.1
+
+Date 2012/12/04
+
+Product NAS stack
+
+Subsystem EPS Mobility Management
+
+Author Frederic Maurel
+
+Description Defines the attach related EMM procedure executed by the
+ Non-Access Stratum.
+
+ To get internet connectivity from the network, the network
+ have to know about the UE. When the UE is switched on, it
+ has to initiate the attach procedure to get initial access
+ to the network and register its presence to the Evolved
+ Packet Core (EPC) network in order to receive EPS services.
+
+ As a result of a successful attach procedure, a context is
+ created for the UE in the MME, and a default bearer is esta-
+ blished between the UE and the PDN-GW. The UE gets the home
+ agent IPv4 and IPv6 addresses and full connectivity to the
+ IP network.
+
+ The network may also initiate the activation of additional
+ dedicated bearers for the support of a specific service.
+
+*****************************************************************************/
+
+#include "emm_proc.h"
+#include "networkDef.h"
+#include "nas_log.h"
+#include "nas_timer.h"
+
+#include "emmData.h"
+
+#include "emm_sap.h"
+#include "esm_sap.h"
+#include "emm_cause.h"
+
+#include "NasSecurityAlgorithms.h"
+
+#include // memcmp, memcpy
+#include // malloc, free
+
+/****************************************************************************/
+/**************** E X T E R N A L D E F I N I T I O N S ****************/
+/****************************************************************************/
+
+/****************************************************************************/
+/******************* L O C A L D E F I N I T I O N S *******************/
+/****************************************************************************/
+
+/* String representation of the EPS attach type */
+static const char *_emm_attach_type_str[] = {
+ "EPS", "IMSI", "EMERGENCY", "RESERVED"
+};
+
+/*
+ * --------------------------------------------------------------------------
+ * Internal data handled by the attach procedure in the UE
+ * --------------------------------------------------------------------------
+ */
+/*
+ * Timer handlers
+ */
+void *_emm_attach_t3410_handler(void *);
+static void *_emm_attach_t3411_handler(void *);
+static void *_emm_attach_t3402_handler(void *);
+
+/*
+ * Abnormal case attach procedure
+ */
+static void _emm_attach_abnormal_cases_bcd(emm_sap_t *);
+
+/*
+ * Internal data used for attach procedure
+ */
+static struct {
+#define EMM_ATTACH_COUNTER_MAX 5
+ unsigned int attempt_count; /* Counter used to limit the number of
+ * subsequently rejected attach attempts */
+} _emm_attach_data = {0};
+
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+/*
+ * --------------------------------------------------------------------------
+ * Attach procedure executed by the UE
+ * --------------------------------------------------------------------------
+ */
+/****************************************************************************
+ ** **
+ ** Name: emm_proc_attach() **
+ ** **
+ ** Description: Initiate EPS attach procedure to register a UE in PS mode **
+ ** of operation for EPS services only, or register a UE for **
+ ** emergency bearer services. **
+ ** **
+ ** 3GPP TS 24.301, section 5.5.1.2.2 **
+ ** In state EMM-DEREGISTERED, the UE initiates the attach **
+ ** procedure by sending an ATTACH REQUEST message to the MME,**
+ ** starting timer T3410 and entering state EMM-REGISTERED- **
+ ** INITIATED. **
+ ** **
+ ** Inputs: type: Type of the requested attach **
+ ** Others: _emm_data **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: T3402, T3410, T3411 **
+ ** **
+ ***************************************************************************/
+int emm_proc_attach(emm_proc_attach_type_t type)
+{
+ LOG_FUNC_IN;
+
+ emm_sap_t emm_sap;
+ emm_as_establish_t *emm_as = &emm_sap.u.emm_as.u.establish;
+ esm_sap_t esm_sap;
+ int rc;
+
+ LOG_TRACE(INFO, "EMM-PROC - Initiate EPS attach type = %s (%d)",
+ _emm_attach_type_str[type], type);
+
+ /* Update the emergency bearer service indicator */
+ if (type == EMM_ATTACH_TYPE_EMERGENCY) {
+ _emm_data.is_emergency = TRUE;
+ }
+
+ /* Setup initial NAS information message to transfer */
+ emm_as->NASinfo = EMM_AS_NAS_INFO_ATTACH;
+ /* Set the attach type */
+ emm_as->type = type;
+
+ /* Set the RRC connection establishment cause */
+ if (_emm_data.is_emergency) {
+ emm_as->RRCcause = NET_ESTABLISH_CAUSE_EMERGENCY;
+ emm_as->RRCtype = NET_ESTABLISH_TYPE_EMERGENCY_CALLS;
+ } else {
+ emm_as->RRCcause = NET_ESTABLISH_CAUSE_MO_SIGNAL;
+ emm_as->RRCtype = NET_ESTABLISH_TYPE_ORIGINATING_SIGNAL;
+ }
+
+ /* Set the PLMN identifier of the selected PLMN */
+ emm_as->plmnID = &_emm_data.splmn;
+ /*
+ * Process the EPS mobile identity
+ */
+ emm_as->UEid.guti = NULL;
+ emm_as->UEid.tai = NULL;
+ emm_as->UEid.imsi = NULL;
+ emm_as->UEid.imei = NULL;
+
+ /* Check whether the UE is configured for "AttachWithIMSI" */
+ if (_emm_data.AttachWithImsi) {
+ /* Check whether the selected PLMN is neither the registered PLMN
+ * nor in the list of equivalent PLMNs */
+ if ( (!_emm_data.is_rplmn) && (!_emm_data.is_eplmn) ) {
+ LOG_TRACE(INFO, "EMM-PROC - Initiate EPS attach with IMSI");
+ /* Include the IMSI */
+ emm_as->UEid.imsi = _emm_data.imsi;
+ } else {
+ LOG_TRACE(INFO,
+ "EMM-PROC - Initiate EPS attach with NO IMSI, is registered PLMN %d, is equivalent PLMN %d",
+ _emm_data.is_rplmn,
+ _emm_data.is_eplmn);
+ }
+ } else if (_emm_data.guti) {
+ LOG_TRACE(INFO, "EMM-PROC - Initiate EPS attach with GUTI");
+ /* Include a valid GUTI and the last visited registered TAI */
+ emm_as->UEid.guti = _emm_data.guti;
+ emm_as->UEid.tai = _emm_data.tai;
+ } else if (!_emm_data.is_emergency) {
+ LOG_TRACE(INFO, "EMM-PROC - Initiate EPS attach with IMSI cause is no emergency and no GUTI");
+ /* Include the IMSI if no valid GUTI is available */
+ emm_as->UEid.imsi = _emm_data.imsi;
+ } else {
+ /* The UE is attaching for emergency bearer services and
+ * does not hold a valid GUTI */
+ if (_emm_data.imsi) {
+ /* Include the IMSI if valid (USIM is present) */
+ LOG_TRACE(INFO, "EMM-PROC - Initiate EPS attach with IMSI cause is emergency and no GUTI");
+ emm_as->UEid.imsi = _emm_data.imsi;
+ } else {
+ LOG_TRACE(INFO, "EMM-PROC - Initiate EPS attach with IMSI cause is emergency and no GUTI and no IMSI");
+ /* Include the IMEI if the IMSI is not valid */
+ emm_as->UEid.imei = _emm_data.imei;
+ }
+ }
+
+ /* Setup EPS NAS security data */
+ emm_as_set_security_data(&emm_as->sctx, _emm_data.security, FALSE, FALSE);
+ emm_as->ksi = EMM_AS_NO_KEY_AVAILABLE;
+
+ if (_emm_data.security) {
+ if (_emm_data.security->type != EMM_KSI_NOT_AVAILABLE) {
+ emm_as->ksi = _emm_data.security->eksi;
+ }
+
+ LOG_TRACE(INFO, "EMM-PROC - eps_encryption 0x%X", _emm_data.security->capability.eps_encryption);
+ LOG_TRACE(INFO, "EMM-PROC - eps_integrity 0x%X", _emm_data.security->capability.eps_integrity);
+ emm_as->encryption = _emm_data.security->capability.eps_encryption;
+ emm_as->integrity = _emm_data.security->capability.eps_integrity;
+ }
+
+ /*
+ * Notify ESM that initiation of a PDN connectivity procedure
+ * is requested to setup a default EPS bearer
+ */
+ esm_sap.primitive = ESM_PDN_CONNECTIVITY_REQ;
+ esm_sap.is_standalone = FALSE;
+ esm_sap.data.pdn_connect.is_defined = TRUE;
+ esm_sap.data.pdn_connect.cid = 1;
+ /* TODO: PDN type should be set according to the IP capability of the UE */
+ esm_sap.data.pdn_connect.pdn_type = NET_PDN_TYPE_IPV4V6;
+ esm_sap.data.pdn_connect.apn = NULL;
+ esm_sap.data.pdn_connect.is_emergency = _emm_data.is_emergency;
+ rc = esm_sap_send(&esm_sap);
+
+ if (rc != RETURNerror) {
+ /* Setup EMM procedure handler to be executed upon receiving
+ * lower layer notification */
+ rc = emm_proc_lowerlayer_initialize(emm_proc_attach_request,
+ emm_proc_attach_failure,
+ emm_proc_attach_release, NULL);
+
+ if (rc != RETURNok) {
+ LOG_TRACE(WARNING, "Failed to initialize EMM procedure handler");
+ LOG_FUNC_RETURN (RETURNerror);
+ }
+
+ /* Start T3410 timer */
+ T3410.id = nas_timer_start(T3410.sec, _emm_attach_t3410_handler, NULL);
+ LOG_TRACE(INFO,"EMM-PROC - Timer T3410 (%d) expires in %ld seconds",
+ T3410.id, T3410.sec);
+ /* Stop T3402 and T3411 timers if running */
+ T3402.id = nas_timer_stop(T3402.id);
+ T3411.id = nas_timer_stop(T3411.id);
+
+ /*
+ * Notify EMM-AS SAP that a RRC connection establishment procedure
+ * is requested from the Access-Stratum to send initial NAS message
+ * attach request to the network
+ */
+ emm_sap.primitive = EMMAS_ESTABLISH_REQ;
+ /* Get the PDN connectivity request to transfer within the ESM
+ * container of the initial attach request message */
+ emm_sap.u.emm_as.u.establish.NASmsg = esm_sap.send;
+ rc = emm_sap_send(&emm_sap);
+ }
+
+ LOG_FUNC_RETURN(rc);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: emm_proc_attach_request() **
+ ** **
+ ** Description: Performs the attach procedure upon receipt of indication **
+ ** from lower layers that Attach Request message has been **
+ ** successfully delivered to the network. **
+ ** **
+ ** Inputs: args: Not used **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int emm_proc_attach_request(void *args)
+{
+ LOG_FUNC_IN;
+
+ emm_sap_t emm_sap;
+ int rc;
+
+ /*
+ * Notify EMM that Attach Request has been sent to the network
+ */
+ emm_sap.primitive = EMMREG_ATTACH_REQ;
+ rc = emm_sap_send(&emm_sap);
+
+ LOG_FUNC_RETURN(rc);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: emm_proc_attach_accept() **
+ ** **
+ ** Description: Performs the attach procedure accepted by the network. **
+ ** **
+ ** 3GPP TS 24.301, section 5.5.1.2.4 **
+ ** Upon receiving the ATTACH ACCEPT message, the UE shall **
+ ** stop timer T3410 and send an ATTACH COMPLETE message to **
+ ** the MME. **
+ ** **
+ ** Inputs: t3412: Value of the T3412 timer in seconds **
+ ** t3402: Value of the T3402 timer in seconds **
+ ** t3423: Value of the T3423 timer in seconds **
+ ** n_tais: Number of tracking area identities contai- **
+ ** ned in the TAI list **
+ ** tai: The TAI list that identifies the tracking **
+ ** areas the UE is registered to **
+ ** guti: New UE's temporary identity assigned by **
+ ** the MME (GUTI reallocation) **
+ ** n_eplmns: Number of equivalent PLMNs **
+ ** eplmns: List of equivalent PLMNs **
+ ** esm_msg_pP: Activate default EPS bearer context re- **
+ ** quest ESM message **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: _emm_data, T3412, T3402, T3423 **
+ ** **
+ ***************************************************************************/
+int emm_proc_attach_accept(long t3412, long t3402, long t3423,
+ int n_tais, tai_t *tai, GUTI_t *guti,
+ int n_eplmns, plmn_t *eplmn,
+ const OctetString *esm_msg_pP)
+{
+ LOG_FUNC_IN;
+
+ emm_sap_t emm_sap;
+ esm_sap_t esm_sap;
+ int rc;
+ int i;
+ int j;
+
+ LOG_TRACE(INFO, "EMM-PROC - EPS attach accepted by the network");
+
+ /* Stop timer T3410 */
+ LOG_TRACE(INFO, "EMM-PROC - Stop timer T3410 (%d)", T3410.id);
+ T3410.id = nas_timer_stop(T3410.id);
+
+ /* Delete old TAI list and store the received TAI list */
+ _emm_data.ltai.n_tais = n_tais;
+
+ for (i = 0; (i < n_tais) && (i < EMM_DATA_TAI_MAX); i++) {
+ _emm_data.ltai.tai[i] = tai[i];
+ }
+
+ /* Update periodic tracking area update timer value */
+ T3412.sec = t3412;
+
+ /* Update attach failure timer value */
+ if ( !(t3402 < 0) ) {
+ T3402.sec = t3402;
+ }
+
+ /* Update E-UTRAN deactivate ISR timer value */
+ if ( !(t3423 < 0) ) {
+ T3423.sec = t3423;
+ }
+
+ /* Delete old GUTI and store the new assigned GUTI if provided */
+ if (guti) {
+ *_emm_data.guti = *guti;
+ }
+
+ /* Update the stored list of equivalent PLMNs */
+ _emm_data.nvdata.eplmn.n_plmns = 0;
+
+ if (n_eplmns > 0) {
+ for (i = 0; (i < n_eplmns) && (i < EMM_DATA_EPLMN_MAX); i++) {
+ int is_forbidden = FALSE;
+
+ if (!_emm_data.is_emergency) {
+ /* If the attach procedure is not for emergency bearer
+ * services, the UE shall remove from the list any PLMN
+ * code that is already in the list of forbidden PLMNs */
+ for (j = 0; j < _emm_data.fplmn.n_plmns; j++) {
+ if (PLMNS_ARE_EQUAL(eplmn[i], _emm_data.fplmn.plmn[j])) {
+ is_forbidden = TRUE;
+ break;
+ }
+ }
+ }
+
+ if ( !is_forbidden ) {
+ _emm_data.nvdata.eplmn.plmn[_emm_data.nvdata.eplmn.n_plmns++] =
+ eplmn[i];
+ }
+ }
+
+ /* Add the PLMN code of the registered PLMN that sent the list */
+ if (_emm_data.nvdata.eplmn.n_plmns < EMM_DATA_EPLMN_MAX) {
+ _emm_data.nvdata.eplmn.plmn[_emm_data.nvdata.eplmn.n_plmns++] =
+ _emm_data.splmn;
+ }
+ }
+
+ /*
+ * Notify ESM that a default EPS bearer has to be activated
+ */
+ esm_sap.primitive = ESM_DEFAULT_EPS_BEARER_CONTEXT_ACTIVATE_REQ;
+ esm_sap.is_standalone = FALSE;
+ esm_sap.recv = esm_msg_pP;
+ rc = esm_sap_send(&esm_sap);
+
+ if ( (rc != RETURNerror) && (esm_sap.err == ESM_SAP_SUCCESS) ) {
+ /* Setup EMM procedure handler to be executed upon receiving
+ * lower layer notification */
+ rc = emm_proc_lowerlayer_initialize(emm_proc_attach_complete,
+ emm_proc_attach_failure,
+ NULL, NULL);
+
+ if (rc != RETURNok) {
+ LOG_TRACE(WARNING,
+ "EMM-PROC - Failed to initialize EMM procedure handler");
+ LOG_FUNC_RETURN (RETURNerror);
+ }
+
+ /*
+ * Notify EMM-AS SAP that Attach Complete message together with
+ * an Activate Default EPS Bearer Context Accept message has to
+ * be sent to the network
+ */
+ emm_sap.primitive = EMMAS_DATA_REQ;
+ emm_sap.u.emm_as.u.data.guti = _emm_data.guti;
+ emm_sap.u.emm_as.u.data.ueid = 0;
+ /* Setup EPS NAS security data */
+ emm_as_set_security_data(&emm_sap.u.emm_as.u.data.sctx,
+ _emm_data.security, FALSE, TRUE);
+ /* Get the activate default EPS bearer context accept message
+ * to be transfered within the ESM container of the attach
+ * complete message */
+ emm_sap.u.emm_as.u.data.NASinfo = EMM_AS_NAS_DATA_ATTACH;
+ emm_sap.u.emm_as.u.data.NASmsg = esm_sap.send;
+ rc = emm_sap_send(&emm_sap);
+ } else if (esm_sap.err != ESM_SAP_DISCARDED) {
+ /* 3GPP TS 24.301, section 5.5.1.2.6, case j
+ * If the ACTIVATE DEFAULT BEARER CONTEXT REQUEST message combined
+ * with the ATTACH ACCEPT is not accepted by the UE due to failure
+ * in the UE ESM sublayer, then the UE shall initiate the detach
+ * procedure by sending a DETACH REQUEST message to the network.
+ */
+ emm_sap.primitive = EMMREG_DETACH_INIT;
+ rc = emm_sap_send(&emm_sap);
+ } else {
+ /*
+ * ESM procedure failed and, received message has been discarded or
+ * Status message has been returned; ignore ESM procedure failure
+ */
+ rc = RETURNok;
+ }
+
+ LOG_FUNC_RETURN(rc);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: emm_proc_attach_reject() **
+ ** **
+ ** Description: Performs the attach procedure rejected by the network. **
+ ** **
+ ** 3GPP TS 24.301, section 5.5.1.2.5 **
+ ** Upon receiving the ATTACH REJECT message, the UE shall **
+ ** stop timer T3410 and take actions depending on the EMM **
+ ** cause value received. **
+ ** **
+ ** Inputs: emm_cause: EMM cause indicating why the network re- **
+ ** jected the attach request **
+ ** esm_msg_pP: PDN connectivity reject ESM message **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: _emm_data, _emm_attach_data, T3410 **
+ ** **
+ ***************************************************************************/
+int emm_proc_attach_reject(int emm_cause, const OctetString *esm_msg_pP)
+{
+ LOG_FUNC_IN;
+
+ emm_sap_t emm_sap;
+ int rc;
+
+ LOG_TRACE(WARNING, "EMM-PROC - EPS attach rejected by the network, "
+ "EMM cause = %d", emm_cause);
+
+ /* Stop timer T3410 */
+ LOG_TRACE(INFO, "EMM-PROC - Stop timer T3410 (%d)", T3410.id);
+ T3410.id = nas_timer_stop(T3410.id);
+
+ /* Update the EPS update status, the GUTI, the visited registered TAI and
+ * the eKSI */
+ switch (emm_cause) {
+ case EMM_CAUSE_ILLEGAL_UE:
+ case EMM_CAUSE_ILLEGAL_ME:
+ case EMM_CAUSE_EPS_NOT_ALLOWED:
+ case EMM_CAUSE_BOTH_NOT_ALLOWED:
+ case EMM_CAUSE_PLMN_NOT_ALLOWED:
+ case EMM_CAUSE_NOT_AUTHORIZED_IN_PLMN:
+ case EMM_CAUSE_EPS_NOT_ALLOWED_IN_PLMN:
+ case EMM_CAUSE_TA_NOT_ALLOWED:
+ case EMM_CAUSE_ROAMING_NOT_ALLOWED:
+ case EMM_CAUSE_NO_SUITABLE_CELLS:
+ /* Set the EPS update status to EU3 ROAMING NOT ALLOWED */
+ _emm_data.status = EU3_ROAMING_NOT_ALLOWED;
+ /* Delete the GUTI */
+ _emm_data.guti = NULL;
+ /* Delete the last visited registered TAI */
+ _emm_data.tai = NULL;
+
+ /* Delete the eKSI */
+ if (_emm_data.security) {
+ _emm_data.security->type = EMM_KSI_NOT_AVAILABLE;
+ }
+
+ break;
+
+ default :
+ break;
+ }
+
+ /* Update list of equivalents PLMNs and attach attempt counter */
+ switch (emm_cause) {
+ case EMM_CAUSE_ILLEGAL_UE:
+ case EMM_CAUSE_ILLEGAL_ME:
+ case EMM_CAUSE_EPS_NOT_ALLOWED:
+ case EMM_CAUSE_BOTH_NOT_ALLOWED:
+ /* Consider the USIM as invalid for EPS services */
+ _emm_data.usim_is_valid = FALSE;
+ /* Delete the list of equivalent PLMNs */
+ _emm_data.nvdata.eplmn.n_plmns = 0;
+ break;
+
+ case EMM_CAUSE_PLMN_NOT_ALLOWED:
+ case EMM_CAUSE_NOT_AUTHORIZED_IN_PLMN:
+ case EMM_CAUSE_ROAMING_NOT_ALLOWED:
+ /* Delete the list of equivalent PLMNs */
+ _emm_data.nvdata.eplmn.n_plmns = 0;
+ /* Reset the attach attempt counter */
+ _emm_attach_data.attempt_count = 0;
+ break;
+
+ case EMM_CAUSE_TA_NOT_ALLOWED:
+ case EMM_CAUSE_EPS_NOT_ALLOWED_IN_PLMN:
+ case EMM_CAUSE_NO_SUITABLE_CELLS:
+ /* Reset the attach attempt counter */
+ _emm_attach_data.attempt_count = 0;
+ break;
+
+ case EMM_CAUSE_ESM_FAILURE:
+
+ /* 3GPP TS 24.301, section 5.5.1.2.6, case d */
+ if (_emm_data.NAS_SignallingPriority != 1) {
+ /* The UE is not configured for NAS signalling low priority;
+ * set the attach attempt counter to 5 */
+ _emm_attach_data.attempt_count = EMM_ATTACH_COUNTER_MAX;
+ }
+
+ break;
+
+ case EMM_CAUSE_SEMANTICALLY_INCORRECT:
+ case EMM_CAUSE_INVALID_MANDATORY_INFO:
+ case EMM_CAUSE_MESSAGE_TYPE_NOT_IMPLEMENTED:
+ case EMM_CAUSE_IE_NOT_IMPLEMENTED:
+ case EMM_CAUSE_PROTOCOL_ERROR:
+ /* 3GPP TS 24.301, section 5.5.1.2.6, case d
+ * Set the attach attempt counter to 5 */
+ _emm_attach_data.attempt_count = EMM_ATTACH_COUNTER_MAX;
+ break;
+
+ default :
+ break;
+ }
+
+ /* Update "forbidden lists" */
+ switch (emm_cause) {
+ case EMM_CAUSE_PLMN_NOT_ALLOWED:
+ case EMM_CAUSE_NOT_AUTHORIZED_IN_PLMN:
+ /* Store the PLMN identity in the "forbidden PLMN list" */
+ _emm_data.fplmn.plmn[_emm_data.fplmn.n_plmns++] = _emm_data.splmn;
+ break;
+
+ case EMM_CAUSE_TA_NOT_ALLOWED:
+ /* Store the current TAI in the list of "forbidden tracking
+ * areas for regional provision of service" */
+ _emm_data.ftai.tai[_emm_data.ftai.n_tais++] = *_emm_data.tai;
+ break;
+
+ case EMM_CAUSE_ROAMING_NOT_ALLOWED:
+ /* Store the current TAI in the list of "forbidden tracking
+ * areas for roaming" */
+ _emm_data.ftai_roaming.tai[_emm_data.ftai_roaming.n_tais++] = *_emm_data.tai;
+ break;
+
+ case EMM_CAUSE_EPS_NOT_ALLOWED_IN_PLMN:
+ /* Store the PLMN identity in the "forbidden PLMNs for GPRS
+ * service" list */
+ _emm_data.fplmn_gprs.plmn[_emm_data.fplmn_gprs.n_plmns++] = _emm_data.splmn;
+ break;
+
+ default :
+ break;
+ }
+
+ /* Update state of EMM sublayer */
+ switch (emm_cause) {
+ case EMM_CAUSE_ILLEGAL_UE:
+ case EMM_CAUSE_ILLEGAL_ME:
+ case EMM_CAUSE_EPS_NOT_ALLOWED:
+ case EMM_CAUSE_BOTH_NOT_ALLOWED:
+ /*
+ * Notify EMM that EPS attach is rejected
+ */
+ emm_sap.primitive = EMMREG_ATTACH_REJ;
+ break;
+
+ case EMM_CAUSE_PLMN_NOT_ALLOWED:
+ case EMM_CAUSE_NOT_AUTHORIZED_IN_PLMN:
+ case EMM_CAUSE_EPS_NOT_ALLOWED_IN_PLMN:
+ /*
+ * Notify EMM that the UE has to perform a PLMN selection because
+ * it is not allowed to operate in the currently selected PLMN
+ */
+ emm_sap.primitive = EMMREG_REGISTER_REQ;
+ break;
+
+ case EMM_CAUSE_TA_NOT_ALLOWED:
+ case EMM_CAUSE_ROAMING_NOT_ALLOWED:
+ case EMM_CAUSE_NO_SUITABLE_CELLS:
+ /*
+ * Notify EMM that the UE failed to register to the network for
+ * EPS services because it is not allowed to operate in the
+ * requested tracking area
+ */
+ emm_sap.primitive = EMMREG_REGISTER_REJ;
+ break;
+
+ case EMM_CAUSE_IMEI_NOT_ACCEPTED:
+ if (_emm_data.is_emergency) {
+ /*
+ * Notify EMM that the UE failed to register to the network
+ * for emergency bearer services because "IMEI not accepted"
+ */
+ emm_sap.primitive = EMMREG_NO_IMSI;
+ break;
+ }
+
+ /* break is volontary missing */
+
+ default :
+ /* Other values are considered as abnormal cases
+ * 3GPP TS 24.301, section 5.5.1.2.6, case d */
+ _emm_attach_abnormal_cases_bcd(&emm_sap);
+ break;
+ }
+
+ rc = emm_sap_send(&emm_sap);
+
+ /*
+ * Notify ESM that the network rejected connectivity to the PDN
+ */
+ if (esm_msg_pP != NULL) {
+ esm_sap_t esm_sap;
+ esm_sap.primitive = ESM_PDN_CONNECTIVITY_REJ;
+ esm_sap.is_standalone = FALSE;
+ esm_sap.recv = esm_msg_pP;
+ rc = esm_sap_send(&esm_sap);
+ }
+
+ LOG_FUNC_RETURN(rc);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: emm_proc_attach_complete() **
+ ** **
+ ** Description: Terminates the attach procedure when Attach Complete mes- **
+ ** sage has been successfully delivered to the MME. **
+ ** **
+ ** 3GPP TS 24.301, section 5.5.1.2.4 **
+ ** Upon successfully sending the ATTACH COMPLETE message, **
+ ** the UE shall reset the attach attempt counter and tra- **
+ ** cking area updating attempt counter, enter state EMM- **
+ ** REGISTERED and set the EPS update status to EU1-UPDATED. **
+ ** **
+ ** Inputs: args: Not used **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: _emm_data, _emm_attach_data **
+ ** **
+ ***************************************************************************/
+int emm_proc_attach_complete(void *args)
+{
+ LOG_FUNC_IN;
+
+ emm_sap_t emm_sap;
+ esm_sap_t esm_sap;
+ int rc;
+
+ LOG_TRACE(INFO, "EMM-PROC - EPS attach complete");
+
+ /* Reset EMM procedure handler */
+ (void) emm_proc_lowerlayer_initialize(NULL, NULL, NULL, NULL);
+
+ /* Reset the attach attempt counter */
+ _emm_attach_data.attempt_count = 0;
+ /* TODO: Reset the tracking area updating attempt counter */
+
+ /* Set the EPS update status to EU1 UPDATED */
+ _emm_data.status = EU1_UPDATED;
+ _emm_data.is_attached = TRUE;
+
+ /*
+ * Notify EMM that network attach complete message has been delivered
+ * to the network
+ */
+ emm_sap.primitive = EMMREG_ATTACH_CNF;
+ rc = emm_sap_send(&emm_sap);
+
+ if (rc != RETURNerror) {
+ /*
+ * Notify ESM that the Activate Default EPS Bearer Context Accept
+ * message has been delivered to the network within the Attach
+ * Complete message
+ */
+ esm_sap.primitive = ESM_DEFAULT_EPS_BEARER_CONTEXT_ACTIVATE_CNF;
+ esm_sap.is_standalone = FALSE;
+ rc = esm_sap_send(&esm_sap);
+ }
+
+ LOG_FUNC_RETURN(rc);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: emm_proc_attach_failure() **
+ ** **
+ ** Description: Performs the attach procedure abnormal case upon receipt **
+ ** of transmission failure of Attach Request message or At- **
+ ** tach Complete message. **
+ ** **
+ ** 3GPP TS 24.301, section 5.5.1.2.6, cases h and i **
+ ** The UE shall restart the attach procedure when timer **
+ ** T3411 expires. **
+ ** **
+ ** Inputs: is_initial: TRUE if the NAS message that failed to be **
+ ** transfered is an initial NAS message (ESM **
+ ** message embedded within an Attach Request **
+ ** message) **
+ ** args: Not used **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: T3410, T3411 **
+ ** **
+ ***************************************************************************/
+int emm_proc_attach_failure(int is_initial, void *args)
+{
+ LOG_FUNC_IN;
+
+ int rc = RETURNok;
+ esm_sap_t esm_sap;
+
+ LOG_TRACE(WARNING, "EMM-PROC - EPS attach failure");
+
+ /* Reset EMM procedure handler */
+ (void) emm_proc_lowerlayer_initialize(NULL, NULL, NULL, NULL);
+
+ /* Stop timer T3410 if still running */
+ if (T3410.id != NAS_TIMER_INACTIVE_ID) {
+ LOG_TRACE(INFO, "EMM-PROC - Stop timer T3410 (%d)", T3410.id);
+ T3410.id = nas_timer_stop(T3410.id);
+ }
+
+ if (is_initial) {
+ /*
+ * Notify ESM that the PDN CONNECTIVITY REQUEST message contained
+ * in the ESM message container IE of the ATTACH REQUEST has failed
+ * to be transmitted
+ */
+ esm_sap.primitive = ESM_PDN_CONNECTIVITY_REJ;
+ esm_sap.is_standalone = FALSE;
+ esm_sap.recv = NULL;
+ } else {
+ /*
+ * Notify ESM that ACTIVATE DEFAULT EPS BEARER CONTEXT REQUEST message
+ * contained in the ESM message container IE of the ATTACH COMPLETE
+ * has failed to be transmitted
+ */
+ esm_sap.primitive = ESM_DEFAULT_EPS_BEARER_CONTEXT_ACTIVATE_REJ;
+ esm_sap.is_standalone = FALSE;
+ esm_sap.recv = NULL;
+ }
+
+ rc = esm_sap_send(&esm_sap);
+
+ if (rc != RETURNerror) {
+ /* Start T3411 timer */
+ T3411.id = nas_timer_start(T3411.sec, _emm_attach_t3411_handler, NULL);
+ LOG_TRACE(INFO, "EMM-PROC - Timer T3411 (%d) expires in %ld seconds",
+ T3411.id, T3411.sec);
+ }
+
+ LOG_FUNC_RETURN(rc);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: emm_proc_attach_release() **
+ ** **
+ ** Description: Performs the attach procedure abnormal case upon receipt **
+ ** of NAS signalling connection release indication. **
+ ** **
+ ** 3GPP TS 24.301, section 5.5.1.2.6, case b **
+ ** The attach procedure shall be aborted and the UE shall **
+ ** execute abnormal case attach procedure. **
+ ** **
+ ** Inputs: args: Not used **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int emm_proc_attach_release(void *args)
+{
+ LOG_FUNC_IN;
+
+ emm_sap_t emm_sap;
+ int rc;
+
+ LOG_TRACE(WARNING, "EMM-PROC - NAS signalling connection released");
+
+ /* Execute abnormal case attach procedure */
+ _emm_attach_abnormal_cases_bcd(&emm_sap);
+
+ rc = emm_sap_send(&emm_sap);
+
+ LOG_FUNC_RETURN(rc);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: emm_proc_attach_restart() **
+ ** **
+ ** Description: Restarts the attach procedure **
+ ** **
+ ** Inputs: None **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int emm_proc_attach_restart(void)
+{
+ LOG_FUNC_IN;
+
+ emm_sap_t emm_sap;
+ int rc;
+
+ LOG_TRACE(INFO, "EMM-PROC - Restart EPS attach procedure");
+
+ /*
+ * Notify EMM that the attach procedure has to be restarted
+ */
+ emm_sap.primitive = EMMREG_ATTACH_INIT;
+ emm_sap.u.emm_reg.u.attach.is_emergency = _emm_data.is_emergency;
+ rc = emm_sap_send(&emm_sap);
+
+ LOG_FUNC_RETURN(rc);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: emm_proc_attach_set_emergency() **
+ ** **
+ ** Description: Set the emergency bearer services indicator **
+ ** **
+ ** Inputs: None **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: _emm_data **
+ ** **
+ ***************************************************************************/
+int emm_proc_attach_set_emergency(void)
+{
+ LOG_FUNC_IN;
+
+ LOG_TRACE(WARNING, "EMM-PROC - UE is now attached to the network for "
+ "emergency bearer services only");
+
+ _emm_data.is_emergency = TRUE;
+
+ LOG_FUNC_RETURN(RETURNok);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: emm_proc_attach_set_detach() **
+ ** **
+ ** Description: Reset the network attachment indicator and enter state **
+ ** EMM-DEREGISTERED
+ ** **
+ ** Inputs: None **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: _emm_data **
+ ** **
+ ***************************************************************************/
+int emm_proc_attach_set_detach(void)
+{
+ LOG_FUNC_IN;
+
+ int rc;
+
+ LOG_TRACE(WARNING,
+ "EMM-PROC - UE is now locally detached from the network");
+
+ /* Reset the network attachment indicator */
+ _emm_data.is_attached = FALSE;
+ /*
+ * Notify that the UE is locally detached from the network
+ */
+ emm_sap_t emm_sap;
+ emm_sap.primitive = EMMREG_DETACH_CNF;
+ rc = emm_sap_send(&emm_sap);
+
+ LOG_FUNC_RETURN(rc);
+}
+
+
+/****************************************************************************/
+/********************* L O C A L F U N C T I O N S *********************/
+/****************************************************************************/
+
+/*
+ * --------------------------------------------------------------------------
+ * Timer handlers
+ * --------------------------------------------------------------------------
+ */
+
+/****************************************************************************
+ ** **
+ ** Name: _emm_attach_t3410_handler() **
+ ** **
+ ** Description: T3410 timeout handler **
+ ** **
+ ** 3GPP TS 24.301, section 5.5.1.2.6, case c **
+ ** Upon T3410 timer expiration, the attach procedure shall **
+ ** be aborted and the UE shall execute abnormal case attach **
+ ** procedure. **
+ ** The NAS signalling connection shall be released locally. **
+ ** **
+ ** Inputs: args: handler parameters **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: None **
+ ** Others: T3410 **
+ ** **
+ ***************************************************************************/
+void *_emm_attach_t3410_handler(void *args)
+{
+ LOG_FUNC_IN;
+
+ emm_sap_t emm_sap;
+ int rc;
+
+ LOG_TRACE(WARNING, "EMM-PROC - T3410 timer expired");
+
+ /* Stop T3410 timer */
+ T3410.id = nas_timer_stop(T3410.id);
+ /* Execute abnormal case attach procedure */
+ _emm_attach_abnormal_cases_bcd(&emm_sap);
+
+ rc = emm_sap_send(&emm_sap);
+
+ if (rc != RETURNerror) {
+ /* Locally release the NAS signalling connection */
+ _emm_data.ecm_status = ECM_IDLE;
+ }
+
+ LOG_FUNC_RETURN(NULL);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: _emm_attach_t3411_handler() **
+ ** **
+ ** Description: T3411 timeout handler **
+ ** **
+ ** 3GPP TS 24.301, section 5.5.1.2.6 **
+ ** Upon T3411 timer expiration, the attach procedure shall **
+ ** be restarted, if still required by ESM sublayer. **
+ ** **
+ ** Inputs: args: handler parameters **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: None **
+ ** Others: T3411 **
+ ** **
+ ***************************************************************************/
+static void *_emm_attach_t3411_handler(void *args)
+{
+ LOG_FUNC_IN;
+
+ emm_sap_t emm_sap;
+
+ LOG_TRACE(WARNING, "EMM-PROC - T3411 timer expired");
+
+ /* Stop T3411 timer */
+ T3411.id = nas_timer_stop(T3411.id);
+ /*
+ * Notify EMM that timer T3411 expired and attach procedure has to be
+ * restarted
+ */
+ emm_sap.primitive = EMMREG_ATTACH_INIT;
+ emm_sap.u.emm_reg.u.attach.is_emergency = _emm_data.is_emergency;
+
+ (void) emm_sap_send(&emm_sap);
+
+ LOG_FUNC_RETURN(NULL);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: _emm_attach_t3402_handler() **
+ ** **
+ ** Description: T3402 timeout handler **
+ ** **
+ ** Upon T3402 timer expiration: **
+ ** 3GPP TS 24.301, section 5.5.1.1 **
+ ** the attach attempt counter shall be reset when the UE is **
+ ** in substate DEREGISTERED.ATTEMPTING-TO-ATTACH; **
+ ** 3GPP TS 24.301, section 5.2.2.3.3 **
+ ** the UE shall initiate an attach or combined attach proce- **
+ ** dure in substate DEREGISTERED.ATTEMPTING-TO-ATTACH; **
+ ** **
+ ** Inputs: args: handler parameters **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: None **
+ ** Others: _emm_attach_data, T3402 **
+ ** **
+ ***************************************************************************/
+static void *_emm_attach_t3402_handler(void *args)
+{
+ LOG_FUNC_IN;
+
+ emm_sap_t emm_sap;
+
+ LOG_TRACE(WARNING, "EMM-PROC - T3402 timer expired");
+
+ /* Stop T3402 timer */
+ T3402.id = nas_timer_stop(T3402.id);
+ /* Reset the attach attempt counter */
+ _emm_attach_data.attempt_count = 0;
+ /*
+ * Notify EMM that timer T3402 expired and attach procedure has to be
+ * restarted
+ */
+ emm_sap.primitive = EMMREG_ATTACH_INIT;
+ emm_sap.u.emm_reg.u.attach.is_emergency = _emm_data.is_emergency;
+
+ (void) emm_sap_send(&emm_sap);
+
+ LOG_FUNC_RETURN(NULL);
+}
+
+/*
+ * --------------------------------------------------------------------------
+ * Abnormal cases in the UE
+ * --------------------------------------------------------------------------
+ */
+
+/****************************************************************************
+ ** **
+ ** Name: _emm_attach_abnormal_cases_bcd() **
+ ** **
+ ** Description: Performs the abnormal case attach procedure. **
+ ** **
+ ** 3GPP TS 24.301, section 5.5.1.2.6, cases b, c and d **
+ ** The Timer T3410 shall be stopped if still running, the **
+ ** attach attempt counter shall be incremented and the UE **
+ ** shall proceed depending on whether the attach attempt **
+ ** counter reached its maximum value or not. **
+ ** **
+ ** Inputs: None **
+ ** Others: None **
+ ** **
+ ** Outputs: emm_sap: EMM service access point **
+ ** Return: None **
+ ** Others: _emm_data, _emm_attach_data, T3402, T3410, **
+ ** T3411 **
+ ** **
+ ***************************************************************************/
+static void _emm_attach_abnormal_cases_bcd(emm_sap_t *emm_sap)
+{
+ LOG_FUNC_IN;
+
+ LOG_TRACE(WARNING, "EMM-PROC - Abnormal case, attach counter = %d",
+ _emm_attach_data.attempt_count);
+
+ /* Stop timer T3410 */
+ if (T3410.id != NAS_TIMER_INACTIVE_ID) {
+ LOG_TRACE(INFO, "EMM-PROC - Stop timer T3410 (%d)", T3410.id);
+ T3410.id = nas_timer_stop(T3410.id);
+ }
+
+ if (_emm_attach_data.attempt_count < EMM_ATTACH_COUNTER_MAX) {
+ /* Increment the attach attempt counter */
+ _emm_attach_data.attempt_count += 1;
+ /* Start T3411 timer */
+ T3411.id = nas_timer_start(T3411.sec, _emm_attach_t3411_handler, NULL);
+ LOG_TRACE(INFO, "EMM-PROC - Timer T3411 (%d) expires in %ld seconds",
+ T3411.id, T3411.sec);
+ /*
+ * Notify EMM that the attempt to attach for EPS services failed and
+ * the attach attempt counter didn't reach its maximum value; network
+ * attach procedure shall be restarted when timer T3411 expires.
+ */
+ emm_sap->primitive = EMMREG_ATTACH_FAILED;
+ } else {
+ /* Delete the GUTI */
+ _emm_data.guti = NULL;
+ /* Delete the TAI list */
+ _emm_data.ltai.n_tais = 0;
+ /* Delete the last visited registered TAI */
+ _emm_data.tai = NULL;
+ /* Delete the list of equivalent PLMNs */
+ _emm_data.nvdata.eplmn.n_plmns = 0;
+
+ /* Delete the eKSI */
+ if (_emm_data.security) {
+ _emm_data.security->type = EMM_KSI_NOT_AVAILABLE;
+ }
+
+ /* Set the EPS update status to EU2 NOT UPDATED */
+ _emm_data.status = EU2_NOT_UPDATED;
+
+ /* Start T3402 timer */
+ T3402.id = nas_timer_start(T3402.sec, _emm_attach_t3402_handler, NULL);
+ LOG_TRACE(INFO, "EMM-PROC - Timer T3402 (%d) expires in %ld seconds",
+ T3402.id, T3402.sec);
+ /*
+ * Notify EMM that the attempt to attach for EPS services failed and
+ * the attach attempt counter reached its maximum value.
+ */
+ emm_sap->primitive = EMMREG_ATTACH_EXCEEDED;
+ }
+
+ LOG_FUNC_OUT;
+}
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/Authentication.c b/openair-cn/NAS/UE/EMM/Authentication.c
old mode 100644
new mode 100755
similarity index 66%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/Authentication.c
rename to openair-cn/NAS/UE/EMM/Authentication.c
index 9fb9498089..e0acb302ac
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/Authentication.c
+++ b/openair-cn/NAS/UE/EMM/Authentication.c
@@ -70,23 +70,14 @@ Description Defines the authentication EMM procedure executed by the
#include "emm_sap.h"
#include "emm_cause.h"
-#ifdef NAS_UE
#include "usim_api.h"
#include "secu_defs.h"
-#endif
-#ifdef NAS_MME
-# if defined(NAS_BUILT_IN_EPC)
-# include "nas_itti_messaging.h"
-# endif
-#include "msc.h"
-#endif
/****************************************************************************/
/**************** E X T E R N A L D E F I N I T I O N S ****************/
/****************************************************************************/
-#ifdef NAS_UE
/*
* Retransmission timer handlers
*/
@@ -94,7 +85,6 @@ extern void *_emm_attach_t3410_handler(void *);
extern void *_emm_service_t3417_handler(void *);
extern void *_emm_detach_t3421_handler(void *);
extern void *_emm_tau_t3430_handler(void *);
-#endif // NAS_UE
/****************************************************************************/
/******************* L O C A L D E F I N I T I O N S *******************/
@@ -105,7 +95,6 @@ extern void *_emm_tau_t3430_handler(void *);
* Internal data handled by the authentication procedure in the UE
* --------------------------------------------------------------------------
*/
-#ifdef NAS_UE
/*
* Timer handlers
*/
@@ -144,44 +133,12 @@ static int _authentication_start_timers(void);
static int _authentication_kasme(const OctetString *autn,
const OctetString *ck, const OctetString *ik, const plmn_t *plmn,
OctetString *kasme);
-#endif // NAS_UE
/*
* --------------------------------------------------------------------------
* Internal data handled by the authentication procedure in the MME
* --------------------------------------------------------------------------
*/
-#ifdef NAS_MME
-/*
- * Timer handlers
- */
-static void *_authentication_t3460_handler(void *);
-
-/*
- * Function executed whenever the ongoing EMM procedure that initiated
- * the authentication procedure is aborted or the maximum value of the
- * retransmission timer counter is exceed
- */
-static int _authentication_abort(void *);
-
-/*
- * Internal data used for authentication procedure
- */
-typedef struct {
- unsigned int ueid; /* UE identifier */
-#define AUTHENTICATION_COUNTER_MAX 5
- unsigned int retransmission_count; /* Retransmission counter */
- int ksi; /* NAS key set identifier */
- OctetString rand; /* Random challenge number */
- OctetString autn; /* Authentication token */
- int notify_failure; /* Indicates whether the authentication
- * procedure failure shall be notified
- * to the ongoing EMM procedure */
-} authentication_data_t;
-
-static int _authentication_request(authentication_data_t *data);
-static int _authentication_reject(unsigned int ueid);
-#endif // NAS_MME
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
@@ -192,7 +149,6 @@ static int _authentication_reject(unsigned int ueid);
* Authentication procedure executed by the UE
* --------------------------------------------------------------------------
*/
-#ifdef NAS_UE
/****************************************************************************
** **
** Name: emm_proc_authentication_request() **
@@ -538,283 +494,12 @@ int emm_proc_authentication_delete(void)
LOG_FUNC_RETURN (RETURNok);
}
-#endif // NAS_UE
-/*
- * --------------------------------------------------------------------------
- * Authentication procedure executed by the MME
- * --------------------------------------------------------------------------
- */
-#ifdef NAS_MME
-/****************************************************************************
- ** **
- ** Name: emm_proc_authentication() **
- ** **
- ** Description: Initiates authentication procedure to establish partial **
- ** native EPS security context in the UE and the MME. **
- ** **
- ** 3GPP TS 24.301, section 5.4.2.2 **
- ** The network initiates the authentication procedure by **
- ** sending an AUTHENTICATION REQUEST message to the UE and **
- ** starting the timer T3460. The AUTHENTICATION REQUEST mes- **
- ** sage contains the parameters necessary to calculate the **
- ** authentication response. **
- ** **
- ** Inputs: ueid: UE lower layer identifier **
- ** ksi: NAS key set identifier **
- ** rand: Random challenge number **
- ** autn: Authentication token **
- ** success: Callback function executed when the authen-**
- ** tication procedure successfully completes **
- ** reject: Callback function executed when the authen-**
- ** tication procedure fails or is rejected **
- ** failure: Callback function executed whener a lower **
- ** layer failure occured before the authenti- **
- ** cation procedure comnpletes **
- ** Others: None **
- ** **
- ** Outputs: None **
- ** Return: RETURNok, RETURNerror **
- ** Others: None **
- ** **
- ***************************************************************************/
-int emm_proc_authentication(void *ctx, unsigned int ueid, int ksi,
- const OctetString *_rand, const OctetString *autn,
- emm_common_success_callback_t success,
- emm_common_reject_callback_t reject,
- emm_common_failure_callback_t failure)
-
-{
- int rc = RETURNerror;
- authentication_data_t *data;
-
- LOG_FUNC_IN;
-
- LOG_TRACE(INFO, "EMM-PROC - Initiate authentication KSI = %d, ctx = %p", ksi, ctx);
-
- /* Allocate parameters of the retransmission timer callback */
- data = (authentication_data_t *)malloc(sizeof(authentication_data_t));
-
- if (data != NULL) {
- /* Setup ongoing EMM procedure callback functions */
- rc = emm_proc_common_initialize(ueid, success, reject, failure,
- _authentication_abort, data);
-
- if (rc != RETURNok) {
- LOG_TRACE(WARNING, "Failed to initialize EMM callback functions");
- LOG_FUNC_RETURN (RETURNerror);
- }
-
- /* Set the UE identifier */
- data->ueid = ueid;
- /* Reset the retransmission counter */
- data->retransmission_count = 0;
- /* Set the key set identifier */
- data->ksi = ksi;
-
- /* Set the authentication random challenge number */
- if (_rand->length > 0) {
- data->rand.value = (uint8_t *)malloc(_rand->length);
- data->rand.length = 0;
-
- if (data->rand.value) {
- memcpy(data->rand.value, _rand->value, _rand->length);
- data->rand.length = _rand->length;
- }
- }
-
- /* Set the authentication token */
- if (autn->length > 0) {
- data->autn.value = (uint8_t *)malloc(autn->length);
- data->autn.length = 0;
-
- if (data->autn.value) {
- memcpy(data->autn.value, autn->value, autn->length);
- data->autn.length = autn->length;
- }
- }
-
- /* Set the failure notification indicator */
- data->notify_failure = FALSE;
- /* Send authentication request message to the UE */
- rc = _authentication_request(data);
-
- if (rc != RETURNerror) {
- /*
- * Notify EMM that common procedure has been initiated
- */
-
-
- MSC_LOG_TX_MESSAGE(
- MSC_NAS_EMM_MME,
- MSC_NAS_EMM_MME,
- NULL,0,
- "0 EMMREG_COMMON_PROC_REQ ue id %06x (authentication)", ueid);
-
- emm_sap_t emm_sap;
- emm_sap.primitive = EMMREG_COMMON_PROC_REQ;
- emm_sap.u.emm_reg.ueid = ueid;
- emm_sap.u.emm_reg.ctx = ctx;
- rc = emm_sap_send(&emm_sap);
- }
- }
-
- LOG_FUNC_RETURN (rc);
-}
-
-/****************************************************************************
- ** **
- ** Name: emm_proc_authentication_complete() **
- ** **
- ** Description: Performs the authentication completion procedure executed **
- ** by the network. **
- ** **
- ** 3GPP TS 24.301, section 5.4.2.4 **
- ** Upon receiving the AUTHENTICATION RESPONSE message, the **
- ** MME shall stop timer T3460 and check the correctness of **
- ** the RES parameter. **
- ** **
- ** Inputs: ueid: UE lower layer identifier **
- ** emm_cause: Authentication failure EMM cause code **
- ** res: Authentication response parameter. or auts **
- ** in case of sync failure **
- ** Others: None **
- ** **
- ** Outputs: None **
- ** Return: RETURNok, RETURNerror **
- ** Others: _emm_data, T3460 **
- ** **
- ***************************************************************************/
-int emm_proc_authentication_complete(unsigned int ueid, int emm_cause,
- const OctetString *res)
-{
- int rc;
- emm_sap_t emm_sap;
-
- LOG_FUNC_IN;
-
- LOG_TRACE(INFO, "EMM-PROC - Authentication complete (ueid=%u, cause=%d)",
- ueid, emm_cause);
-
- /* Stop timer T3460 */
- LOG_TRACE(INFO, "EMM-PROC - Stop timer T3460 (%d)", T3460.id);
- T3460.id = nas_timer_stop(T3460.id);
-
- /* Release retransmission timer paramaters */
- authentication_data_t *data =
- (authentication_data_t *)(emm_proc_common_get_args(ueid));
-
- if (data) {
- if (data->rand.length > 0) {
- free(data->rand.value);
- }
-
- if (data->autn.length > 0) {
- free(data->autn.value);
- }
-
- free(data);
- }
-
- /* Get the UE context */
- emm_data_context_t *emm_ctx = NULL;
-
-#if defined(NAS_BUILT_IN_EPC)
-
- if (ueid > 0) {
- emm_ctx = emm_data_context_get(&_emm_data, ueid);
- }
-
-#else
-
- if (ueid < EMM_DATA_NB_UE_MAX) {
- emm_ctx = _emm_data.ctx[ueid];
- }
-
-#endif
-
- if (emm_cause == EMM_CAUSE_SUCCESS) {
- /* Check the received RES parameter */
- if ( (emm_ctx == NULL) ||
- (memcmp(res->value, &emm_ctx->vector.xres, res->length) != 0) ) {
- /* RES does not match the XRES parameter */
- LOG_TRACE(WARNING, "EMM-PROC - Failed to authentify the UE");
- emm_cause = EMM_CAUSE_ILLEGAL_UE;
- } else {
- LOG_TRACE(DEBUG, "EMM-PROC - Success to authentify the UE RESP XRES == XRES UE CONTEXT");
- }
- }
-
- if (emm_cause != EMM_CAUSE_SUCCESS) {
- switch (emm_cause) {
-
-#if defined(NAS_BUILT_IN_EPC)
-
- case EMM_CAUSE_SYNCH_FAILURE:
- /* USIM has detected a mismatch in SQN.
- * Ask for a new vector.
- */
- MSC_LOG_EVENT(
- MSC_NAS_EMM_MME,
- "SQN SYNCH_FAILURE ue id %06x", ueid);
-
- LOG_TRACE(DEBUG, "EMM-PROC - USIM has detected a mismatch in SQN Ask for a new vector");
- nas_itti_auth_info_req(ueid, emm_ctx->imsi, 0, res->value);
-
- rc = RETURNok;
- LOG_FUNC_RETURN (rc);
- break;
-#endif
-
- default:
- LOG_TRACE(DEBUG, "EMM-PROC - The MME received an authentication failure message or the RES does not match the XRES parameter computed by the network");
- /* The MME received an authentication failure message or the RES
- * contained in the Authentication Response message received from
- * the UE does not match the XRES parameter computed by the network */
- (void) _authentication_reject(ueid);
- /*
- * Notify EMM that the authentication procedure failed
- */
- MSC_LOG_TX_MESSAGE(
- MSC_NAS_EMM_MME,
- MSC_NAS_EMM_MME,
- NULL,0,
- "0 EMMREG_COMMON_PROC_REJ ue id %06x", ueid);
-
-
- emm_sap.primitive = EMMREG_COMMON_PROC_REJ;
- emm_sap.u.emm_reg.ueid = ueid;
- emm_sap.u.emm_reg.ctx = emm_ctx;
- break;
- }
- } else {
- /*
- * Notify EMM that the authentication procedure successfully completed
- */
- MSC_LOG_TX_MESSAGE(
- MSC_NAS_EMM_MME,
- MSC_NAS_EMM_MME,
- NULL,0,
- "0 EMMREG_COMMON_PROC_CNF ue id %06x", ueid);
-
- LOG_TRACE(DEBUG, "EMM-PROC - Notify EMM that the authentication procedure successfully completed");
- emm_sap.primitive = EMMREG_COMMON_PROC_CNF;
- emm_sap.u.emm_reg.ueid = ueid;
- emm_sap.u.emm_reg.ctx = emm_ctx;
- emm_sap.u.emm_reg.u.common.is_attached = emm_ctx->is_attached;
- }
-
- rc = emm_sap_send(&emm_sap);
-
- LOG_FUNC_RETURN (rc);
-}
-#endif // NAS_MME
/****************************************************************************/
/********************* L O C A L F U N C T I O N S *********************/
/****************************************************************************/
-#ifdef NAS_UE
/*
* --------------------------------------------------------------------------
* Timer handlers
@@ -1260,16 +945,16 @@ static int _authentication_kasme(const OctetString *autn,
kasme->length);
/* Compute the derivation key KEY = CK || IK */
- UInt8_t key[ck->length + ik->length];
+ uint8_t key[ck->length + ik->length];
memcpy(key, ck->value, ck->length);
memcpy(key + ck->length, ik->value, ik->length);
/* Compute the KDF input_s parameter
* S = FC(0x10) || SNid(MCC, MNC) || 0x00 0x03 || SQN ⊕ AK || 0x00 0x06
*/
- UInt8_t input_s[16]; // less than 16
- UInt8_t sn_id[AUTH_SNID_SIZE]; // less than 16
- UInt16_t length;
+ uint8_t input_s[16]; // less than 16
+ uint8_t sn_id[AUTH_SNID_SIZE]; // less than 16
+ uint16_t length;
int offset = 0;
int size_of_length = sizeof(length);
@@ -1325,255 +1010,3 @@ static int _authentication_kasme(const OctetString *autn,
LOG_FUNC_RETURN (RETURNok);
}
-#endif // NAS_UE
-
-#ifdef NAS_MME
-/*
- * --------------------------------------------------------------------------
- * Timer handlers
- * --------------------------------------------------------------------------
- */
-
-/****************************************************************************
- ** **
- ** Name: _authentication_t3460_handler() **
- ** **
- ** Description: T3460 timeout handler **
- ** Upon T3460 timer expiration, the authentication request **
- ** message is retransmitted and the timer restarted. When **
- ** retransmission counter is exceed, the MME shall abort the **
- ** authentication procedure and any ongoing EMM specific **
- ** procedure and release the NAS signalling connection. **
- ** **
- ** 3GPP TS 24.301, section 5.4.2.7, case b **
- ** **
- ** Inputs: args: handler parameters **
- ** Others: None **
- ** **
- ** Outputs: None **
- ** Return: None **
- ** Others: None **
- ** **
- ***************************************************************************/
-static void *_authentication_t3460_handler(void *args)
-{
- LOG_FUNC_IN;
-
- int rc;
-
- authentication_data_t *data = (authentication_data_t *)(args);
-
- /* Increment the retransmission counter */
- data->retransmission_count += 1;
-
- LOG_TRACE(WARNING, "EMM-PROC - T3460 timer expired, retransmission "
- "counter = %d", data->retransmission_count);
-
- if (data->retransmission_count < AUTHENTICATION_COUNTER_MAX) {
- /* Send authentication request message to the UE */
- rc = _authentication_request(data);
- } else {
- unsigned int ueid = data->ueid;
- /* Set the failure notification indicator */
- data->notify_failure = TRUE;
- /* Abort the authentication procedure */
- rc = _authentication_abort(data);
-
- /* Release the NAS signalling connection */
- if (rc != RETURNerror) {
- emm_sap_t emm_sap;
- emm_sap.primitive = EMMAS_RELEASE_REQ;
- emm_sap.u.emm_as.u.release.guti = NULL;
- emm_sap.u.emm_as.u.release.ueid = ueid;
- emm_sap.u.emm_as.u.release.cause = EMM_AS_CAUSE_AUTHENTICATION;
- rc = emm_sap_send(&emm_sap);
- }
- }
-
- LOG_FUNC_RETURN (NULL);
-}
-
-/*
- * --------------------------------------------------------------------------
- * MME specific local functions
- * --------------------------------------------------------------------------
- */
-
-/****************************************************************************
- ** **
- ** Name: _authentication_request() **
- ** **
- ** Description: Sends AUTHENTICATION REQUEST message and start timer T3460**
- ** **
- ** Inputs: args: handler parameters **
- ** Others: None **
- ** **
- ** Outputs: None **
- ** Return: RETURNok, RETURNerror **
- ** Others: T3460 **
- ** **
- ***************************************************************************/
-int _authentication_request(authentication_data_t *data)
-{
- LOG_FUNC_IN;
-
- emm_sap_t emm_sap;
- int rc;
- struct emm_data_context_s *emm_ctx;
-
- /*
- * Notify EMM-AS SAP that Authentication Request message has to be sent
- * to the UE
- */
- emm_sap.primitive = EMMAS_SECURITY_REQ;
- emm_sap.u.emm_as.u.security.guti = NULL;
- emm_sap.u.emm_as.u.security.ueid = data->ueid;
- emm_sap.u.emm_as.u.security.msgType = EMM_AS_MSG_TYPE_AUTH;
- emm_sap.u.emm_as.u.security.ksi = data->ksi;
- emm_sap.u.emm_as.u.security.rand = &data->rand;
- emm_sap.u.emm_as.u.security.autn = &data->autn;
-
- /* TODO: check for pointer validity */
-#if defined(NAS_BUILT_IN_EPC)
- emm_ctx = emm_data_context_get(&_emm_data, data->ueid);
-#else
- emm_ctx = _emm_data.ctx[data->ueid];
-#endif
-
- /* Setup EPS NAS security data */
- emm_as_set_security_data(&emm_sap.u.emm_as.u.security.sctx,
- emm_ctx->security, FALSE, TRUE);
-
- MSC_LOG_TX_MESSAGE(
- MSC_NAS_EMM_MME,
- MSC_NAS_EMM_MME,
- NULL,0,
- "0 EMMAS_SECURITY_REQ ue id %06x", data->ueid);
-
- rc = emm_sap_send(&emm_sap);
-
- if (rc != RETURNerror) {
- if (T3460.id != NAS_TIMER_INACTIVE_ID) {
- /* Re-start T3460 timer */
- T3460.id = nas_timer_restart(T3460.id);
- } else {
- /* Start T3460 timer */
- T3460.id = nas_timer_start(T3460.sec, _authentication_t3460_handler,
- data);
- }
-
- LOG_TRACE(INFO,"EMM-PROC - Timer T3460 (%d) expires in %ld seconds",
- T3460.id, T3460.sec);
- }
-
- LOG_FUNC_RETURN (rc);
-}
-
-/****************************************************************************
- ** **
- ** Name: _authentication_reject() **
- ** **
- ** Description: Sends AUTHENTICATION REJECT message **
- ** **
- ** Inputs: ueid: UE lower layer identifier **
- ** Others: None **
- ** **
- ** Outputs: None **
- ** Return: RETURNok, RETURNerror **
- ** Others: None **
- ** **
- ***************************************************************************/
-static int _authentication_reject(unsigned int ueid)
-{
- LOG_FUNC_IN;
-
- emm_sap_t emm_sap;
- int rc;
- struct emm_data_context_s *emm_ctx;
-
- /*
- * Notify EMM-AS SAP that Authentication Reject message has to be sent
- * to the UE
- */
- emm_sap.primitive = EMMAS_SECURITY_REJ;
- emm_sap.u.emm_as.u.security.guti = NULL;
- emm_sap.u.emm_as.u.security.ueid = ueid;
- emm_sap.u.emm_as.u.security.msgType = EMM_AS_MSG_TYPE_AUTH;
-
-#if defined(NAS_BUILT_IN_EPC)
- emm_ctx = emm_data_context_get(&_emm_data, ueid);
-#else
- emm_ctx = _emm_data.ctx[ueid];
-#endif
- /* Setup EPS NAS security data */
- emm_as_set_security_data(&emm_sap.u.emm_as.u.security.sctx,
- emm_ctx->security, FALSE, TRUE);
- rc = emm_sap_send(&emm_sap);
-
- LOG_FUNC_RETURN (rc);
-}
-
-/****************************************************************************
- ** **
- ** Name: _authentication_abort() **
- ** **
- ** Description: Aborts the authentication procedure currently in progress **
- ** **
- ** Inputs: args: Authentication data to be released **
- ** Others: None **
- ** **
- ** Outputs: None **
- ** Return: RETURNok, RETURNerror **
- ** Others: T3460 **
- ** **
- ***************************************************************************/
-static int _authentication_abort(void *args)
-{
- LOG_FUNC_IN;
-
- int rc = RETURNerror;
-
- authentication_data_t *data = (authentication_data_t *)(args);
-
- if (data) {
- unsigned int ueid = data->ueid;
- int notify_failure = data->notify_failure;
-
- LOG_TRACE(WARNING, "EMM-PROC - Abort authentication procedure "
- "(ueid=%u)", ueid);
-
- /* Stop timer T3460 */
- if (T3460.id != NAS_TIMER_INACTIVE_ID) {
- LOG_TRACE(INFO, "EMM-PROC - Stop timer T3460 (%d)", T3460.id);
- T3460.id = nas_timer_stop(T3460.id);
- }
-
- /* Release retransmission timer paramaters */
- if (data->rand.length > 0) {
- free(data->rand.value);
- }
-
- if (data->autn.length > 0) {
- free(data->autn.value);
- }
-
- free(data);
-
- /*
- * Notify EMM that the authentication procedure failed
- */
- if (notify_failure) {
- emm_sap_t emm_sap;
- emm_sap.primitive = EMMREG_COMMON_PROC_REJ;
- emm_sap.u.emm_reg.ueid = ueid;
- rc = emm_sap_send(&emm_sap);
- } else {
- rc = RETURNok;
- }
- }
-
- LOG_FUNC_RETURN (rc);
-}
-
-#endif // NAS_MME
-
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/Detach.c b/openair-cn/NAS/UE/EMM/Detach.c
old mode 100644
new mode 100755
similarity index 70%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/Detach.c
rename to openair-cn/NAS/UE/EMM/Detach.c
index bbf0528c08..d494515107
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/Detach.c
+++ b/openair-cn/NAS/UE/EMM/Detach.c
@@ -82,7 +82,6 @@ static const char *_emm_detach_type_str[] = {
* Internal data handled by the detach procedure in the UE
* --------------------------------------------------------------------------
*/
-#ifdef NAS_UE
/*
* Timer handlers
*/
@@ -104,15 +103,8 @@ static struct {
emm_proc_detach_type_t type; /* Type of the detach procedure
* currently in progress */
} _emm_detach_data = {0, FALSE, EMM_DETACH_TYPE_RESERVED};
-#endif // NAS_UE
-/*
- * --------------------------------------------------------------------------
- * Internal data handled by the detach procedure in the MME
- * --------------------------------------------------------------------------
- */
-#ifdef NAS_MME
-#endif // NAS_MME
+
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
@@ -123,7 +115,6 @@ static struct {
* Detach procedure executed by the UE
* --------------------------------------------------------------------------
*/
-#ifdef NAS_UE
/****************************************************************************
** **
** Name: emm_proc_detach() **
@@ -363,237 +354,12 @@ int emm_proc_detach_release(void *args)
LOG_FUNC_RETURN(rc);
}
-#endif // NAS_UE
-/*
- * --------------------------------------------------------------------------
- * Detach procedure executed by the MME
- * --------------------------------------------------------------------------
- */
-#ifdef NAS_MME
-/****************************************************************************
- ** **
- ** Name: emm_proc_detach() **
- ** **
- ** Description: Initiate the detach procedure to inform the UE that it is **
- ** detached for EPS services, or to re-attach to the network **
- ** and re-establish all PDN connections. **
- ** **
- ** 3GPP TS 24.301, section 5.5.2.3.1 **
- ** In state EMM-REGISTERED the network initiates the detach **
- ** procedure by sending a DETACH REQUEST message to the UE, **
- ** starting timer T3422 and entering state EMM-DEREGISTERED- **
- ** INITIATED. **
- ** **
- ** Inputs: ueid: UE lower layer identifier **
- ** type: Type of the requested detach **
- ** Others: _emm_detach_type_str **
- ** **
- ** Outputs: None **
- ** Return: RETURNok, RETURNerror **
- ** Others: T3422 **
- ** **
- ***************************************************************************/
-int emm_proc_detach(unsigned int ueid, emm_proc_detach_type_t type)
-{
- LOG_FUNC_IN;
-
- int rc = RETURNerror;
-
- LOG_TRACE(INFO, "EMM-PROC - Initiate detach type = %s (%d)",
- _emm_detach_type_str[type], type);
-
- /* TODO */
-
- LOG_FUNC_RETURN(rc);
-}
-
-/****************************************************************************
- ** **
- ** Name: emm_proc_detach_request() **
- ** **
- ** Description: Performs the UE initiated detach procedure for EPS servi- **
- ** ces only When the DETACH REQUEST message is received by **
- ** the network. **
- ** **
- ** 3GPP TS 24.301, section 5.5.2.2.2 **
- ** Upon receiving the DETACH REQUEST message the network **
- ** shall send a DETACH ACCEPT message to the UE and store **
- ** the current EPS security context, if the detach type IE **
- ** does not indicate "switch off". Otherwise, the procedure **
- ** is completed when the network receives the DETACH REQUEST **
- ** message. **
- ** The network shall deactivate the EPS bearer context(s) **
- ** for this UE locally without peer-to-peer signalling and **
- ** shall enter state EMM-DEREGISTERED. **
- ** **
- ** Inputs: ueid: UE lower layer identifier **
- ** type: Type of the requested detach **
- ** switch_off: Indicates whether the detach is required **
- ** because the UE is switched off or not **
- ** native_ksi: TRUE if the security context is of type **
- ** native **
- ** ksi: The NAS ket sey identifier **
- ** guti: The GUTI if provided by the UE **
- ** imsi: The IMSI if provided by the UE **
- ** imei: The IMEI if provided by the UE **
- ** Others: _emm_data **
- ** **
- ** Outputs: None **
- ** Return: RETURNok, RETURNerror **
- ** Others: None **
- ** **
- ***************************************************************************/
-int emm_proc_detach_request(unsigned int ueid, emm_proc_detach_type_t type,
- int switch_off, int native_ksi, int ksi,
- GUTI_t *guti, imsi_t *imsi, imei_t *imei)
-{
- LOG_FUNC_IN;
-
- int rc;
- emm_data_context_t *emm_ctx = NULL;
-
- LOG_TRACE(INFO, "EMM-PROC - Detach type = %s (%d) requested (ueid=%u)",
- _emm_detach_type_str[type], type, ueid);
-
- /* Get the UE context */
-#if defined(NAS_BUILT_IN_EPC)
-
- if (ueid > 0) {
- emm_ctx = emm_data_context_get(&_emm_data, ueid);
- }
-
-#else
-
- if (ueid < EMM_DATA_NB_UE_MAX) {
- emm_ctx = _emm_data.ctx[ueid];
- }
-
-#endif
-
- if (emm_ctx == NULL) {
- LOG_TRACE(WARNING, "No EMM context exists for the UE (ueid=%u)", ueid);
- LOG_FUNC_RETURN(RETURNok);
- }
-
- if (switch_off) {
- MSC_LOG_EVENT(MSC_NAS_EMM_MME,
- "0 Removing UE context ue id %06x", ueid);
- /* The UE is switched off */
- if (emm_ctx->guti) {
- free(emm_ctx->guti);
- }
-
- if (emm_ctx->imsi) {
- free(emm_ctx->imsi);
- }
-
- if (emm_ctx->imei) {
- free(emm_ctx->imei);
- }
-
- if (emm_ctx->esm_msg.length > 0) {
- free(emm_ctx->esm_msg.value);
- }
-
- /* Release NAS security context */
- if (emm_ctx->security) {
- emm_security_context_t *security = emm_ctx->security;
-
- if (security->kasme.value) {
- free(security->kasme.value);
- }
-
- if (security->knas_enc.value) {
- free(security->knas_enc.value);
- }
-
- if (security->knas_int.value) {
- free(security->knas_int.value);
- }
-
- free(emm_ctx->security);
- }
-
- /* Release the EMM context */
-#if defined(NAS_BUILT_IN_EPC)
- emm_data_context_remove(&_emm_data, emm_ctx);
- free(emm_ctx);
-#else
- free(_emm_data.ctx[ueid]);
- _emm_data.ctx[ueid] = NULL;
-#endif
- rc = RETURNok;
- } else {
- /* Normal detach without UE switch-off */
- emm_sap_t emm_sap;
- emm_as_data_t *emm_as = &emm_sap.u.emm_as.u.data;
- MSC_LOG_TX_MESSAGE(
- MSC_NAS_EMM_MME,
- MSC_NAS_EMM_MME,
- NULL,0,
- "0 EMM_AS_NAS_INFO_DETACH ue id %06x", ueid);
-
- /* Setup NAS information message to transfer */
- emm_as->NASinfo = EMM_AS_NAS_INFO_DETACH;
- emm_as->NASmsg.length = 0;
- emm_as->NASmsg.value = NULL;
- /* Set the UE identifier */
- emm_as->guti = NULL;
- emm_as->ueid = ueid;
- /* Setup EPS NAS security data */
- emm_as_set_security_data(&emm_as->sctx, emm_ctx->security, FALSE, TRUE);
- /*
- * Notify EMM-AS SAP that Detach Accept message has to
- * be sent to the network
- */
- emm_sap.primitive = EMMAS_DATA_REQ;
- rc = emm_sap_send(&emm_sap);
- }
-
- if (rc != RETURNerror) {
- /*
- * Notify ESM that all EPS bearer contexts allocated for this UE have
- * to be locally deactivated
- */
- MSC_LOG_TX_MESSAGE(
- MSC_NAS_EMM_MME,
- MSC_NAS_ESM_MME,
- NULL,0,
- "0 ESM_EPS_BEARER_CONTEXT_DEACTIVATE_REQ ue id %06x", ueid);
- esm_sap_t esm_sap;
- esm_sap.primitive = ESM_EPS_BEARER_CONTEXT_DEACTIVATE_REQ;
- esm_sap.ueid = ueid;
- esm_sap.ctx = emm_ctx;
- esm_sap.data.eps_bearer_context_deactivate.ebi = ESM_SAP_ALL_EBI;
- rc = esm_sap_send(&esm_sap);
-
- if (rc != RETURNerror) {
- emm_sap_t emm_sap;
- /*
- * Notify EMM that the UE has been implicitly detached
- */
- MSC_LOG_TX_MESSAGE(
- MSC_NAS_EMM_MME,
- MSC_NAS_EMM_MME,
- NULL,0,
- "0 EMMREG_DETACH_REQ ue id %06x", ueid);
- emm_sap.primitive = EMMREG_DETACH_REQ;
- emm_sap.u.emm_reg.ueid = ueid;
- emm_sap.u.emm_reg.ctx = emm_ctx;
- rc = emm_sap_send(&emm_sap);
- }
- }
-
- LOG_FUNC_RETURN(rc);
-}
-#endif // NAS_MME
/****************************************************************************/
/********************* L O C A L F U N C T I O N S *********************/
/****************************************************************************/
-#ifdef NAS_UE
/*
* --------------------------------------------------------------------------
* Timer handlers
@@ -720,4 +486,3 @@ static int _emm_detach_abort(emm_proc_detach_type_t type)
LOG_FUNC_RETURN (rc);
}
-#endif // NAS_UE
diff --git a/openair-cn/NAS/UE/EMM/EmmStatusHdl.c b/openair-cn/NAS/UE/EMM/EmmStatusHdl.c
new file mode 100755
index 0000000000..b81f7d5051
--- /dev/null
+++ b/openair-cn/NAS/UE/EMM/EmmStatusHdl.c
@@ -0,0 +1,157 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+Source Emmstatus.c
+
+Version 0.1
+
+Date 2013/06/26
+
+Product NAS stack
+
+Subsystem EPS Mobility Management
+
+Author Frederic Maurel
+
+Description Defines the EMM status procedure executed by the Non-Access
+ Stratum.
+
+ The purpose of the sending of the EMM STATUS message is to
+ report at any time certain error conditions detected upon
+ receipt of EMM protocol data. The EMM STATUS message can be
+ sent by both the MME and the UE.
+
+*****************************************************************************/
+
+#include "emm_proc.h"
+#include "commonDef.h"
+#include "nas_log.h"
+
+#include "emm_cause.h"
+#include "emmData.h"
+
+#include "emm_sap.h"
+
+/****************************************************************************/
+/**************** E X T E R N A L D E F I N I T I O N S ****************/
+/****************************************************************************/
+
+/****************************************************************************/
+/******************* L O C A L D E F I N I T I O N S *******************/
+/****************************************************************************/
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+/****************************************************************************
+ ** **
+ ** Name: emm_proc_status_ind() **
+ ** **
+ ** Description: Processes received EMM status message. **
+ ** **
+ ** 3GPP TS 24.301, section 5.7 **
+ ** On receipt of an EMM STATUS message no state transition **
+ ** and no specific action shall be taken. Local actions are **
+ ** possible and are implementation dependent. **
+ ** **
+ ** Inputs: ueid: UE lower layer identifier **
+ ** emm_cause: Received EMM cause code **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int emm_proc_status_ind(unsigned int ueid, int emm_cause)
+{
+ LOG_FUNC_IN;
+
+ int rc;
+
+ LOG_TRACE(INFO,"EMM-PROC - EMM status procedure requested (cause=%d)",
+ emm_cause);
+
+ LOG_TRACE(DEBUG, "EMM-PROC - To be implemented");
+
+ /* TODO */
+ rc = RETURNok;
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: emm_proc_status() **
+ ** **
+ ** Description: Initiates EMM status procedure. **
+ ** **
+ ** Inputs: ueid: UE lower layer identifier **
+ ** emm_cause: EMM cause code to be reported **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int emm_proc_status(unsigned int ueid, int emm_cause)
+{
+ LOG_FUNC_IN;
+
+ int rc;
+ emm_sap_t emm_sap;
+
+ emm_security_context_t *sctx = NULL;
+ struct emm_data_context_s *ctx = NULL;
+
+ LOG_TRACE(INFO,"EMM-PROC - EMM status procedure requested");
+
+ /*
+ * Notity EMM that EMM status indication has to be sent to lower layers
+ */
+ emm_sap.primitive = EMMAS_STATUS_IND;
+ emm_sap.u.emm_as.u.status.emm_cause = emm_cause;
+ emm_sap.u.emm_as.u.status.ueid = ueid;
+
+ emm_sap.u.emm_as.u.status.guti = _emm_data.guti;
+ sctx = _emm_data.security;
+ /* Setup EPS NAS security data */
+ emm_as_set_security_data(&emm_sap.u.emm_as.u.status.sctx, sctx,
+ FALSE, TRUE);
+
+ rc = emm_sap_send(&emm_sap);
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************/
+/********************* L O C A L F U N C T I O N S *********************/
+/****************************************************************************/
diff --git a/openair-cn/NAS/UE/EMM/Identification.c b/openair-cn/NAS/UE/EMM/Identification.c
new file mode 100755
index 0000000000..b9d75f1917
--- /dev/null
+++ b/openair-cn/NAS/UE/EMM/Identification.c
@@ -0,0 +1,219 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+Source Identification.c
+
+Version 0.1
+
+Date 2013/04/09
+
+Product NAS stack
+
+Subsystem EPS Mobility Management
+
+Author Frederic Maurel
+
+Description Defines the identification EMM procedure executed by the
+ Non-Access Stratum.
+
+ The identification procedure is used by the network to request
+ a particular UE to provide specific identification parameters
+ (IMSI, IMEI).
+
+*****************************************************************************/
+
+#include "emm_proc.h"
+#include "nas_log.h"
+#include "nas_timer.h"
+
+#include "emmData.h"
+
+#include "emm_sap.h"
+#include "msc.h"
+
+#include // malloc, free
+#include // memcpy
+
+/****************************************************************************/
+/**************** E X T E R N A L D E F I N I T I O N S ****************/
+/****************************************************************************/
+
+/****************************************************************************/
+/******************* L O C A L D E F I N I T I O N S *******************/
+/****************************************************************************/
+
+/* String representation of the requested identity type */
+static const char *_emm_identity_type_str[] = {
+ "NOT AVAILABLE", "IMSI", "IMEI", "IMEISV", "TMSI"
+};
+
+/*
+ * --------------------------------------------------------------------------
+ * Internal data handled by the identification procedure in the UE
+ * --------------------------------------------------------------------------
+ */
+
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+/*
+ * --------------------------------------------------------------------------
+ * Identification procedure executed by the UE
+ * --------------------------------------------------------------------------
+ */
+/****************************************************************************
+ ** **
+ ** Name: emm_proc_identification_request() **
+ ** **
+ ** Description: Performs the MME requested identification procedure. **
+ ** **
+ ** 3GPP TS 24.301, section 5.4.4.3 **
+ ** Upon receiving the IDENTITY REQUEST message, the UE shall **
+ ** send an IDENTITY RESPONSE message to the network. The **
+ ** IDENTITY RESPONSE message shall contain the identifica- **
+ ** tion parameters as requested by the network. **
+ ** **
+ ** Inputs: type: Type of the requested identity **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int emm_proc_identification_request(emm_proc_identity_type_t type)
+{
+ LOG_FUNC_IN;
+
+ int rc;
+ emm_sap_t emm_sap;
+
+ LOG_TRACE(INFO, "EMM-PROC - Identification requested type = %s (%d)",
+ _emm_identity_type_str[type], type);
+
+ /* Setup EMM procedure handler to be executed upon receiving
+ * lower layer notification */
+ rc = emm_proc_lowerlayer_initialize(NULL, NULL, NULL, NULL);
+
+ if (rc != RETURNok) {
+ LOG_TRACE(WARNING,
+ "EMM-PROC - Failed to initialize EMM procedure handler");
+ LOG_FUNC_RETURN (RETURNerror);
+ }
+
+ emm_sap.u.emm_as.u.security.identType = EMM_IDENT_TYPE_NOT_AVAILABLE;
+
+ switch (type) {
+ case EMM_IDENT_TYPE_IMSI: {
+ imsi_t modified_imsi;
+
+ /* International Mobile Subscriber Identity is requested */
+ if (_emm_data.imsi) {
+ memcpy (&modified_imsi, _emm_data.imsi, sizeof (modified_imsi));
+
+ /* LW: Eventually replace the 0xF value set in MNC digit 3 by a 0 to avoid IMSI to be truncated before reaching HSS */
+ if (modified_imsi.u.num.digit6 == 0xF) {
+ modified_imsi.u.num.digit6 = 0;
+ }
+
+ emm_sap.u.emm_as.u.security.identType = EMM_IDENT_TYPE_IMSI;
+ emm_sap.u.emm_as.u.security.imsi = &modified_imsi;
+
+ LOG_TRACE(INFO, "EMM-PROC - IMSI = %u%u%u %u%u%u %u%u%u%u%x%x%x%x%x",
+ emm_sap.u.emm_as.u.security.imsi->u.num.digit1,
+ emm_sap.u.emm_as.u.security.imsi->u.num.digit2,
+ emm_sap.u.emm_as.u.security.imsi->u.num.digit3,
+
+ emm_sap.u.emm_as.u.security.imsi->u.num.digit4,
+ emm_sap.u.emm_as.u.security.imsi->u.num.digit5,
+ emm_sap.u.emm_as.u.security.imsi->u.num.digit6,
+
+ emm_sap.u.emm_as.u.security.imsi->u.num.digit7,
+ emm_sap.u.emm_as.u.security.imsi->u.num.digit8,
+ emm_sap.u.emm_as.u.security.imsi->u.num.digit9,
+ emm_sap.u.emm_as.u.security.imsi->u.num.digit10,
+ emm_sap.u.emm_as.u.security.imsi->u.num.digit11,
+ emm_sap.u.emm_as.u.security.imsi->u.num.digit12,
+ emm_sap.u.emm_as.u.security.imsi->u.num.digit13,
+ emm_sap.u.emm_as.u.security.imsi->u.num.digit14,
+ emm_sap.u.emm_as.u.security.imsi->u.num.digit15);
+ }
+
+ break;
+ }
+
+ case EMM_IDENT_TYPE_IMEI:
+
+ /* International Mobile Equipment Identity is requested */
+ if (_emm_data.imei) {
+ emm_sap.u.emm_as.u.security.identType = EMM_IDENT_TYPE_IMEI;
+ emm_sap.u.emm_as.u.security.imei = _emm_data.imei;
+ }
+
+ break;
+
+ case EMM_IDENT_TYPE_TMSI:
+
+ /* Temporary Mobile Subscriber Identity is requested */
+ if (_emm_data.guti) {
+ emm_sap.u.emm_as.u.security.identType = EMM_IDENT_TYPE_TMSI;
+ emm_sap.u.emm_as.u.security.tmsi = _emm_data.guti->m_tmsi;
+ }
+
+ break;
+
+ default:
+ /* Other identities are not available */
+ break;
+ }
+
+ /*
+ * Notify EMM-AS SAP that Identity Response message has to be sent
+ * to the MME
+ */
+ emm_sap.primitive = EMMAS_SECURITY_RES;
+ emm_sap.u.emm_as.u.security.guti = _emm_data.guti;
+ emm_sap.u.emm_as.u.security.ueid = 0;
+ emm_sap.u.emm_as.u.security.msgType = EMM_AS_MSG_TYPE_IDENT;
+ /* Setup EPS NAS security data */
+ emm_as_set_security_data(&emm_sap.u.emm_as.u.security.sctx,
+ _emm_data.security, FALSE, TRUE);
+ rc = emm_sap_send(&emm_sap);
+
+ LOG_FUNC_RETURN (rc);
+}
+
+
+/****************************************************************************/
+/********************* L O C A L F U N C T I O N S *********************/
+/****************************************************************************/
+
+
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/IdleMode.c b/openair-cn/NAS/UE/EMM/IdleMode.c
old mode 100644
new mode 100755
similarity index 99%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/IdleMode.c
rename to openair-cn/NAS/UE/EMM/IdleMode.c
index 027ed0fc5d..78c21205e3
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/IdleMode.c
+++ b/openair-cn/NAS/UE/EMM/IdleMode.c
@@ -63,7 +63,6 @@ Description Defines EMM procedures executed by the Non-Access Stratum
*****************************************************************************/
-#ifdef NAS_UE
#include "emm_proc.h"
#include "nas_log.h"
@@ -1069,13 +1068,11 @@ int emm_proc_network_notify(int index)
LOG_FUNC_RETURN (rc);
}
-#endif // NAS_UE
/****************************************************************************/
/********************* L O C A L F U N C T I O N S *********************/
/****************************************************************************/
-#ifdef NAS_UE
/****************************************************************************
** **
** Name: _IdleMain_plmn_str() **
@@ -1223,5 +1220,4 @@ static int _IdleMode_get_suitable_cell(int index)
return emm_sap_send(&emm_sap);
}
-#endif // NAS_UE
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/IdleMode.h b/openair-cn/NAS/UE/EMM/IdleMode.h
old mode 100644
new mode 100755
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/IdleMode.h
rename to openair-cn/NAS/UE/EMM/IdleMode.h
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/LowerLayer.c b/openair-cn/NAS/UE/EMM/LowerLayer.c
old mode 100644
new mode 100755
similarity index 95%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/LowerLayer.c
rename to openair-cn/NAS/UE/EMM/LowerLayer.c
index 0a19feb0a5..10f7c4ccc9
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/LowerLayer.c
+++ b/openair-cn/NAS/UE/EMM/LowerLayer.c
@@ -67,7 +67,6 @@ Description Defines EMM procedures executed by the Non-Access Stratum
/******************* L O C A L D E F I N I T I O N S *******************/
/****************************************************************************/
-#ifdef NAS_UE
/*
* Data structure used to handle EMM procedures executed by the UE upon
* receiving lower layer notifications
@@ -78,7 +77,6 @@ static struct {
lowerlayer_release_callback_t release; /* NAS signalling release */
void *args; /* EMM procedure argument parameters */
} _lowerlayer_data;
-#endif
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
@@ -168,10 +166,8 @@ int lowerlayer_establish(void)
{
LOG_FUNC_IN;
-#ifdef NAS_UE
/* Update the EPS Connection Management status */
_emm_data.ecm_status = ECM_CONNECTED;
-#endif
LOG_FUNC_RETURN (RETURNok);
}
@@ -198,10 +194,8 @@ int lowerlayer_release(int cause)
emm_sap_t emm_sap;
int rc;
-#ifdef NAS_UE
/* Update the EPS Connection Management status */
_emm_data.ecm_status = ECM_IDLE;
-#endif
emm_sap.primitive = EMMREG_LOWERLAYER_RELEASE;
emm_sap.u.emm_reg.ueid = 0;
@@ -230,26 +224,14 @@ int lowerlayer_data_ind(unsigned int ueid, const OctetString *data)
{
esm_sap_t esm_sap;
int rc;
-#if defined(NAS_MME)
- emm_data_context_t *emm_ctx = NULL;
-#endif
+
LOG_FUNC_IN;
-#if defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)
-
- if (ueid > 0) {
- emm_ctx = emm_data_context_get(&_emm_data, ueid);
- }
-
-#endif
-
esm_sap.primitive = ESM_UNITDATA_IND;
esm_sap.is_standalone = TRUE;
esm_sap.ueid = ueid;
-#if defined(NAS_MME)
- esm_sap.ctx = emm_ctx;
-#endif
+
esm_sap.recv = data;
rc = esm_sap_send(&esm_sap);
@@ -282,33 +264,10 @@ int lowerlayer_data_req(unsigned int ueid, const OctetString *data)
struct emm_data_context_s *ctx = NULL;
emm_sap.primitive = EMMAS_DATA_REQ;
-#ifdef NAS_UE
emm_sap.u.emm_as.u.data.guti = _emm_data.guti;
emm_sap.u.emm_as.u.data.ueid = 0;
sctx = _emm_data.security;
-#endif
-#ifdef NAS_MME
- emm_sap.u.emm_as.u.data.guti = NULL;
- emm_sap.u.emm_as.u.data.ueid = ueid;
-# if defined(NAS_BUILT_IN_EPC)
- if (ueid > 0) {
- ctx = emm_data_context_get(&_emm_data, ueid);
- }
-
-# else
-
- if (ueid < EMM_DATA_NB_UE_MAX) {
- ctx = _emm_data.ctx[ueid];
- }
-
-# endif
-
- if (ctx) {
- sctx = ctx->security;
- }
-
-#endif
emm_sap.u.emm_as.u.data.NASinfo = 0;
emm_sap.u.emm_as.u.data.NASmsg.length = data->length;
emm_sap.u.emm_as.u.data.NASmsg.value = data->value;
@@ -324,7 +283,6 @@ int lowerlayer_data_req(unsigned int ueid, const OctetString *data)
* EMM procedure handlers
* --------------------------------------------------------------------------
*/
-#ifdef NAS_UE
/****************************************************************************
** **
** Name: emm_proc_lowerlayer_initialize() **
@@ -455,7 +413,6 @@ int emm_proc_lowerlayer_release(void)
LOG_FUNC_RETURN (rc);
}
-#endif // NAS_UE
/****************************************************************************
** **
@@ -496,7 +453,7 @@ void emm_as_set_security_data(emm_as_security_data_t *data, const void *args,
is_new,
context->eksi,
context->ul_count.seq_num,
- *(UInt32_t *)(&context->ul_count));
+ *(uint32_t *)(&context->ul_count));
LOG_TRACE(INFO,
"knas_int %s",dump_octet_string(&context->knas_int));
LOG_TRACE(INFO,
@@ -506,15 +463,9 @@ void emm_as_set_security_data(emm_as_security_data_t *data, const void *args,
data->is_new = is_new;
data->ksi = context->eksi;
-#if defined (NAS_UE)
data->sqn = context->ul_count.seq_num;
- // LG data->count = *(UInt32_t *)(&context->ul_count);
+ // LG data->count = *(uint32_t *)(&context->ul_count);
data->count = 0x00000000 | (context->ul_count.overflow << 8 ) | context->ul_count.seq_num;
-#else
- data->sqn = context->dl_count.seq_num;
- // LG data->count = *(UInt32_t *)(&context->ul_count);
- data->count = 0x00000000 | (context->dl_count.overflow << 8 ) | context->dl_count.seq_num;
-#endif
/* NAS integrity and cyphering keys may not be available if the
* current security context is a partial EPS security context
* and not a full native EPS security context */
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/LowerLayer.h b/openair-cn/NAS/UE/EMM/LowerLayer.h
old mode 100644
new mode 100755
similarity index 99%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/LowerLayer.h
rename to openair-cn/NAS/UE/EMM/LowerLayer.h
index eead2a909c..4d9b4c5d39
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/LowerLayer.h
+++ b/openair-cn/NAS/UE/EMM/LowerLayer.h
@@ -55,7 +55,6 @@ Description Defines EMM procedures executed by the Non-Access Stratum
/********************* G L O B A L C O N S T A N T S *******************/
/****************************************************************************/
-#ifdef NAS_UE
/*
* Type of EMM procedure callback function executed whenever data are
* successfully delivered to the network
@@ -73,7 +72,6 @@ typedef int (*lowerlayer_failure_callback_t)(int, void *);
* connection is released
*/
typedef int (*lowerlayer_release_callback_t)(void *);
-#endif
/****************************************************************************/
/************************ G L O B A L T Y P E S ************************/
diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/COPYING b/openair-cn/NAS/UE/EMM/SAP/COPYING
old mode 100644
new mode 100755
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/util/COPYING
rename to openair-cn/NAS/UE/EMM/SAP/COPYING
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregistered.c b/openair-cn/NAS/UE/EMM/SAP/EmmDeregistered.c
old mode 100644
new mode 100755
similarity index 89%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregistered.c
rename to openair-cn/NAS/UE/EMM/SAP/EmmDeregistered.c
index 7c3233312b..83ae79f428
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregistered.c
+++ b/openair-cn/NAS/UE/EMM/SAP/EmmDeregistered.c
@@ -99,14 +99,9 @@ int EmmDeregistered(const emm_reg_t *evt)
int rc = RETURNerror;
-#ifdef NAS_UE
assert(emm_fsm_get_status() == EMM_DEREGISTERED);
-#endif
-#ifdef NAS_MME
- assert(emm_fsm_get_status(evt->ueid, evt->ctx) == EMM_DEREGISTERED);
-#endif
-#ifdef NAS_UE
+
/* Delete the authentication data RAND and RES */
rc = emm_proc_authentication_delete();
@@ -120,11 +115,9 @@ int EmmDeregistered(const emm_reg_t *evt)
* DEREGISTERED from any other state except EMM-NULL or when the UE aborts
* the attach procedure without having left EMM-DEREGISTERED.
*/
-#endif
switch (evt->primitive) {
-#ifdef NAS_UE
case _EMMREG_NO_IMSI:
/*
@@ -168,36 +161,6 @@ int EmmDeregistered(const emm_reg_t *evt)
break;
-#endif
-
-#ifdef NAS_MME
-
- case _EMMREG_PROC_ABORT:
- /*
- * Ongoing EMM procedure aborted
- */
- rc = RETURNok;
- break;
-
- case _EMMREG_COMMON_PROC_REQ:
- /*
- * An EMM common procedure has been initiated;
- * enter state EMM-COMMON-PROCEDURE-INITIATED.
- */
- rc = emm_fsm_set_status(evt->ueid, evt->ctx, EMM_COMMON_PROCEDURE_INITIATED);
- break;
-
- case _EMMREG_ATTACH_CNF:
- /*
- * Attach procedure successful and default EPS bearer
- * context activated;
- * enter state EMM-REGISTERED.
- */
- rc = emm_fsm_set_status(evt->ueid, evt->ctx, EMM_REGISTERED);
- break;
-
-#endif
-
case _EMMREG_LOWERLAYER_SUCCESS:
/*
* Data successfully delivered to the network
@@ -218,14 +181,12 @@ int EmmDeregistered(const emm_reg_t *evt)
break;
}
-#ifdef NAS_UE
/* TODO: 3GPP TS 24.301, section 4.4.2.1
* The UE shall mark the EPS security context on the USIM or in the non-
* volatile memory as invalid when the UE initiates an attach procedure
* or when the UE leaves state EMM-DEREGISTERED for any other state except
* EMM-NULL.
*/
-#endif
LOG_FUNC_RETURN (rc);
}
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredAttachNeeded.c b/openair-cn/NAS/UE/EMM/SAP/EmmDeregisteredAttachNeeded.c
old mode 100644
new mode 100755
similarity index 99%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredAttachNeeded.c
rename to openair-cn/NAS/UE/EMM/SAP/EmmDeregisteredAttachNeeded.c
index 91c161fceb..b2def20a57
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredAttachNeeded.c
+++ b/openair-cn/NAS/UE/EMM/SAP/EmmDeregisteredAttachNeeded.c
@@ -50,7 +50,6 @@ Description Implements the EPS Mobility Management procedures executed
*****************************************************************************/
-#ifdef NAS_UE
#include "emm_fsm.h"
#include "commonDef.h"
@@ -100,4 +99,3 @@ int EmmDeregisteredAttachNeeded(const emm_reg_t *evt)
/********************* L O C A L F U N C T I O N S *********************/
/****************************************************************************/
-#endif
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredAttemptingToAttach.c b/openair-cn/NAS/UE/EMM/SAP/EmmDeregisteredAttemptingToAttach.c
old mode 100644
new mode 100755
similarity index 99%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredAttemptingToAttach.c
rename to openair-cn/NAS/UE/EMM/SAP/EmmDeregisteredAttemptingToAttach.c
index bdfafe4a7a..51053ab925
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredAttemptingToAttach.c
+++ b/openair-cn/NAS/UE/EMM/SAP/EmmDeregisteredAttemptingToAttach.c
@@ -48,7 +48,6 @@ Description Implements the EPS Mobility Management procedures executed
*****************************************************************************/
-#ifdef NAS_UE
#include "emm_fsm.h"
#include "commonDef.h"
@@ -144,4 +143,3 @@ int EmmDeregisteredAttemptingToAttach(const emm_reg_t *evt)
/********************* L O C A L F U N C T I O N S *********************/
/****************************************************************************/
-#endif
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredInitiated.c b/openair-cn/NAS/UE/EMM/SAP/EmmDeregisteredInitiated.c
old mode 100644
new mode 100755
similarity index 97%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredInitiated.c
rename to openair-cn/NAS/UE/EMM/SAP/EmmDeregisteredInitiated.c
index 65443fc4ab..fc0e0524be
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredInitiated.c
+++ b/openair-cn/NAS/UE/EMM/SAP/EmmDeregisteredInitiated.c
@@ -91,15 +91,9 @@ int EmmDeregisteredInitiated(const emm_reg_t *evt)
int rc = RETURNerror;
-#ifdef NAS_UE
assert(emm_fsm_get_status() == EMM_DEREGISTERED_INITIATED);
-#endif
-#ifdef NAS_MME
- assert(emm_fsm_get_status(evt->ueid, evt->ctx) == EMM_DEREGISTERED_INITIATED);
-#endif
switch (evt->primitive) {
-#ifdef NAS_UE
case _EMMREG_DETACH_CNF:
/*
@@ -138,7 +132,6 @@ int EmmDeregisteredInitiated(const emm_reg_t *evt)
*/
rc = emm_proc_lowerlayer_release();
break;
-#endif
default:
LOG_TRACE(ERROR, "EMM-FSM - Primitive is not valid (%d)",
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredLimitedService.c b/openair-cn/NAS/UE/EMM/SAP/EmmDeregisteredLimitedService.c
old mode 100644
new mode 100755
similarity index 99%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredLimitedService.c
rename to openair-cn/NAS/UE/EMM/SAP/EmmDeregisteredLimitedService.c
index 1c650bfb0a..6af83fd855
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredLimitedService.c
+++ b/openair-cn/NAS/UE/EMM/SAP/EmmDeregisteredLimitedService.c
@@ -48,7 +48,6 @@ Description Implements the EPS Mobility Management procedures executed
*****************************************************************************/
-#ifdef NAS_UE
#include "emm_fsm.h"
#include "commonDef.h"
@@ -164,4 +163,3 @@ int EmmDeregisteredLimitedService(const emm_reg_t *evt)
/********************* L O C A L F U N C T I O N S *********************/
/****************************************************************************/
-#endif
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredNoCellAvailable.c b/openair-cn/NAS/UE/EMM/SAP/EmmDeregisteredNoCellAvailable.c
old mode 100644
new mode 100755
similarity index 99%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredNoCellAvailable.c
rename to openair-cn/NAS/UE/EMM/SAP/EmmDeregisteredNoCellAvailable.c
index 2273b93b90..9708f3a6be
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredNoCellAvailable.c
+++ b/openair-cn/NAS/UE/EMM/SAP/EmmDeregisteredNoCellAvailable.c
@@ -50,7 +50,6 @@ Description Implements the EPS Mobility Management procedures executed
*****************************************************************************/
-#ifdef NAS_UE
#include "emm_fsm.h"
#include "commonDef.h"
@@ -144,4 +143,3 @@ int EmmDeregisteredNoCellAvailable(const emm_reg_t *evt)
/********************* L O C A L F U N C T I O N S *********************/
/****************************************************************************/
-#endif
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredNoImsi.c b/openair-cn/NAS/UE/EMM/SAP/EmmDeregisteredNoImsi.c
old mode 100644
new mode 100755
similarity index 99%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredNoImsi.c
rename to openair-cn/NAS/UE/EMM/SAP/EmmDeregisteredNoImsi.c
index d66ec7c09f..315ce0f8ff
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredNoImsi.c
+++ b/openair-cn/NAS/UE/EMM/SAP/EmmDeregisteredNoImsi.c
@@ -47,7 +47,6 @@ Description Implements the EPS Mobility Management procedures executed
*****************************************************************************/
-#ifdef NAS_UE
#include "emm_fsm.h"
#include "commonDef.h"
@@ -101,4 +100,3 @@ int EmmDeregisteredNoImsi(const emm_reg_t *evt)
/********************* L O C A L F U N C T I O N S *********************/
/****************************************************************************/
-#endif
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredNormalService.c b/openair-cn/NAS/UE/EMM/SAP/EmmDeregisteredNormalService.c
old mode 100644
new mode 100755
similarity index 99%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredNormalService.c
rename to openair-cn/NAS/UE/EMM/SAP/EmmDeregisteredNormalService.c
index 9068bb24cc..386a4fd4b4
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredNormalService.c
+++ b/openair-cn/NAS/UE/EMM/SAP/EmmDeregisteredNormalService.c
@@ -49,7 +49,6 @@ Description Implements the EPS Mobility Management procedures executed
*****************************************************************************/
-#ifdef NAS_UE
#include "emm_fsm.h"
#include "commonDef.h"
@@ -173,4 +172,3 @@ int EmmDeregisteredNormalService(const emm_reg_t *evt)
/********************* L O C A L F U N C T I O N S *********************/
/****************************************************************************/
-#endif
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredPlmnSearch.c b/openair-cn/NAS/UE/EMM/SAP/EmmDeregisteredPlmnSearch.c
old mode 100644
new mode 100755
similarity index 99%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredPlmnSearch.c
rename to openair-cn/NAS/UE/EMM/SAP/EmmDeregisteredPlmnSearch.c
index 681f5e061b..071b9a576c
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredPlmnSearch.c
+++ b/openair-cn/NAS/UE/EMM/SAP/EmmDeregisteredPlmnSearch.c
@@ -47,7 +47,6 @@ Description Implements the EPS Mobility Management procedures executed
*****************************************************************************/
-#ifdef NAS_UE
#include "emm_fsm.h"
#include "commonDef.h"
@@ -161,4 +160,3 @@ int EmmDeregisteredPlmnSearch(const emm_reg_t *evt)
/********************* L O C A L F U N C T I O N S *********************/
/****************************************************************************/
-#endif
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmNull.c b/openair-cn/NAS/UE/EMM/SAP/EmmNull.c
old mode 100644
new mode 100755
similarity index 99%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmNull.c
rename to openair-cn/NAS/UE/EMM/SAP/EmmNull.c
index 5416fd92f5..c1583d56e1
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmNull.c
+++ b/openair-cn/NAS/UE/EMM/SAP/EmmNull.c
@@ -47,7 +47,6 @@ Description Implements the EPS Mobility Management procedures executed
*****************************************************************************/
-#ifdef NAS_UE
#include "emm_fsm.h"
#include "commonDef.h"
@@ -133,4 +132,3 @@ int EmmNull(const emm_reg_t *evt)
/********************* L O C A L F U N C T I O N S *********************/
/****************************************************************************/
-#endif
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegistered.c b/openair-cn/NAS/UE/EMM/SAP/EmmRegistered.c
old mode 100644
new mode 100755
similarity index 84%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegistered.c
rename to openair-cn/NAS/UE/EMM/SAP/EmmRegistered.c
index 0bf682b7e1..7db6e86b74
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegistered.c
+++ b/openair-cn/NAS/UE/EMM/SAP/EmmRegistered.c
@@ -94,15 +94,10 @@ int EmmRegistered(const emm_reg_t *evt)
int rc = RETURNerror;
-#ifdef NAS_UE
assert(emm_fsm_get_status() == EMM_REGISTERED);
-#endif
-#ifdef NAS_MME
- assert(emm_fsm_get_status(evt->ueid, evt->ctx) == EMM_REGISTERED);
-#endif
+
switch (evt->primitive) {
-#ifdef NAS_UE
case _EMMREG_DETACH_INIT:
/*
@@ -164,48 +159,6 @@ int EmmRegistered(const emm_reg_t *evt)
*/
rc = emm_proc_lowerlayer_release();
break;
-#endif
-
-#ifdef NAS_MME
-
- case _EMMREG_DETACH_REQ:
- /*
- * Network detach has been requested (implicit detach);
- * enter state EMM-DEREGISTERED
- */
- rc = emm_fsm_set_status(evt->ueid, evt->ctx, EMM_DEREGISTERED);
- break;
-
- case _EMMREG_COMMON_PROC_REQ:
- /*
- * An EMM common procedure has been initiated;
- * enter state EMM-COMMON-PROCEDURE-INITIATED.
- */
- rc = emm_fsm_set_status(evt->ueid, evt->ctx, EMM_COMMON_PROCEDURE_INITIATED);
- break;
-
- case _EMMREG_TAU_REJ:
- /*
- * TODO: Tracking Area Update has been rejected
- */
- LOG_TRACE(ERROR, "EMM-FSM - Tracking Area Update procedure "
- "is not implemented");
- break;
-
- case _EMMREG_LOWERLAYER_SUCCESS:
- /*
- * Data successfully delivered to the network
- */
- rc = RETURNok;
- break;
-
- case _EMMREG_LOWERLAYER_FAILURE:
- /*
- * Data failed to be delivered to the network
- */
- rc = RETURNok;
- break;
-#endif
default:
LOG_TRACE(ERROR, "EMM-FSM - Primitive is not valid (%d)",
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredAttemptingToUpdate.c b/openair-cn/NAS/UE/EMM/SAP/EmmRegisteredAttemptingToUpdate.c
old mode 100644
new mode 100755
similarity index 99%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredAttemptingToUpdate.c
rename to openair-cn/NAS/UE/EMM/SAP/EmmRegisteredAttemptingToUpdate.c
index 4d96f1a016..6b15df4a54
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredAttemptingToUpdate.c
+++ b/openair-cn/NAS/UE/EMM/SAP/EmmRegisteredAttemptingToUpdate.c
@@ -52,8 +52,6 @@ Description Implements the EPS Mobility Management procedures executed
*****************************************************************************/
-#ifdef NAS_UE
-
#include "emm_fsm.h"
#include "commonDef.h"
#include "nas_log.h"
@@ -102,4 +100,3 @@ int EmmRegisteredAttemptingToUpdate(const emm_reg_t *evt)
/********************* L O C A L F U N C T I O N S *********************/
/****************************************************************************/
-#endif
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredImsiDetachInitiated.c b/openair-cn/NAS/UE/EMM/SAP/EmmRegisteredImsiDetachInitiated.c
old mode 100644
new mode 100755
similarity index 99%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredImsiDetachInitiated.c
rename to openair-cn/NAS/UE/EMM/SAP/EmmRegisteredImsiDetachInitiated.c
index ac794db3a0..ba40a549d8
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredImsiDetachInitiated.c
+++ b/openair-cn/NAS/UE/EMM/SAP/EmmRegisteredImsiDetachInitiated.c
@@ -51,7 +51,6 @@ Description Implements the EPS Mobility Management procedures executed
*****************************************************************************/
-#ifdef NAS_UE
#include "emm_fsm.h"
#include "commonDef.h"
@@ -101,4 +100,3 @@ int EmmRegisteredImsiDetachInitiated(const emm_reg_t *evt)
/********************* L O C A L F U N C T I O N S *********************/
/****************************************************************************/
-#endif
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredInitiated.c b/openair-cn/NAS/UE/EMM/SAP/EmmRegisteredInitiated.c
old mode 100644
new mode 100755
similarity index 99%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredInitiated.c
rename to openair-cn/NAS/UE/EMM/SAP/EmmRegisteredInitiated.c
index 6a17c2ca09..2ee8b8dea6
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredInitiated.c
+++ b/openair-cn/NAS/UE/EMM/SAP/EmmRegisteredInitiated.c
@@ -48,7 +48,6 @@ Description Implements the EPS Mobility Management procedures executed
*****************************************************************************/
-#ifdef NAS_UE
#include "emm_fsm.h"
#include "commonDef.h"
@@ -270,5 +269,3 @@ int EmmRegisteredInitiated(const emm_reg_t *evt)
/****************************************************************************/
/********************* L O C A L F U N C T I O N S *********************/
/****************************************************************************/
-
-#endif
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredLimitedService.c b/openair-cn/NAS/UE/EMM/SAP/EmmRegisteredLimitedService.c
old mode 100644
new mode 100755
similarity index 99%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredLimitedService.c
rename to openair-cn/NAS/UE/EMM/SAP/EmmRegisteredLimitedService.c
index b0be7df11a..799914d119
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredLimitedService.c
+++ b/openair-cn/NAS/UE/EMM/SAP/EmmRegisteredLimitedService.c
@@ -47,7 +47,6 @@ Description Implements the EPS Mobility Management procedures executed
*****************************************************************************/
-#ifdef NAS_UE
#include "emm_fsm.h"
#include "commonDef.h"
@@ -97,4 +96,3 @@ int EmmRegisteredLimitedService(const emm_reg_t *evt)
/********************* L O C A L F U N C T I O N S *********************/
/****************************************************************************/
-#endif
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredNoCellAvailable.c b/openair-cn/NAS/UE/EMM/SAP/EmmRegisteredNoCellAvailable.c
old mode 100644
new mode 100755
similarity index 99%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredNoCellAvailable.c
rename to openair-cn/NAS/UE/EMM/SAP/EmmRegisteredNoCellAvailable.c
index 38a14a1332..0578d8acfd
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredNoCellAvailable.c
+++ b/openair-cn/NAS/UE/EMM/SAP/EmmRegisteredNoCellAvailable.c
@@ -48,7 +48,6 @@ Description Implements the EPS Mobility Management procedures executed
*****************************************************************************/
-#ifdef NAS_UE
#include "emm_fsm.h"
#include "commonDef.h"
@@ -98,4 +97,3 @@ int EmmRegisteredNoCellAvailable(const emm_reg_t *evt)
/********************* L O C A L F U N C T I O N S *********************/
/****************************************************************************/
-#endif
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredNormalService.c b/openair-cn/NAS/UE/EMM/SAP/EmmRegisteredNormalService.c
old mode 100644
new mode 100755
similarity index 99%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredNormalService.c
rename to openair-cn/NAS/UE/EMM/SAP/EmmRegisteredNormalService.c
index 8b462348b8..51e28d2068
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredNormalService.c
+++ b/openair-cn/NAS/UE/EMM/SAP/EmmRegisteredNormalService.c
@@ -47,7 +47,6 @@ Description Implements the EPS Mobility Management procedures executed
*****************************************************************************/
-#ifdef NAS_UE
#include "emm_fsm.h"
#include "commonDef.h"
@@ -97,4 +96,3 @@ int EmmRegisteredNormalService(const emm_reg_t *evt)
/********************* L O C A L F U N C T I O N S *********************/
/****************************************************************************/
-#endif
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredPlmnSearch.c b/openair-cn/NAS/UE/EMM/SAP/EmmRegisteredPlmnSearch.c
old mode 100644
new mode 100755
similarity index 99%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredPlmnSearch.c
rename to openair-cn/NAS/UE/EMM/SAP/EmmRegisteredPlmnSearch.c
index d659fc082e..c4c053515d
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredPlmnSearch.c
+++ b/openair-cn/NAS/UE/EMM/SAP/EmmRegisteredPlmnSearch.c
@@ -47,7 +47,6 @@ Description Implements the EPS Mobility Management procedures executed
*****************************************************************************/
-#ifdef NAS_UE
#include "emm_fsm.h"
#include "commonDef.h"
@@ -125,4 +124,3 @@ int EmmRegisteredPlmnSearch_xxx(const emm_reg_t *evt)
/********************* L O C A L F U N C T I O N S *********************/
/****************************************************************************/
-#endif
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredUpdateNeeded.c b/openair-cn/NAS/UE/EMM/SAP/EmmRegisteredUpdateNeeded.c
old mode 100644
new mode 100755
similarity index 99%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredUpdateNeeded.c
rename to openair-cn/NAS/UE/EMM/SAP/EmmRegisteredUpdateNeeded.c
index 10a9e9b053..ead9ce7aa8
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredUpdateNeeded.c
+++ b/openair-cn/NAS/UE/EMM/SAP/EmmRegisteredUpdateNeeded.c
@@ -53,7 +53,6 @@ Description Implements the EPS Mobility Management procedures executed
*****************************************************************************/
-#ifdef NAS_UE
#include "emm_fsm.h"
#include "commonDef.h"
@@ -103,4 +102,3 @@ int EmmRegisteredUpdateNeeded(const emm_reg_t *evt)
/********************* L O C A L F U N C T I O N S *********************/
/****************************************************************************/
-#endif
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmServiceRequestInitiated.c b/openair-cn/NAS/UE/EMM/SAP/EmmServiceRequestInitiated.c
old mode 100644
new mode 100755
similarity index 99%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmServiceRequestInitiated.c
rename to openair-cn/NAS/UE/EMM/SAP/EmmServiceRequestInitiated.c
index 464d9ba54f..3d9b593dbc
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmServiceRequestInitiated.c
+++ b/openair-cn/NAS/UE/EMM/SAP/EmmServiceRequestInitiated.c
@@ -49,7 +49,6 @@ Description Implements the EPS Mobility Management procedures executed
*****************************************************************************/
-#ifdef NAS_UE
#include "emm_fsm.h"
#include "commonDef.h"
@@ -99,4 +98,3 @@ int EmmServiceRequestInitiated(const emm_reg_t *evt)
/********************* L O C A L F U N C T I O N S *********************/
/****************************************************************************/
-#endif
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmTrackingAreaUpdatingInitiated.c b/openair-cn/NAS/UE/EMM/SAP/EmmTrackingAreaUpdatingInitiated.c
old mode 100644
new mode 100755
similarity index 99%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmTrackingAreaUpdatingInitiated.c
rename to openair-cn/NAS/UE/EMM/SAP/EmmTrackingAreaUpdatingInitiated.c
index ab6ba17f36..7adb4e12fa
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmTrackingAreaUpdatingInitiated.c
+++ b/openair-cn/NAS/UE/EMM/SAP/EmmTrackingAreaUpdatingInitiated.c
@@ -49,7 +49,6 @@ Description Implements the EPS Mobility Management procedures executed
*****************************************************************************/
-#ifdef NAS_UE
#include "emm_fsm.h"
#include "commonDef.h"
@@ -99,4 +98,3 @@ int EmmTrackingAreaUpdatingInitiated(const emm_reg_t *evt)
/********************* L O C A L F U N C T I O N S *********************/
/****************************************************************************/
-#endif
diff --git a/openair-cn/NAS/UE/EMM/SAP/emm_as.c b/openair-cn/NAS/UE/EMM/SAP/emm_as.c
new file mode 100755
index 0000000000..433b4e5304
--- /dev/null
+++ b/openair-cn/NAS/UE/EMM/SAP/emm_as.c
@@ -0,0 +1,1486 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+
+Source emm_as.c
+
+Version 0.1
+
+Date 2012/10/16
+
+Product NAS stack
+
+Subsystem EPS Mobility Management
+
+Author Frederic Maurel
+
+Description Defines the EMMAS Service Access Point that provides
+ services to the EPS Mobility Management for NAS message
+ transfer to/from the Access Stratum sublayer.
+
+*****************************************************************************/
+
+#include "emm_as.h"
+#include "emm_recv.h"
+#include "emm_send.h"
+#include "emmData.h"
+#include "commonDef.h"
+#include "nas_log.h"
+
+#include "TLVDecoder.h"
+#include "as_message.h"
+#include "nas_message.h"
+
+#include "emm_cause.h"
+#include "LowerLayer.h"
+
+#include // memset
+#include // malloc, free
+
+#if defined(NAS_BUILT_IN_UE)
+# include "nas_itti_messaging.h"
+#endif
+#include "msc.h"
+
+/****************************************************************************/
+/**************** E X T E R N A L D E F I N I T I O N S ****************/
+/****************************************************************************/
+
+extern int emm_proc_plmn_selection_end(int found, tac_t tac, ci_t ci, AcT_t rat);
+
+extern int emm_proc_status(unsigned int ueid, int emm_cause);
+
+/****************************************************************************/
+/******************* L O C A L D E F I N I T I O N S *******************/
+/****************************************************************************/
+
+/*
+ * String representation of EMMAS-SAP primitives
+ */
+static const char *_emm_as_primitive_str[] = {
+ "EMMAS_SECURITY_REQ",
+ "EMMAS_SECURITY_IND",
+ "EMMAS_SECURITY_RES",
+ "EMMAS_SECURITY_REJ",
+ "EMMAS_ESTABLISH_REQ",
+ "EMMAS_ESTABLISH_CNF",
+ "EMMAS_ESTABLISH_REJ",
+ "EMMAS_RELEASE_REQ",
+ "EMMAS_RELEASE_IND",
+ "EMMAS_DATA_REQ",
+ "EMMAS_DATA_IND",
+ "EMMAS_PAGE_IND",
+ "EMMAS_STATUS_IND",
+ "EMMAS_CELL_INFO_REQ",
+ "EMMAS_CELL_INFO_RES",
+ "EMMAS_CELL_INFO_IND",
+};
+
+/*
+ * Functions executed to process EMM procedures upon receiving
+ * data from the network
+ */
+static int _emm_as_recv(unsigned int ueid, const char *msg, int len,
+ int *emm_cause);
+
+static int _emm_as_establish_cnf(const emm_as_establish_t *msg, int *emm_cause);
+static int _emm_as_establish_rej(void);
+static int _emm_as_release_ind(const emm_as_release_t *msg);
+static int _emm_as_page_ind(const emm_as_page_t *msg);
+
+
+static int _emm_as_cell_info_res(const emm_as_cell_info_t *msg);
+static int _emm_as_cell_info_ind(const emm_as_cell_info_t *msg);
+
+static int _emm_as_data_ind(const emm_as_data_t *msg, int *emm_cause);
+
+/*
+ * Functions executed to send data to the network when requested
+ * within EMM procedure processing
+ */
+static EMM_msg *_emm_as_set_header(nas_message_t *msg,
+ const emm_as_security_data_t *security);
+static int
+_emm_as_encode(
+ as_nas_info_t *info,
+ nas_message_t *msg,
+ int length,
+ emm_security_context_t *emm_security_context);
+
+static int _emm_as_encrypt(
+ as_nas_info_t *info,
+ const nas_message_security_header_t *header,
+ const char *buffer,
+ int length,
+ emm_security_context_t *emm_security_context);
+
+static int _emm_as_send(const emm_as_t *msg);
+
+static int _emm_as_security_res(const emm_as_security_t *,
+ ul_info_transfer_req_t *);
+static int _emm_as_establish_req(const emm_as_establish_t *,
+ nas_establish_req_t *);
+
+
+static int _emm_as_cell_info_req(const emm_as_cell_info_t *, cell_info_req_t *);
+
+static int _emm_as_data_req(const emm_as_data_t *, ul_info_transfer_req_t *);
+static int _emm_as_status_ind(const emm_as_status_t *, ul_info_transfer_req_t *);
+static int _emm_as_release_req(const emm_as_release_t *, nas_release_req_t *);
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+/****************************************************************************
+ ** **
+ ** Name: emm_as_initialize() **
+ ** **
+ ** Description: Initializes the EMMAS Service Access Point **
+ ** **
+ ** Inputs: None **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: None **
+ ** Others: NONE **
+ ** **
+ ***************************************************************************/
+void emm_as_initialize(void)
+{
+ LOG_FUNC_IN;
+
+ /* TODO: Initialize the EMMAS-SAP */
+
+ LOG_FUNC_OUT;
+}
+
+/****************************************************************************
+ ** **
+ ** Name: emm_as_send() **
+ ** **
+ ** Description: Processes the EMMAS Service Access Point primitive. **
+ ** **
+ ** Inputs: msg: The EMMAS-SAP primitive to process **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int emm_as_send(const emm_as_t *msg)
+{
+ LOG_FUNC_IN;
+
+ int rc;
+ int emm_cause = EMM_CAUSE_SUCCESS;
+ emm_as_primitive_t primitive = msg->primitive;
+
+ uint32_t ueid = 0;
+
+ LOG_TRACE(INFO, "EMMAS-SAP - Received primitive %s (%d)",
+ _emm_as_primitive_str[primitive - _EMMAS_START - 1], primitive);
+
+ switch (primitive) {
+ case _EMMAS_DATA_IND:
+ rc = _emm_as_data_ind(&msg->u.data, &emm_cause);
+ ueid = msg->u.data.ueid;
+ break;
+
+
+ case _EMMAS_ESTABLISH_CNF:
+ rc = _emm_as_establish_cnf(&msg->u.establish, &emm_cause);
+ break;
+
+ case _EMMAS_ESTABLISH_REJ:
+ rc = _emm_as_establish_rej();
+ break;
+
+ case _EMMAS_RELEASE_IND:
+ rc = _emm_as_release_ind(&msg->u.release);
+ break;
+
+ case _EMMAS_PAGE_IND:
+ rc = _emm_as_page_ind(&msg->u.page);
+ break;
+
+ case _EMMAS_CELL_INFO_RES:
+ rc = _emm_as_cell_info_res(&msg->u.cell_info);
+ break;
+
+ case _EMMAS_CELL_INFO_IND:
+ rc = _emm_as_cell_info_ind(&msg->u.cell_info);
+ break;
+
+ default:
+ /* Other primitives are forwarded to the Access Stratum */
+ rc = _emm_as_send(msg);
+
+ if (rc != RETURNok) {
+ LOG_TRACE(ERROR, "EMMAS-SAP - "
+ "Failed to process primitive %s (%d)",
+ _emm_as_primitive_str[primitive - _EMMAS_START - 1],
+ primitive);
+ LOG_FUNC_RETURN (RETURNerror);
+ }
+
+ break;
+ }
+
+ /* Handle decoding errors */
+ if (emm_cause != EMM_CAUSE_SUCCESS) {
+ /* Ignore received message that is too short to contain a complete
+ * message type information element */
+ if (rc == TLV_DECODE_BUFFER_TOO_SHORT) {
+ LOG_FUNC_RETURN (RETURNok);
+ }
+ /* Ignore received message that contains not supported protocol
+ * discriminator */
+ else if (rc == TLV_DECODE_PROTOCOL_NOT_SUPPORTED) {
+ LOG_FUNC_RETURN (RETURNok);
+ } else if (rc == TLV_DECODE_WRONG_MESSAGE_TYPE) {
+ emm_cause = EMM_CAUSE_MESSAGE_TYPE_NOT_IMPLEMENTED;
+ }
+
+ /* EMM message processing failed */
+ LOG_TRACE(WARNING, "EMMAS-SAP - Received EMM message is not valid "
+ "(cause=%d)", emm_cause);
+ /* Return an EMM status message */
+ rc = emm_proc_status(ueid, emm_cause);
+ }
+
+ if (rc != RETURNok) {
+ LOG_TRACE(ERROR, "EMMAS-SAP - Failed to process primitive %s (%d)",
+ _emm_as_primitive_str[primitive - _EMMAS_START - 1],
+ primitive);
+ }
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************/
+/********************* L O C A L F U N C T I O N S *********************/
+/****************************************************************************/
+
+/*
+ * --------------------------------------------------------------------------
+ * Functions executed to process EMM procedures upon receiving data from the
+ * network
+ * --------------------------------------------------------------------------
+ */
+
+/****************************************************************************
+ ** **
+ ** Name: _emm_as_recv() **
+ ** **
+ ** Description: Decodes and processes the EPS Mobility Management message **
+ ** received from the Access Stratum **
+ ** **
+ ** Inputs: ueid: UE lower layer identifier **
+ ** msg: The EMM message to process **
+ ** len: The length of the EMM message **
+ ** Others: None **
+ ** **
+ ** Outputs: emm_cause: EMM cause code **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+static int _emm_as_recv(unsigned int ueid, const char *msg, int len,
+ int *emm_cause)
+{
+ LOG_FUNC_IN;
+
+ int decoder_rc;
+ int rc = RETURNerror;
+
+ LOG_TRACE(INFO, "EMMAS-SAP - Received EMM message (length=%d)", len);
+
+ nas_message_t nas_msg;
+ memset(&nas_msg, 0 , sizeof(nas_message_t));
+
+ emm_security_context_t *security = NULL; /* Current EPS NAS security context */
+
+ security = _emm_data.security;
+
+ /* Decode the received message */
+ decoder_rc = nas_message_decode(msg, &nas_msg, len, security);
+
+ if (decoder_rc < 0) {
+ LOG_TRACE(WARNING, "EMMAS-SAP - Failed to decode NAS message "
+ "(err=%d)", decoder_rc);
+ *emm_cause = EMM_CAUSE_PROTOCOL_ERROR;
+ LOG_FUNC_RETURN (decoder_rc);
+ }
+
+ /* Process NAS message */
+ EMM_msg *emm_msg = &nas_msg.plain.emm;
+
+ switch (emm_msg->header.message_type) {
+ case EMM_STATUS:
+ rc = emm_recv_status(ueid, &emm_msg->emm_status, emm_cause);
+ break;
+
+ case IDENTITY_REQUEST:
+ rc = emm_recv_identity_request(&emm_msg->identity_request,
+ emm_cause);
+ break;
+
+ case AUTHENTICATION_REQUEST:
+ rc = emm_recv_authentication_request(
+ &emm_msg->authentication_request,
+ emm_cause);
+ break;
+
+ case AUTHENTICATION_REJECT:
+ rc = emm_recv_authentication_reject(
+ &emm_msg->authentication_reject,
+ emm_cause);
+ break;
+
+ case SECURITY_MODE_COMMAND:
+ rc = emm_recv_security_mode_command(
+ &emm_msg->security_mode_command,
+ emm_cause);
+ break;
+
+ case DETACH_ACCEPT:
+ rc = emm_recv_detach_accept(&emm_msg->detach_accept, emm_cause);
+ break;
+
+
+ case TRACKING_AREA_UPDATE_ACCEPT:
+ case TRACKING_AREA_UPDATE_REJECT:
+ case SERVICE_REJECT:
+ case GUTI_REALLOCATION_COMMAND:
+ case EMM_INFORMATION:
+ case DOWNLINK_NAS_TRANSPORT:
+ case CS_SERVICE_NOTIFICATION:
+ /* TODO */
+ break;
+
+ default:
+ LOG_TRACE(WARNING, "EMMAS-SAP - EMM message 0x%x is not valid",
+ emm_msg->header.message_type);
+ *emm_cause = EMM_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE;
+ break;
+ }
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: _emm_as_data_ind() **
+ ** **
+ ** Description: Processes the EMMAS-SAP data transfer indication **
+ ** primitive **
+ ** **
+ ** EMMAS-SAP - AS->EMM: DATA_IND - Data transfer procedure **
+ ** **
+ ** Inputs: msg: The EMMAS-SAP primitive to process **
+ ** Others: None **
+ ** **
+ ** Outputs: emm_cause: EMM cause code **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+static int _emm_as_data_ind(const emm_as_data_t *msg, int *emm_cause)
+{
+ LOG_FUNC_IN;
+
+ int rc = RETURNerror;
+
+ LOG_TRACE(INFO, "EMMAS-SAP - Received AS data transfer indication "
+ "(ueid=%u, delivered=%s, length=%d)", msg->ueid,
+ (msg->delivered)? "TRUE" : "FALSE", msg->NASmsg.length);
+
+ if (msg->delivered) {
+ if (msg->NASmsg.length > 0) {
+ /* Process the received NAS message */
+ char *plain_msg = (char *)malloc(msg->NASmsg.length);
+
+ if (plain_msg) {
+ nas_message_security_header_t header;
+ emm_security_context_t *security = NULL; /* Current EPS NAS security context */
+
+ memset(&header, 0, sizeof(header));
+ /* Decrypt the received security protected message */
+
+ security = _emm_data.security;
+ int bytes = nas_message_decrypt((char *)(msg->NASmsg.value),
+ plain_msg,
+ &header,
+ msg->NASmsg.length,
+ security
+ );
+
+ if (bytes < 0) {
+ /* Failed to decrypt the message */
+ *emm_cause = EMM_CAUSE_PROTOCOL_ERROR;
+ LOG_FUNC_RETURN (bytes);
+ } else if (header.protocol_discriminator ==
+ EPS_MOBILITY_MANAGEMENT_MESSAGE) {
+ /* Process EMM data */
+ rc = _emm_as_recv(msg->ueid, plain_msg, bytes, emm_cause);
+ } else if (header.protocol_discriminator ==
+ EPS_SESSION_MANAGEMENT_MESSAGE) {
+ const OctetString data = {bytes, (uint8_t *)plain_msg};
+ /* Foward ESM data to EPS session management */
+ rc = lowerlayer_data_ind(msg->ueid, &data);
+ }
+
+ free(plain_msg);
+ }
+ } else {
+ /* Process successfull lower layer transfer indication */
+ rc = lowerlayer_success(msg->ueid);
+ }
+ } else {
+ /* Process lower layer transmission failure of NAS message */
+ rc = lowerlayer_failure(msg->ueid);
+ }
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: _emm_as_establish_cnf() **
+ ** **
+ ** Description: Processes the EMMAS-SAP connection establish confirmation **
+ ** primitive **
+ ** **
+ ** EMMAS-SAP - AS->EMM: ESTABLISH_CNF - NAS signalling connection **
+ ** **
+ ** Inputs: msg: The EMMAS-SAP primitive to process **
+ ** Others: None **
+ ** **
+ ** Outputs: emm_cause: EMM cause code **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+static int _emm_as_establish_cnf(const emm_as_establish_t *msg,
+ int *emm_cause)
+{
+ LOG_FUNC_IN;
+
+ int decoder_rc;
+ int rc = RETURNerror;
+
+ LOG_TRACE(INFO, "EMMAS-SAP - Received AS connection establish confirm");
+
+ if (msg->NASmsg.length > 0) {
+ /* The NAS signalling connection is established */
+ (void) lowerlayer_establish();
+ } else {
+ /* The initial NAS message has been successfully delivered to
+ * lower layers */
+ rc = lowerlayer_success(0);
+ LOG_FUNC_RETURN (rc);
+ }
+
+ nas_message_t nas_msg;
+ memset(&nas_msg, 0 , sizeof(nas_message_t));
+
+ /* Decode initial NAS message */
+ decoder_rc = nas_message_decode((char *)(msg->NASmsg.value),
+ &nas_msg,
+ msg->NASmsg.length,
+ _emm_data.security);
+
+ if (decoder_rc < 0) {
+ LOG_TRACE(WARNING, "EMMAS-SAP - Failed to decode initial NAS message"
+ "(err=%d)", decoder_rc);
+ *emm_cause = EMM_CAUSE_PROTOCOL_ERROR;
+ LOG_FUNC_RETURN (decoder_rc);
+ }
+
+ /* Process initial NAS message */
+ EMM_msg *emm_msg = &nas_msg.plain.emm;
+
+ switch (emm_msg->header.message_type) {
+ case ATTACH_ACCEPT:
+ rc = emm_recv_attach_accept(&emm_msg->attach_accept, emm_cause);
+ break;
+
+ case ATTACH_REJECT:
+ rc = emm_recv_attach_reject(&emm_msg->attach_reject, emm_cause);
+ break;
+
+ case DETACH_ACCEPT:
+ break;
+
+ case TRACKING_AREA_UPDATE_ACCEPT:
+ break;
+
+ default:
+ LOG_TRACE(WARNING, "EMMAS-SAP - Initial NAS message 0x%x is "
+ "not valid", emm_msg->header.message_type);
+ *emm_cause = EMM_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE;
+ break;
+ }
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: _emm_as_establish_rej() **
+ ** **
+ ** Description: Processes the EMMAS-SAP connection establish reject **
+ ** primitive **
+ ** **
+ ** EMMAS-SAP - AS->EMM: ESTABLISH_REJ - NAS signalling connection **
+ ** **
+ ** Inputs: None **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+static int _emm_as_establish_rej(void)
+{
+ LOG_FUNC_IN;
+
+ int rc;
+
+ LOG_TRACE(INFO, "EMMAS-SAP - Received AS initial NAS message transmission "
+ "failure");
+
+ /* Process lower layer transmission failure of initial NAS message */
+ rc = lowerlayer_failure(0);
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: _emm_as_release_ind() **
+ ** **
+ ** Description: Processes the EMMAS-SAP connection release indication **
+ ** primitive **
+ ** **
+ ** EMMAS-SAP - AS->EMM: RELEASE_IND - NAS signalling release procedure **
+ ** **
+ ** Inputs: msg: The EMMAS-SAP primitive to process **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+static int _emm_as_release_ind(const emm_as_release_t *msg)
+{
+ LOG_FUNC_IN;
+
+ int rc = RETURNok;
+
+ LOG_TRACE(INFO, "EMMAS-SAP - Received AS connection release indication "
+ "(cause=%d)", msg->cause);
+
+ /* Process NAS signalling connection release indication */
+ rc = lowerlayer_release(msg->cause);
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: _emm_as_page_ind() **
+ ** **
+ ** Description: Processes the EMMAS-SAP paging data indication primitive **
+ ** **
+ ** EMMAS-SAP - AS->EMM: PAGE_IND - Paging data procedure **
+ ** **
+ ** Inputs: msg: The EMMAS-SAP primitive to process **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+static int _emm_as_page_ind(const emm_as_page_t *msg)
+{
+ LOG_FUNC_IN;
+
+ int rc = RETURNok;
+
+ LOG_TRACE(INFO, "EMMAS-SAP - Received AS paging data indication");
+
+ /* TODO */
+
+ LOG_FUNC_RETURN (rc);
+}
+
+
+
+
+/****************************************************************************
+ ** **
+ ** Name: _emm_as_cell_info_res() **
+ ** **
+ ** Description: Processes the EMMAS-SAP cell information response **
+ ** primitive **
+ ** **
+ ** EMMAS-SAP - AS->EMM: CELL_INFO_RES - PLMN and cell selection procedure **
+ ** The NAS received a response to cell selection request pre- **
+ ** viously sent to the Access-Startum. If a suitable cell is **
+ ** found to serve the selected PLMN with associated Radio Ac- **
+ ** cess Technologies, this cell is selected to camp on. **
+ ** **
+ ** Inputs: msg: The EMMAS-SAP primitive to process **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+static int _emm_as_cell_info_res(const emm_as_cell_info_t *msg)
+{
+ LOG_FUNC_IN;
+
+ int rc = RETURNok;
+
+ LOG_TRACE(INFO, "EMMAS-SAP - Received AS cell information response");
+
+ int AcT = NET_ACCESS_EUTRAN;
+
+ if (msg->found == TRUE) {
+ /* Get the first supported access technology */
+ while (AcT != NET_ACCESS_UNAVAILABLE) {
+ if (msg->rat & (1 << AcT)) {
+ break;
+ }
+
+ AcT -= 1;
+ }
+ }
+
+ /* Notify EMM that a cell has been found */
+ rc = emm_proc_plmn_selection_end(msg->found, msg->tac, msg->cellID, AcT);
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: _emm_as_cell_info_ind() **
+ ** **
+ ** Description: Processes the EMMAS-SAP cell information indication **
+ ** primitive **
+ ** **
+ ** EMMAS-SAP - AS->EMM: CELL_INFO_IND - PLMN and cell selection procedure **
+ ** **
+ ** Inputs: msg: The EMMAS-SAP primitive to process **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+static int _emm_as_cell_info_ind(const emm_as_cell_info_t *msg)
+{
+ LOG_FUNC_IN;
+
+ int rc = RETURNok;
+
+ LOG_TRACE(INFO, "EMMAS-SAP - Received AS cell information indication");
+
+ /* TODO */
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/*
+ * --------------------------------------------------------------------------
+ * Functions executed to send data to the network when requested within EMM
+ * procedure processing
+ * --------------------------------------------------------------------------
+ */
+
+/****************************************************************************
+ ** **
+ ** Name: _emm_as_set_header() **
+ ** **
+ ** Description: Setup the security header of the given NAS message **
+ ** **
+ ** Inputs: security: The NAS security data to use **
+ ** Others: None **
+ ** **
+ ** Outputs: msg: The NAS message **
+ ** Return: Pointer to the plain NAS message to be se- **
+ ** curity protected if setting of the securi- **
+ ** ty header succeed; **
+ ** NULL pointer otherwise **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+static EMM_msg *_emm_as_set_header(nas_message_t *msg,
+ const emm_as_security_data_t *security)
+{
+ LOG_FUNC_IN;
+
+ msg->header.protocol_discriminator = EPS_MOBILITY_MANAGEMENT_MESSAGE;
+
+ if ( security && (security->ksi != EMM_AS_NO_KEY_AVAILABLE) ) {
+ /* A valid EPS security context exists */
+ if (security->is_new) {
+ /* New EPS security context is taken into use */
+ if (security->k_int) {
+ if (security->k_enc) {
+ /* NAS integrity and cyphering keys are available */
+ msg->header.security_header_type =
+ SECURITY_HEADER_TYPE_INTEGRITY_PROTECTED_CYPHERED_NEW;
+ } else {
+ /* NAS integrity key only is available */
+ msg->header.security_header_type =
+ SECURITY_HEADER_TYPE_INTEGRITY_PROTECTED_NEW;
+ }
+
+ LOG_FUNC_RETURN (&msg->security_protected.plain.emm);
+ }
+ } else if (security->k_int) {
+ if (security->k_enc) {
+ /* NAS integrity and cyphering keys are available */
+ msg->header.security_header_type =
+ SECURITY_HEADER_TYPE_INTEGRITY_PROTECTED_CYPHERED;
+ } else {
+ /* NAS integrity key only is available */
+ msg->header.security_header_type =
+ SECURITY_HEADER_TYPE_INTEGRITY_PROTECTED;
+ }
+
+ LOG_FUNC_RETURN (&msg->security_protected.plain.emm);
+ } else {
+ /* No valid EPS security context exists */
+ msg->header.security_header_type = SECURITY_HEADER_TYPE_NOT_PROTECTED;
+ LOG_FUNC_RETURN (&msg->plain.emm);
+ }
+ } else {
+ /* No valid EPS security context exists */
+ msg->header.security_header_type = SECURITY_HEADER_TYPE_NOT_PROTECTED;
+ LOG_FUNC_RETURN (&msg->plain.emm);
+ }
+
+ /* A valid EPS security context exists but NAS integrity key
+ * is not available */
+ LOG_FUNC_RETURN (NULL);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: _emm_as_encode() **
+ ** **
+ ** Description: Encodes NAS message into NAS information container **
+ ** **
+ ** Inputs: msg: The NAS message to encode **
+ ** length: The maximum length of the NAS message **
+ ** Others: None **
+ ** **
+ ** Outputs: info: The NAS information container **
+ ** msg: The NAS message to encode **
+ ** Return: The number of bytes successfully encoded **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+static int
+_emm_as_encode(
+ as_nas_info_t *info,
+ nas_message_t *msg,
+ int length,
+ emm_security_context_t *emm_security_context)
+{
+ LOG_FUNC_IN;
+
+ int bytes = 0;
+
+ if (msg->header.security_header_type != SECURITY_HEADER_TYPE_NOT_PROTECTED) {
+ emm_msg_header_t *header = &msg->security_protected.plain.emm.header;
+ /* Expand size of protected NAS message */
+ length += NAS_MESSAGE_SECURITY_HEADER_SIZE;
+ /* Set header of plain NAS message */
+ header->protocol_discriminator = EPS_MOBILITY_MANAGEMENT_MESSAGE;
+ header->security_header_type = SECURITY_HEADER_TYPE_NOT_PROTECTED;
+ }
+
+ /* Allocate memory to the NAS information container */
+ info->data = (Byte_t *)malloc(length * sizeof(Byte_t));
+
+ if (info->data != NULL) {
+ /* Encode the NAS message */
+ bytes = nas_message_encode(
+ (char *)(info->data),
+ msg,
+ length,
+ emm_security_context);
+
+ if (bytes > 0) {
+ info->length = bytes;
+ } else {
+ free(info->data);
+ info->length = 0;
+ info->data = NULL;
+ }
+ }
+
+ LOG_FUNC_RETURN (bytes);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: _emm_as_encrypt() **
+ ** **
+ ** Description: Encryts NAS message into NAS information container **
+ ** **
+ ** Inputs: header: The Security header in used **
+ ** msg: The NAS message to encrypt **
+ ** length: The maximum length of the NAS message **
+ ** Others: None **
+ ** **
+ ** Outputs: info: The NAS information container **
+ ** Return: The number of bytes successfully encrypted **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+static int
+_emm_as_encrypt(
+ as_nas_info_t *info,
+ const nas_message_security_header_t *header,
+ const char *msg,
+ int length,
+ emm_security_context_t *emm_security_context)
+{
+ LOG_FUNC_IN;
+
+ int bytes = 0;
+
+ if (header->security_header_type != SECURITY_HEADER_TYPE_NOT_PROTECTED) {
+ /* Expand size of protected NAS message */
+ length += NAS_MESSAGE_SECURITY_HEADER_SIZE;
+ }
+
+ /* Allocate memory to the NAS information container */
+ info->data = (Byte_t *)malloc(length * sizeof(Byte_t));
+
+ if (info->data != NULL) {
+ /* Encrypt the NAS information message */
+ bytes = nas_message_encrypt(
+ msg,
+ (char *)(info->data),
+ header,
+ length,
+ emm_security_context);
+
+ if (bytes > 0) {
+ info->length = bytes;
+ } else {
+ free(info->data);
+ info->length = 0;
+ info->data = NULL;
+ }
+ }
+
+ LOG_FUNC_RETURN (bytes);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: _emm_as_send() **
+ ** **
+ ** Description: Builds NAS message according to the given EMMAS Service **
+ ** Access Point primitive and sends it to the Access Stratum **
+ ** sublayer **
+ ** **
+ ** Inputs: msg: The EMMAS-SAP primitive to be sent **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+static int _emm_as_send(const emm_as_t *msg)
+{
+ LOG_FUNC_IN;
+
+ as_message_t as_msg;
+ memset(&as_msg, 0 , sizeof(as_message_t));
+
+ switch (msg->primitive) {
+ case _EMMAS_DATA_REQ:
+ as_msg.msgID = _emm_as_data_req(
+ &msg->u.data,
+ &as_msg.msg.ul_info_transfer_req);
+ break;
+
+ case _EMMAS_STATUS_IND:
+ as_msg.msgID = _emm_as_status_ind(
+ &msg->u.status,
+ &as_msg.msg.ul_info_transfer_req);
+ break;
+
+ case _EMMAS_RELEASE_REQ:
+ as_msg.msgID = _emm_as_release_req(
+ &msg->u.release,
+ &as_msg.msg.nas_release_req);
+ break;
+
+
+ case _EMMAS_SECURITY_RES:
+ as_msg.msgID = _emm_as_security_res(
+ &msg->u.security,
+ &as_msg.msg.ul_info_transfer_req);
+ break;
+
+ case _EMMAS_ESTABLISH_REQ:
+ as_msg.msgID = _emm_as_establish_req(
+ &msg->u.establish,
+ &as_msg.msg.nas_establish_req);
+ break;
+
+
+ case _EMMAS_CELL_INFO_REQ:
+ as_msg.msgID = _emm_as_cell_info_req(&msg->u.cell_info,
+ &as_msg.msg.cell_info_req);
+ /*
+ * TODO: NAS may provide a list of equivalent PLMNs, if available,
+ * that AS shall use for cell selection and cell reselection.
+ */
+ break;
+
+ default:
+ as_msg.msgID = 0;
+ break;
+ }
+
+ /* Send the message to the Access Stratum or S1AP in case of MME */
+ if (as_msg.msgID > 0) {
+
+# if defined(NAS_BUILT_IN_UE)
+ LOG_TRACE(DEBUG, "EMMAS-SAP - "
+ "Sending msg with id 0x%x, primitive %s (%d) to RRC layer for transmission",
+ as_msg.msgID,
+ _emm_as_primitive_str[msg->primitive - _EMMAS_START - 1],
+ msg->primitive);
+
+ switch (as_msg.msgID) {
+ case AS_CELL_INFO_REQ: {
+ nas_itti_cell_info_req(
+ as_msg.msg.cell_info_req.plmnID,
+ as_msg.msg.cell_info_req.rat);
+ LOG_FUNC_RETURN (RETURNok);
+ }
+ break;
+
+ case AS_NAS_ESTABLISH_REQ: {
+ nas_itti_nas_establish_req(
+ as_msg.msg.nas_establish_req.cause,
+ as_msg.msg.nas_establish_req.type,
+ as_msg.msg.nas_establish_req.s_tmsi,
+ as_msg.msg.nas_establish_req.plmnID,
+ as_msg.msg.nas_establish_req.initialNasMsg.data,
+ as_msg.msg.nas_establish_req.initialNasMsg.length);
+ LOG_FUNC_RETURN (RETURNok);
+ }
+ break;
+
+ case AS_UL_INFO_TRANSFER_REQ: {
+ nas_itti_ul_data_req(
+ as_msg.msg.ul_info_transfer_req.UEid,
+ as_msg.msg.ul_info_transfer_req.nasMsg.data,
+ as_msg.msg.ul_info_transfer_req.nasMsg.length);
+ LOG_FUNC_RETURN (RETURNok);
+ }
+ break;
+
+ case AS_RAB_ESTABLISH_RSP: {
+ nas_itti_rab_establish_rsp(
+ as_msg.msg.rab_establish_rsp.s_tmsi,
+ as_msg.msg.rab_establish_rsp.rabID,
+ as_msg.msg.rab_establish_rsp.errCode);
+ LOG_FUNC_RETURN (RETURNok);
+ }
+ break;
+
+ default:
+ break;
+ }
+
+# else
+ int bytes = as_message_send(&as_msg);
+
+ if (bytes > 0) {
+ LOG_FUNC_RETURN (RETURNok);
+ }
+
+# endif
+ }
+
+ LOG_FUNC_RETURN (RETURNerror);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: _emm_as_data_req() **
+ ** **
+ ** Description: Processes the EMMAS-SAP data transfer request **
+ ** primitive **
+ ** **
+ ** EMMAS-SAP - EMM->AS: DATA_REQ - Data transfer procedure **
+ ** **
+ ** Inputs: msg: The EMMAS-SAP primitive to process **
+ ** Others: None **
+ ** **
+ ** Outputs: as_msg: The message to send to the AS **
+ ** Return: The identifier of the AS message **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+static int _emm_as_data_req(const emm_as_data_t *msg,
+ ul_info_transfer_req_t *as_msg)
+{
+ LOG_FUNC_IN;
+
+ int size = 0;
+ int is_encoded = FALSE;
+
+ LOG_TRACE(INFO, "EMMAS-SAP - Send AS data transfer request");
+
+ nas_message_t nas_msg;
+ memset(&nas_msg, 0 , sizeof(nas_message_t));
+
+ /* Setup the AS message */
+ if (msg->guti) {
+ as_msg->s_tmsi.MMEcode = msg->guti->gummei.MMEcode;
+ as_msg->s_tmsi.m_tmsi = msg->guti->m_tmsi;
+ } else {
+ as_msg->UEid = msg->ueid;
+ }
+
+ /* Setup the NAS security header */
+ EMM_msg *emm_msg = _emm_as_set_header(&nas_msg, &msg->sctx);
+
+ /* Setup the NAS information message */
+ if (emm_msg != NULL) switch (msg->NASinfo) {
+
+ case EMM_AS_NAS_DATA_ATTACH:
+ size = emm_send_attach_complete(msg, &emm_msg->attach_complete);
+ break;
+
+ case EMM_AS_NAS_DATA_DETACH:
+ size = emm_send_detach_request(msg, &emm_msg->detach_request);
+ break;
+
+
+ default:
+ /* Send other NAS messages as already encoded ESM messages */
+ size = msg->NASmsg.length;
+ is_encoded = TRUE;
+ break;
+ }
+
+ if (size > 0) {
+ int bytes;
+ emm_security_context_t *emm_security_context = NULL;
+
+ emm_security_context = _emm_data.security;
+
+ if (emm_security_context) {
+
+ nas_msg.header.sequence_number = emm_security_context->ul_count.seq_num;
+ LOG_TRACE(DEBUG,
+ "Set nas_msg.header.sequence_number -> %u",
+ nas_msg.header.sequence_number);
+ }
+
+ if (!is_encoded) {
+ /* Encode the NAS information message */
+ bytes = _emm_as_encode(&as_msg->nasMsg,
+ &nas_msg,
+ size,
+ emm_security_context);
+ } else {
+ /* Encrypt the NAS information message */
+ bytes = _emm_as_encrypt(&as_msg->nasMsg,
+ &nas_msg.header,
+ (char *)(msg->NASmsg.value),
+ size,
+ emm_security_context);
+ }
+
+ if (bytes > 0) {
+ LOG_FUNC_RETURN (AS_UL_INFO_TRANSFER_REQ);
+ }
+ }
+
+ LOG_FUNC_RETURN (0);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: _emm_as_status_ind() **
+ ** **
+ ** Description: Processes the EMMAS-SAP status indication primitive **
+ ** **
+ ** EMMAS-SAP - EMM->AS: STATUS_IND - EMM status report procedure **
+ ** **
+ ** Inputs: msg: The EMMAS-SAP primitive to process **
+ ** Others: None **
+ ** **
+ ** Outputs: as_msg: The message to send to the AS **
+ ** Return: The identifier of the AS message **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+static int _emm_as_status_ind(const emm_as_status_t *msg,
+ ul_info_transfer_req_t *as_msg)
+{
+ LOG_FUNC_IN;
+
+ int size = 0;
+
+ LOG_TRACE(INFO, "EMMAS-SAP - Send AS status indication (cause=%d)",
+ msg->emm_cause);
+
+ nas_message_t nas_msg;
+ memset(&nas_msg, 0 , sizeof(nas_message_t));
+
+ /* Setup the AS message */
+ if (msg->guti) {
+ as_msg->s_tmsi.MMEcode = msg->guti->gummei.MMEcode;
+ as_msg->s_tmsi.m_tmsi = msg->guti->m_tmsi;
+ } else {
+ as_msg->UEid = msg->ueid;
+ }
+
+ /* Setup the NAS security header */
+ EMM_msg *emm_msg = _emm_as_set_header(&nas_msg, &msg->sctx);
+
+ /* Setup the NAS information message */
+ if (emm_msg != NULL) {
+ size = emm_send_status(msg, &emm_msg->emm_status);
+ }
+
+ if (size > 0) {
+ emm_security_context_t *emm_security_context = NULL;
+
+ emm_security_context = _emm_data.security;
+
+ if (emm_security_context) {
+
+ nas_msg.header.sequence_number = emm_security_context->ul_count.seq_num;
+ LOG_TRACE(DEBUG,
+ "Set nas_msg.header.sequence_number -> %u",
+ nas_msg.header.sequence_number);
+ }
+
+ /* Encode the NAS information message */
+ int bytes = _emm_as_encode(
+ &as_msg->nasMsg,
+ &nas_msg,
+ size,
+ emm_security_context);
+
+ if (bytes > 0) {
+ LOG_FUNC_RETURN (AS_UL_INFO_TRANSFER_REQ);
+ }
+ }
+
+ LOG_FUNC_RETURN (0);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: _emm_as_release_req() **
+ ** **
+ ** Description: Processes the EMMAS-SAP connection release request **
+ ** primitive **
+ ** **
+ ** EMMAS-SAP - EMM->AS: RELEASE_REQ - NAS signalling release procedure **
+ ** **
+ ** Inputs: msg: The EMMAS-SAP primitive to process **
+ ** Others: None **
+ ** **
+ ** Outputs: as_msg: The message to send to the AS **
+ ** Return: The identifier of the AS message **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+static int _emm_as_release_req(const emm_as_release_t *msg,
+ nas_release_req_t *as_msg)
+{
+ LOG_FUNC_IN;
+
+ LOG_TRACE(INFO, "EMMAS-SAP - Send AS release request");
+
+ /* Setup the AS message */
+ if (msg->guti) {
+ as_msg->s_tmsi.MMEcode = msg->guti->gummei.MMEcode;
+ as_msg->s_tmsi.m_tmsi = msg->guti->m_tmsi;
+ } else {
+ as_msg->UEid = msg->ueid;
+ }
+
+ if (msg->cause == EMM_AS_CAUSE_AUTHENTICATION) {
+ as_msg->cause = AS_AUTHENTICATION_FAILURE;
+ } else if (msg->cause == EMM_AS_CAUSE_DETACH) {
+ as_msg->cause = AS_DETACH;
+ }
+
+ LOG_FUNC_RETURN (AS_NAS_RELEASE_REQ);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: _emm_as_security_res() **
+ ** **
+ ** Description: Processes the EMMAS-SAP security response primitive **
+ ** **
+ ** EMMAS-SAP - EMM->AS: SECURITY_RES - Security mode control procedure **
+ ** **
+ ** Inputs: msg: The EMMAS-SAP primitive to process **
+ ** Others: None **
+ ** **
+ ** Outputs: as_msg: The message to send to the AS **
+ ** Return: The identifier of the AS message **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+static int _emm_as_security_res(const emm_as_security_t *msg,
+ ul_info_transfer_req_t *as_msg)
+{
+ LOG_FUNC_IN;
+
+ int size = 0;
+
+ LOG_TRACE(INFO, "EMMAS-SAP - Send AS security response");
+
+ nas_message_t nas_msg;
+ memset(&nas_msg, 0 , sizeof(nas_message_t));
+
+ /* Setup the AS message */
+ if (msg->guti) {
+ as_msg->s_tmsi.MMEcode = msg->guti->gummei.MMEcode;
+ as_msg->s_tmsi.m_tmsi = msg->guti->m_tmsi;
+ }
+
+ /* Setup the NAS security header */
+ EMM_msg *emm_msg = _emm_as_set_header(&nas_msg, &msg->sctx);
+
+ /* Setup the NAS security message */
+ if (emm_msg != NULL) switch (msg->msgType) {
+ case EMM_AS_MSG_TYPE_IDENT:
+ size = emm_send_identity_response(
+ msg,
+ &emm_msg->identity_response);
+ break;
+
+ case EMM_AS_MSG_TYPE_AUTH:
+ if (msg->emm_cause != EMM_CAUSE_SUCCESS) {
+ size = emm_send_authentication_failure(
+ msg,
+ &emm_msg->authentication_failure);
+ } else {
+ size = emm_send_authentication_response(
+ msg,
+ &emm_msg->authentication_response);
+ }
+
+ break;
+
+ case EMM_AS_MSG_TYPE_SMC:
+ if (msg->emm_cause != EMM_CAUSE_SUCCESS) {
+ size = emm_send_security_mode_reject(
+ msg,
+ &emm_msg->security_mode_reject);
+ } else {
+ size = emm_send_security_mode_complete(
+ msg,
+ &emm_msg->security_mode_complete);
+ }
+
+ break;
+
+ default:
+ LOG_TRACE(WARNING, "EMMAS-SAP - Type of NAS security "
+ "message 0x%.2x is not valid", msg->msgType);
+ }
+
+ if (size > 0) {
+ /* Encode the NAS security message */
+ int bytes = _emm_as_encode(&as_msg->nasMsg,
+ &nas_msg,
+ size,
+ _emm_data.security);
+
+ if (bytes > 0) {
+ LOG_FUNC_RETURN (AS_UL_INFO_TRANSFER_REQ);
+ }
+ }
+
+ LOG_FUNC_RETURN (0);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: _emm_as_establish_req() **
+ ** **
+ ** Description: Processes the EMMAS-SAP connection establish request **
+ ** primitive **
+ ** **
+ ** EMMAS-SAP - EMM->AS: ESTABLISH_REQ - NAS signalling connection **
+ ** The NAS requests the AS to establish signalling connection **
+ ** to tranfer initial NAS message to the network. **
+ ** **
+ ** Inputs: msg: The EMMAS-SAP primitive to process **
+ ** Others: None **
+ ** **
+ ** Outputs: as_msg: The message to send to the AS **
+ ** Return: The identifier of the AS message **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+static int _emm_as_establish_req(const emm_as_establish_t *msg,
+ nas_establish_req_t *as_msg)
+{
+ LOG_FUNC_IN;
+
+ int size = 0;
+
+ LOG_TRACE(INFO, "EMMAS-SAP - Send AS connection establish request");
+
+ nas_message_t nas_msg;
+ memset(&nas_msg, 0 , sizeof(nas_message_t));
+
+ /* Setup the AS message */
+ as_msg->cause = msg->RRCcause;
+ as_msg->type = msg->RRCtype;
+ as_msg->plmnID = *msg->plmnID;
+
+ /* Derive the S-TMSI from the GUTI, if valid */
+ if (msg->UEid.guti) {
+ as_msg->s_tmsi.MMEcode = msg->UEid.guti->gummei.MMEcode;
+ as_msg->s_tmsi.m_tmsi = msg->UEid.guti->m_tmsi;
+ }
+
+ /* Setup the NAS security header */
+ EMM_msg *emm_msg = _emm_as_set_header(&nas_msg, &msg->sctx);
+
+ /* Setup the initial NAS information message */
+ if (emm_msg != NULL) switch (msg->NASinfo) {
+ case EMM_AS_NAS_INFO_ATTACH:
+ size = emm_send_attach_request(msg, &emm_msg->attach_request);
+ break;
+
+ case EMM_AS_NAS_INFO_DETACH:
+ size = emm_send_initial_detach_request(msg,
+ &emm_msg->detach_request);
+ break;
+
+ case EMM_AS_NAS_INFO_TAU:
+ size = emm_send_initial_tau_request(msg,
+ &emm_msg->tracking_area_update_request);
+ break;
+
+ case EMM_AS_NAS_INFO_SR:
+ size = emm_send_initial_sr_request(msg,
+ &emm_msg->service_request);
+ break;
+
+ case EMM_AS_NAS_INFO_EXTSR:
+ size = emm_send_initial_extsr_request(msg,
+ &emm_msg->extended_service_request);
+ break;
+
+ default:
+ LOG_TRACE(WARNING, "EMMAS-SAP - Type of initial NAS "
+ "message 0x%.2x is not valid", msg->NASinfo);
+ break;
+ }
+
+ if (size > 0) {
+ /* Encode the initial NAS information message */
+ int bytes = _emm_as_encode(
+ &as_msg->initialNasMsg,
+ &nas_msg,
+ size,
+ _emm_data.security);
+
+ if (bytes > 0) {
+ LOG_FUNC_RETURN (AS_NAS_ESTABLISH_REQ);
+ }
+ }
+
+ LOG_FUNC_RETURN (0);
+}
+
+
+
+/****************************************************************************
+ ** **
+ ** Name: _emm_as_cell_info_req() **
+ ** **
+ ** Description: Processes the EMMAS-SAP cell information request **
+ ** primitive **
+ ** **
+ ** EMMAS-SAP - EMM->AS: CELL_INFO_REQ - PLMN and cell selection procedure **
+ ** The NAS requests the AS to select a cell belonging to the **
+ ** selected PLMN with associated Radio Access Technologies. **
+ ** **
+ ** Inputs: msg: The EMMAS-SAP primitive to process **
+ ** Others: None **
+ ** **
+ ** Outputs: as_msg: The message to send to the AS **
+ ** Return: The identifier of the AS message **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+static int _emm_as_cell_info_req(const emm_as_cell_info_t *msg,
+ cell_info_req_t *as_msg)
+{
+ LOG_FUNC_IN;
+
+ LOG_TRACE(INFO, "EMMAS-SAP - Send AS cell information request");
+
+ as_msg->plmnID = msg->plmnIDs.plmn[0];
+ as_msg->rat = msg->rat;
+
+ LOG_FUNC_RETURN (AS_CELL_INFO_REQ);
+}
+
diff --git a/openair-cn/NAS/UE/EMM/SAP/emm_as.h b/openair-cn/NAS/UE/EMM/SAP/emm_as.h
new file mode 100755
index 0000000000..ca4fc449b7
--- /dev/null
+++ b/openair-cn/NAS/UE/EMM/SAP/emm_as.h
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+Source emm_as.h
+
+Version 0.1
+
+Date 2012/10/16
+
+Product NAS stack
+
+Subsystem EPS Mobility Management
+
+Author Frederic Maurel
+
+Description Defines the EMMAS Service Access Point that provides
+ services to the EPS Mobility Management for NAS message
+ transfer to/from the Access Stratum sublayer.
+
+*****************************************************************************/
+#ifndef __EMM_AS_H__
+#define __EMM_AS_H__
+
+#include "emm_asDef.h"
+
+/****************************************************************************/
+/********************* G L O B A L C O N S T A N T S *******************/
+/****************************************************************************/
+
+/****************************************************************************/
+/************************ G L O B A L T Y P E S ************************/
+/****************************************************************************/
+
+/****************************************************************************/
+/******************** G L O B A L V A R I A B L E S ********************/
+/****************************************************************************/
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+void emm_as_initialize(void);
+
+int emm_as_send(const emm_as_t *msg);
+
+#endif /* __EMM_AS_H__*/
diff --git a/openair-cn/NAS/UE/EMM/SAP/emm_asDef.h b/openair-cn/NAS/UE/EMM/SAP/emm_asDef.h
new file mode 100755
index 0000000000..fbd2a6b38e
--- /dev/null
+++ b/openair-cn/NAS/UE/EMM/SAP/emm_asDef.h
@@ -0,0 +1,276 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+
+Source emm_asDef.h
+
+Version 0.1
+
+Date 2012/10/16
+
+Product NAS stack
+
+Subsystem EPS Mobility Management
+
+Author Frederic Maurel
+
+Description Defines the EMM primitives available at the EMMAS Service
+ Access Point to transfer NAS messages to/from the Access
+ Stratum sublayer.
+
+*****************************************************************************/
+#ifndef __EMM_ASDEF_H__
+#define __EMM_ASDEF_H__
+
+#include "commonDef.h"
+#include "OctetString.h"
+
+/****************************************************************************/
+/********************* G L O B A L C O N S T A N T S *******************/
+/****************************************************************************/
+
+/*
+ * EMMAS-SAP primitives
+ */
+typedef enum emm_as_primitive_u {
+ _EMMAS_START = 200,
+ _EMMAS_SECURITY_REQ, /* EMM->AS: Security request */
+ _EMMAS_SECURITY_IND, /* AS->EMM: Security indication */
+ _EMMAS_SECURITY_RES, /* EMM->AS: Security response */
+ _EMMAS_SECURITY_REJ, /* EMM->AS: Security reject */
+ _EMMAS_ESTABLISH_REQ, /* EMM->AS: Connection establish request */
+ _EMMAS_ESTABLISH_CNF, /* AS->EMM: Connection establish confirm */
+ _EMMAS_ESTABLISH_REJ, /* AS->EMM: Connection establish reject */
+ _EMMAS_RELEASE_REQ, /* EMM->AS: Connection release request */
+ _EMMAS_RELEASE_IND, /* AS->EMM: Connection release indication */
+ _EMMAS_DATA_REQ, /* EMM->AS: Data transfer request */
+ _EMMAS_DATA_IND, /* AS->EMM: Data transfer indication */
+ _EMMAS_PAGE_IND, /* AS->EMM: Paging data indication */
+ _EMMAS_STATUS_IND, /* AS->EMM: Status indication */
+ _EMMAS_CELL_INFO_REQ, /* EMM->AS: Cell information request */
+ _EMMAS_CELL_INFO_RES, /* AS->EMM: Cell information response */
+ _EMMAS_CELL_INFO_IND, /* AS->EMM: Cell information indication */
+ _EMMAS_END
+} emm_as_primitive_t;
+
+/* Data used to setup EPS NAS security */
+typedef struct emm_as_security_data_s {
+ uint8_t is_new; /* New security data indicator */
+#define EMM_AS_NO_KEY_AVAILABLE 0xff
+ uint8_t ksi; /* NAS key set identifier */
+ uint8_t sqn; /* Sequence number */
+ uint32_t count; /* NAS counter */
+ const OctetString *k_enc; /* NAS cyphering key */
+ const OctetString *k_int; /* NAS integrity key */
+} emm_as_security_data_t;
+
+/****************************************************************************/
+/************************ G L O B A L T Y P E S ************************/
+/****************************************************************************/
+
+/*
+ * EMMAS primitive for security
+ * ----------------------------
+ */
+typedef struct emm_as_security_s {
+ uint32_t ueid; /* UE lower layer identifier */
+ const GUTI_t *guti; /* GUTI temporary mobile identity */
+ emm_as_security_data_t sctx;/* EPS NAS security context */
+ int emm_cause; /* EMM failure cause code */
+ /*
+ * Identity request/response
+ */
+ uint8_t identType; /* Type of requested UE's identity */
+ const imsi_t *imsi; /* The requested IMSI of the UE */
+ const imei_t *imei; /* The requested IMEI of the UE */
+ uint32_t tmsi; /* The requested TMSI of the UE */
+ /*
+ * Authentication request/response
+ */
+ uint8_t ksi; /* NAS key set identifier */
+ const OctetString *rand; /* Random challenge number */
+ const OctetString *autn; /* Authentication token */
+ const OctetString *res; /* Authentication response */
+ const OctetString *auts; /* Synchronisation failure */
+ /*
+ * Security Mode Command
+ */
+ uint8_t eea; /* Replayed EPS encryption algorithms */
+ uint8_t eia; /* Replayed EPS integrity algorithms */
+ uint8_t uea; /* Replayed UMTS encryption algorithms */
+ uint8_t ucs2;
+ uint8_t uia; /* Replayed UMTS integrity algorithms */
+ uint8_t gea; /* Replayed GPRS encryption algorithms */
+ uint8_t umts_present;
+ uint8_t gprs_present;
+
+ // Added by LG
+ uint8_t selected_eea; /* Selected EPS encryption algorithms */
+ uint8_t selected_eia; /* Selected EPS integrity algorithms */
+
+#define EMM_AS_MSG_TYPE_IDENT 0x01 /* Identification message */
+#define EMM_AS_MSG_TYPE_AUTH 0x02 /* Authentication message */
+#define EMM_AS_MSG_TYPE_SMC 0x03 /* Security Mode Command */
+ uint8_t msgType; /* Type of NAS security message to transfer */
+} emm_as_security_t;
+
+/*
+ * EMMAS primitive for connection establishment
+ * --------------------------------------------
+ */
+typedef struct emm_as_EPS_identity_s {
+ const GUTI_t *guti; /* The GUTI, if valid */
+ const tai_t *tai; /* The last visited registered Tracking
+ * Area Identity, if available */
+ const imsi_t *imsi; /* IMSI in case of "AttachWithImsi" */
+ const imei_t *imei; /* UE's IMEI for emergency bearer services */
+} emm_as_EPS_identity_t;
+
+typedef struct emm_as_establish_s {
+ uint32_t ueid; /* UE lower layer identifier */
+ emm_as_EPS_identity_t UEid; /* UE's EPS mobile identity */
+ emm_as_security_data_t sctx;/* EPS NAS security context */
+ int switch_off; /* TRUE if the UE is switched off */
+ uint8_t type; /* Network attach/detach type */
+ uint8_t RRCcause; /* Connection establishment cause */
+ uint8_t RRCtype; /* Associated call type */
+ const plmn_t *plmnID; /* Identifier of the selected PLMN */
+ uint8_t ksi; /* NAS key set identifier */
+ uint8_t encryption:4; /* Ciphering algorithm */
+ uint8_t integrity:4; /* Integrity protection algorithm */
+ int emm_cause; /* EMM failure cause code */
+ const GUTI_t *new_guti; /* New GUTI, if re-allocated */
+ int n_tacs; /* Number of concecutive tracking areas
+ * the UE is registered to */
+ tac_t tac; /* Code of the first tracking area the UE
+ * is registered to */
+#define EMM_AS_NAS_INFO_ATTACH 0x01 /* Attach request */
+#define EMM_AS_NAS_INFO_DETACH 0x02 /* Detach request */
+#define EMM_AS_NAS_INFO_TAU 0x03 /* Tracking Area Update request */
+#define EMM_AS_NAS_INFO_SR 0x04 /* Service Request */
+#define EMM_AS_NAS_INFO_EXTSR 0x05 /* Extended Service Request */
+ uint8_t NASinfo; /* Type of initial NAS information to transfer */
+ OctetString NASmsg; /* NAS message to be transfered within
+ * initial NAS information message */
+} emm_as_establish_t;
+
+/*
+ * EMMAS primitive for connection release
+ * --------------------------------------
+ */
+typedef struct emm_as_release_s {
+ uint32_t ueid; /* UE lower layer identifier */
+ const GUTI_t *guti; /* GUTI temporary mobile identity */
+#define EMM_AS_CAUSE_AUTHENTICATION 0x01 /* Authentication failure */
+#define EMM_AS_CAUSE_DETACH 0x02 /* Detach requested */
+ uint8_t cause; /* Release cause */
+} emm_as_release_t;
+
+/*
+ * EMMAS primitive for data transfer
+ * ---------------------------------
+ */
+typedef struct emm_as_data_s {
+ uint32_t ueid; /* UE lower layer identifier */
+ const GUTI_t *guti; /* GUTI temporary mobile identity */
+ emm_as_security_data_t sctx;/* EPS NAS security context */
+ int switch_off; /* TRUE if the UE is switched off */
+ uint8_t type; /* Network detach type */
+ uint8_t delivered; /* Data message delivery indicator */
+#define EMM_AS_NAS_DATA_ATTACH 0x01 /* Attach complete */
+#define EMM_AS_NAS_DATA_DETACH 0x02 /* Detach request */
+ uint8_t NASinfo; /* Type of NAS information to transfer */
+ OctetString NASmsg; /* NAS message to be transfered */
+} emm_as_data_t;
+
+/*
+ * EMMAS primitive for paging
+ * --------------------------
+ */
+typedef struct emm_as_page_s {} emm_as_page_t;
+
+/*
+ * EMMAS primitive for status indication
+ * -------------------------------------
+ */
+typedef struct emm_as_status_s {
+ uint32_t ueid; /* UE lower layer identifier */
+ const GUTI_t *guti; /* GUTI temporary mobile identity */
+ emm_as_security_data_t sctx;/* EPS NAS security context */
+ int emm_cause; /* EMM failure cause code */
+} emm_as_status_t;
+
+/*
+ * EMMAS primitive for cell information
+ * ------------------------------------
+ */
+typedef struct emm_as_cell_info_s {
+ uint8_t found; /* Indicates whether a suitable cell is found */
+#define EMM_AS_PLMN_LIST_SIZE 6
+ PLMN_LIST_T(EMM_AS_PLMN_LIST_SIZE) plmnIDs;
+ /* List of identifiers of available PLMNs */
+ Byte_t rat; /* Bitmap of Radio Access Technologies */
+ tac_t tac; /* Tracking Area Code */
+ ci_t cellID; /* cell identity */
+} emm_as_cell_info_t;
+
+/*
+ * --------------------------------
+ * Structure of EMMAS-SAP primitive
+ * --------------------------------
+ */
+typedef struct emm_as_s {
+ emm_as_primitive_t primitive;
+ union {
+ emm_as_security_t security;
+ emm_as_establish_t establish;
+ emm_as_release_t release;
+ emm_as_data_t data;
+ emm_as_page_t page;
+ emm_as_status_t status;
+ emm_as_cell_info_t cell_info;
+ } u;
+} emm_as_t;
+
+/****************************************************************************/
+/******************** G L O B A L V A R I A B L E S ********************/
+/****************************************************************************/
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+/*
+ * Defined in LowerLayer.c
+ * Setup security data according to the given EPS security context
+ */
+void emm_as_set_security_data(emm_as_security_data_t *data, const void *context,
+ int is_new, int is_ciphered);
+
+#endif /* __EMM_ASDEF_H__*/
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_esm.c b/openair-cn/NAS/UE/EMM/SAP/emm_esm.c
old mode 100644
new mode 100755
similarity index 99%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_esm.c
rename to openair-cn/NAS/UE/EMM/SAP/emm_esm.c
index 3ffdecb80a..4a5400e0c1
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_esm.c
+++ b/openair-cn/NAS/UE/EMM/SAP/emm_esm.c
@@ -52,9 +52,7 @@ Description Defines the EMMESM Service Access Point that provides
#include "LowerLayer.h"
-#ifdef NAS_UE
#include "emm_proc.h"
-#endif
/****************************************************************************/
/**************** E X T E R N A L D E F I N I T I O N S ****************/
@@ -68,11 +66,9 @@ Description Defines the EMMESM Service Access Point that provides
* String representation of EMMESM-SAP primitives
*/
static const char *_emm_esm_primitive_str[] = {
-#ifdef NAS_UE
"EMMESM_ESTABLISH_REQ",
"EMMESM_ESTABLISH_CNF",
"EMMESM_ESTABLISH_REJ",
-#endif
"EMMESM_RELEASE_IND",
"EMMESM_UNITDATA_REQ",
"EMMESM_UNITDATA_IND",
@@ -130,7 +126,6 @@ int emm_esm_send(const emm_esm_t *msg)
_emm_esm_primitive_str[primitive - _EMMESM_START - 1], primitive);
switch (primitive) {
-#ifdef NAS_UE
case _EMMESM_ESTABLISH_REQ:
/* ESM requests EMM to initiate an attach procedure before
@@ -158,7 +153,6 @@ int emm_esm_send(const emm_esm_t *msg)
case _EMMESM_ESTABLISH_REJ:
/* ESM notifies EMM that PDN connectivity procedure failed */
break;
-#endif
case _EMMESM_UNITDATA_REQ:
/* ESM requests EMM to transfer ESM data unit to lower layer */
diff --git a/openair-cn/NAS/UE/EMM/SAP/emm_esm.h b/openair-cn/NAS/UE/EMM/SAP/emm_esm.h
new file mode 100755
index 0000000000..6967b97ca1
--- /dev/null
+++ b/openair-cn/NAS/UE/EMM/SAP/emm_esm.h
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+
+Source emm_esm.h
+
+Version 0.1
+
+Date 2012/10/16
+
+Product NAS stack
+
+Subsystem EPS Mobility Management
+
+Author Frederic Maurel
+
+Description Defines the EMMESM Service Access Point that provides
+ interlayer services to the EPS Session Management sublayer
+ for service registration and activate/deactivate PDP context.
+
+*****************************************************************************/
+#ifndef __EMM_ESM_H__
+#define __EMM_ESM_H__
+
+#include "emm_esmDef.h"
+
+/****************************************************************************/
+/********************* G L O B A L C O N S T A N T S *******************/
+/****************************************************************************/
+
+/****************************************************************************/
+/************************ G L O B A L T Y P E S ************************/
+/****************************************************************************/
+
+/****************************************************************************/
+/******************** G L O B A L V A R I A B L E S ********************/
+/****************************************************************************/
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+void emm_esm_initialize(void);
+
+int emm_esm_send(const emm_esm_t *msg);
+
+#endif /* __EMM_ESM_H__*/
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_esmDef.h b/openair-cn/NAS/UE/EMM/SAP/emm_esmDef.h
old mode 100644
new mode 100755
similarity index 98%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_esmDef.h
rename to openair-cn/NAS/UE/EMM/SAP/emm_esmDef.h
index 179cdcb1af..215be4fa6d
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_esmDef.h
+++ b/openair-cn/NAS/UE/EMM/SAP/emm_esmDef.h
@@ -60,11 +60,9 @@ Description Defines the EMMESM Service Access Point that provides
*/
typedef enum {
_EMMESM_START = 100,
-#ifdef NAS_UE
_EMMESM_ESTABLISH_REQ,
_EMMESM_ESTABLISH_CNF,
_EMMESM_ESTABLISH_REJ,
-#endif
_EMMESM_RELEASE_IND,
_EMMESM_UNITDATA_REQ,
_EMMESM_UNITDATA_IND,
@@ -102,9 +100,6 @@ typedef struct {
typedef struct {
emm_esm_primitive_t primitive;
unsigned int ueid;
-#if defined(NAS_MME)
- emm_data_context_t *ctx;
-#endif
union {
emm_esm_establish_t establish;
emm_esm_data_t data;
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_fsm.c b/openair-cn/NAS/UE/EMM/SAP/emm_fsm.c
old mode 100644
new mode 100755
similarity index 84%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_fsm.c
rename to openair-cn/NAS/UE/EMM/SAP/emm_fsm.c
index 7a93c1e92d..59c78be3e2
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_fsm.c
+++ b/openair-cn/NAS/UE/EMM/SAP/emm_fsm.c
@@ -49,23 +49,15 @@ Description Defines the EPS Mobility Management procedures executed at
#include "commonDef.h"
#include "nas_log.h"
-#include "mme_api.h"
#include "emmData.h"
-#if defined(NAS_BUILT_IN_EPC)
-# include "assertions.h"
-#endif
+
/****************************************************************************/
/**************** E X T E R N A L D E F I N I T I O N S ****************/
/****************************************************************************/
-#ifdef NAS_UE
#define EMM_FSM_NB_UE_MAX 1
-#endif
-#ifdef NAS_MME
-#define EMM_FSM_NB_UE_MAX (MME_API_NB_UE_MAX + 1)
-#endif
/****************************************************************************/
/******************* L O C A L D E F I N I T I O N S *******************/
@@ -79,7 +71,6 @@ Description Defines the EPS Mobility Management procedures executed at
/* String representation of EMM events */
static const char *_emm_fsm_event_str[] = {
-#ifdef NAS_UE
"S1_ENABLED",
"S1_DISABLED",
"NO_IMSI",
@@ -92,13 +83,6 @@ static const char *_emm_fsm_event_str[] = {
"ATTACH_FAILED",
"ATTACH_EXCEEDED",
"AUTHENTICATION_REJ",
-#endif
-#ifdef NAS_MME
- "COMMON_PROC_REQ",
- "COMMON_PROC_CNF",
- "COMMON_PROC_REJ",
- "PROC_ABORT",
-#endif
"ATTACH_CNF",
"ATTACH_REJ",
"DETACH_INIT",
@@ -119,13 +103,10 @@ static const char *_emm_fsm_event_str[] = {
/* String representation of EMM status */
static const char *_emm_fsm_status_str[EMM_STATE_MAX] = {
"INVALID",
-#ifdef NAS_UE
"NULL",
-#endif
"DEREGISTERED",
"REGISTERED",
"DEREGISTERED-INITIATED",
-#ifdef NAS_UE
"DEREGISTERED.NORMAL-SERVICE",
"DEREGISTERED.LIMITED-SERVICE",
"DEREGISTERED.ATTEMPTING-TO-ATTACH",
@@ -144,10 +125,6 @@ static const char *_emm_fsm_status_str[EMM_STATE_MAX] = {
"REGISTERED.IMSI-DETACH-INITIATED",
"TRACKING-AREA-UPDATING-INITIATED",
"SERVICE-REQUEST-INITIATED",
-#endif
-#ifdef NAS_MME
- "COMMON-PROCEDURE-INITIATED",
-#endif
};
/*
@@ -159,13 +136,10 @@ static const char *_emm_fsm_status_str[EMM_STATE_MAX] = {
/* Type of the EPS Mobility Management state machine handler */
typedef int(*emm_fsm_handler_t)(const emm_reg_t *);
-#ifdef NAS_UE
int EmmNull(const emm_reg_t *);
-#endif
int EmmDeregistered(const emm_reg_t *);
int EmmRegistered(const emm_reg_t *);
int EmmDeregisteredInitiated(const emm_reg_t *);
-#ifdef NAS_UE
int EmmDeregisteredNormalService(const emm_reg_t *);
int EmmDeregisteredLimitedService(const emm_reg_t *);
int EmmDeregisteredAttemptingToAttach(const emm_reg_t *);
@@ -184,21 +158,15 @@ int EmmRegisteredAttemptingToUpdate(const emm_reg_t *);
int EmmRegisteredImsiDetachInitiated(const emm_reg_t *);
int EmmTrackingAreaUpdatingInitiated(const emm_reg_t *);
int EmmServiceRequestInitiated(const emm_reg_t *);
-#endif
-#ifdef NAS_MME
-int EmmCommonProcedureInitiated(const emm_reg_t *);
-#endif
+
/* EMM state machine handlers */
static const emm_fsm_handler_t _emm_fsm_handlers[EMM_STATE_MAX] = {
NULL,
-#ifdef NAS_UE
EmmNull,
-#endif
EmmDeregistered,
EmmRegistered,
EmmDeregisteredInitiated,
-#ifdef NAS_UE
EmmDeregisteredNormalService,
EmmDeregisteredLimitedService,
EmmDeregisteredAttemptingToAttach,
@@ -217,10 +185,6 @@ static const emm_fsm_handler_t _emm_fsm_handlers[EMM_STATE_MAX] = {
EmmRegisteredImsiDetachInitiated,
EmmTrackingAreaUpdatingInitiated,
EmmServiceRequestInitiated,
-#endif
-#ifdef NAS_MME
- EmmCommonProcedureInitiated,
-#endif
};
/*
@@ -229,9 +193,7 @@ static const emm_fsm_handler_t _emm_fsm_handlers[EMM_STATE_MAX] = {
* -----------------------------------------------------------------------------
*/
-#if !defined(NAS_BUILT_IN_EPC)
emm_fsm_state_t _emm_fsm_status[EMM_FSM_NB_UE_MAX];
-#endif
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
@@ -256,17 +218,7 @@ void emm_fsm_initialize(void)
int ueid;
LOG_FUNC_IN;
-#ifdef NAS_UE
_emm_fsm_status[0] = EMM_NULL;
-#endif
-
-#if defined(NAS_MME) && !defined(NAS_BUILT_IN_EPC)
-
- for (ueid = 0; ueid < EMM_FSM_NB_UE_MAX; ueid++) {
- _emm_fsm_status[ueid] = EMM_DEREGISTERED;
- }
-
-#endif
LOG_FUNC_OUT;
}
@@ -287,36 +239,13 @@ void emm_fsm_initialize(void)
** **
***************************************************************************/
int emm_fsm_set_status(
-#ifdef NAS_MME
- unsigned int ueid,
- void *ctx,
-#endif
emm_fsm_state_t status)
{
LOG_FUNC_IN;
-#ifdef NAS_UE
unsigned int ueid = 0;
-#endif
-#if defined(NAS_BUILT_IN_EPC)
- emm_data_context_t *emm_ctx = (emm_data_context_t *)ctx;
- DevAssert(emm_ctx != NULL);
-
- if ((status < EMM_STATE_MAX) && (ueid > 0)) {
- LOG_TRACE(INFO, "EMM-FSM - Status changed: %s ===> %s",
- _emm_fsm_status_str[emm_ctx->_emm_fsm_status],
- _emm_fsm_status_str[status]);
-
- if (status != emm_ctx->_emm_fsm_status) {
- emm_ctx->_emm_fsm_status = status;
- }
-
- LOG_FUNC_RETURN (RETURNok);
- }
-
-#else
if ( (status < EMM_STATE_MAX) && (ueid < EMM_FSM_NB_UE_MAX) ) {
LOG_TRACE(INFO, "EMM-FSM - Status changed: %s ===> %s",
@@ -330,8 +259,6 @@ int emm_fsm_set_status(
LOG_FUNC_RETURN (RETURNok);
}
-#endif
-
LOG_FUNC_RETURN (RETURNerror);
}
@@ -350,33 +277,10 @@ int emm_fsm_set_status(
** Others: None **
** **
***************************************************************************/
-#ifdef NAS_UE
emm_fsm_state_t emm_fsm_get_status(void)
{
return (_emm_fsm_status[0]);
}
-#endif
-
-#ifdef NAS_MME
-emm_fsm_state_t emm_fsm_get_status(unsigned int ueid, void *ctx)
-{
-# if defined(NAS_BUILT_IN_EPC)
- emm_data_context_t *emm_ctx = (emm_data_context_t *)ctx;
-
- if (emm_ctx != NULL) {
- return emm_ctx->_emm_fsm_status;
- }
-
-# else
-
- if (ueid < EMM_FSM_NB_UE_MAX) {
- return (_emm_fsm_status[ueid]);
- }
-
-#endif
- return EMM_STATE_MAX;
-}
-#endif
/****************************************************************************
** **
@@ -402,33 +306,12 @@ int emm_fsm_process(const emm_reg_t *evt)
primitive = evt->primitive;
-#ifdef NAS_UE
status = _emm_fsm_status[0];
-#endif
-#ifdef NAS_MME
-# if defined(NAS_BUILT_IN_EPC)
- emm_data_context_t *emm_ctx = (emm_data_context_t *)evt->ctx;
-
- DevAssert(emm_ctx != NULL);
-
- status = emm_fsm_get_status(0, emm_ctx);
-# else
-
- if (evt->ueid >= EMM_FSM_NB_UE_MAX) {
- LOG_FUNC_RETURN (RETURNerror);
- }
-
- status = _emm_fsm_status[evt->ueid];
-# endif
-#endif
LOG_TRACE(INFO, "EMM-FSM - Received event %s (%d) in state %s",
_emm_fsm_event_str[primitive - _EMMREG_START - 1], primitive,
_emm_fsm_status_str[status]);
-#if defined(NAS_BUILT_IN_EPC)
- DevAssert(status != EMM_INVALID);
-#endif
/* Execute the EMM state machine */
rc = (_emm_fsm_handlers[status])(evt);
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_fsm.h b/openair-cn/NAS/UE/EMM/SAP/emm_fsm.h
old mode 100644
new mode 100755
similarity index 92%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_fsm.h
rename to openair-cn/NAS/UE/EMM/SAP/emm_fsm.h
index 69e6ae7934..e554f0f9e2
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_fsm.h
+++ b/openair-cn/NAS/UE/EMM/SAP/emm_fsm.h
@@ -65,13 +65,10 @@ Description Defines the EPS Mobility Management procedures executed at
*/
typedef enum {
EMM_INVALID,
-#ifdef NAS_UE
EMM_NULL,
-#endif
EMM_DEREGISTERED,
EMM_REGISTERED,
EMM_DEREGISTERED_INITIATED,
-#ifdef NAS_UE
EMM_DEREGISTERED_NORMAL_SERVICE,
EMM_DEREGISTERED_LIMITED_SERVICE,
EMM_DEREGISTERED_ATTEMPTING_TO_ATTACH,
@@ -90,10 +87,6 @@ typedef enum {
EMM_REGISTERED_IMSI_DETACH_INITIATED,
EMM_TRACKING_AREA_UPDATING_INITIATED,
EMM_SERVICE_REQUEST_INITIATED,
-#endif
-#ifdef NAS_MME
- EMM_COMMON_PROCEDURE_INITIATED,
-#endif
EMM_STATE_MAX
} emm_fsm_state_t;
@@ -107,15 +100,9 @@ typedef enum {
void emm_fsm_initialize(void);
-#ifdef NAS_UE
int emm_fsm_set_status(emm_fsm_state_t status);
emm_fsm_state_t emm_fsm_get_status(void);
-#endif
-#ifdef NAS_MME
-//LG 2015-03-13 struct emm_data_context_t;
-int emm_fsm_set_status(unsigned int ueid, void *ctx, emm_fsm_state_t status);
-emm_fsm_state_t emm_fsm_get_status(unsigned int ueid, void *ctx);
-#endif
+
int emm_fsm_process(const emm_reg_t *evt);
diff --git a/openair-cn/NAS/UE/EMM/SAP/emm_recv.c b/openair-cn/NAS/UE/EMM/SAP/emm_recv.c
new file mode 100755
index 0000000000..de9347fcff
--- /dev/null
+++ b/openair-cn/NAS/UE/EMM/SAP/emm_recv.c
@@ -0,0 +1,486 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+
+Source emm_recv.c
+
+Version 0.1
+
+Date 2013/01/30
+
+Product NAS stack
+
+Subsystem EPS Mobility Management
+
+Author Frederic Maurel
+
+Description Defines functions executed at the EMMAS Service Access
+ Point upon receiving EPS Mobility Management messages
+ from the Access Stratum sublayer.
+
+*****************************************************************************/
+
+#include "emm_recv.h"
+#include "commonDef.h"
+#include "nas_log.h"
+
+#include "emm_msgDef.h"
+#include "emm_cause.h"
+#include "emm_proc.h"
+
+#include // memcpy
+
+/****************************************************************************/
+/**************** E X T E R N A L D E F I N I T I O N S ****************/
+/****************************************************************************/
+
+/****************************************************************************/
+/******************* L O C A L D E F I N I T I O N S *******************/
+/****************************************************************************/
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+/****************************************************************************/
+/********************* L O C A L F U N C T I O N S *********************/
+/****************************************************************************/
+
+/*
+ * --------------------------------------------------------------------------
+ * Functions executed by both the UE and the MME upon receiving EMM messages
+ * --------------------------------------------------------------------------
+ */
+/****************************************************************************
+ ** **
+ ** Name: emm_recv_status() **
+ ** **
+ ** Description: Processes EMM status message **
+ ** **
+ ** Inputs: ueid: UE lower layer identifier **
+ ** msg: The received EMM message **
+ ** Others: None **
+ ** **
+ ** Outputs: emm_cause: EMM cause code **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int emm_recv_status(unsigned int ueid, emm_status_msg *msg, int *emm_cause)
+{
+ LOG_FUNC_IN;
+
+ int rc;
+
+ LOG_TRACE(INFO, "EMMAS-SAP - Received EMM Status message (cause=%d)",
+ msg->emmcause);
+
+ /*
+ * Message checking
+ */
+ *emm_cause = EMM_CAUSE_SUCCESS;
+ /*
+ * Message processing
+ */
+ rc = emm_proc_status_ind(ueid, msg->emmcause);
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/*
+ * --------------------------------------------------------------------------
+ * Functions executed by the UE upon receiving EMM message from the network
+ * --------------------------------------------------------------------------
+ */
+/****************************************************************************
+ ** **
+ ** Name: emm_recv_attach_accept() **
+ ** **
+ ** Description: Processes Attach Accept message **
+ ** **
+ ** Inputs: msg: The received EMM message **
+ ** Others: None **
+ ** **
+ ** Outputs: emm_cause: EMM cause code **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int emm_recv_attach_accept(attach_accept_msg *msg, int *emm_cause)
+{
+ LOG_FUNC_IN;
+
+ int rc;
+ int i;
+
+ LOG_TRACE(INFO, "EMMAS-SAP - Received Attach Accept message");
+
+ /*
+ * Message checking
+ */
+ if (msg->tailist.typeoflist !=
+ TRACKING_AREA_IDENTITY_LIST_ONE_PLMN_CONSECUTIVE_TACS) {
+ /* Only list of TACs belonging to one PLMN with consecutive
+ * TAC values is supported */
+ *emm_cause = EMM_CAUSE_IE_NOT_IMPLEMENTED;
+ } else if ( (msg->presencemask & ATTACH_ACCEPT_GUTI_PRESENT) &&
+ (msg->guti.guti.typeofidentity != EPS_MOBILE_IDENTITY_GUTI) ) {
+ /* The only supported type of EPS mobile identity is GUTI */
+ *emm_cause = EMM_CAUSE_IE_NOT_IMPLEMENTED;
+ }
+
+ /* Handle message checking error */
+ if (*emm_cause != EMM_CAUSE_SUCCESS) {
+ LOG_FUNC_RETURN (RETURNerror);
+ }
+
+ /*
+ * Message processing
+ */
+ /* Compute timers value */
+ long T3412, T3402 = -1, T3423 = -1;
+ T3412 = gprs_timer_value(&msg->t3412value);
+
+ if (msg->presencemask & ATTACH_ACCEPT_T3402_VALUE_PRESENT) {
+ T3402 = gprs_timer_value(&msg->t3402value);
+ }
+
+ if (msg->presencemask & ATTACH_ACCEPT_T3423_VALUE_PRESENT) {
+ T3423 = gprs_timer_value(&msg->t3423value);
+ }
+
+ /* Get the tracking area list the UE is registered to */
+
+ /* LW: number of elements is coded as N-1 (0 -> 1 element, 1 -> 2 elements...),
+ * see 3GPP TS 24.301, section 9.9.3.33.1 */
+ int n_tais = msg->tailist.numberofelements + 1;
+ tai_t tai[n_tais];
+
+ for (i = 0; i < n_tais; i++) {
+ tai[i].plmn.MCCdigit1 = msg->tailist.mccdigit1;
+ tai[i].plmn.MCCdigit2 = msg->tailist.mccdigit2;
+ tai[i].plmn.MCCdigit3 = msg->tailist.mccdigit3;
+ tai[i].plmn.MNCdigit1 = msg->tailist.mncdigit1;
+ tai[i].plmn.MNCdigit2 = msg->tailist.mncdigit2;
+ tai[i].plmn.MNCdigit3 = msg->tailist.mncdigit3;
+ tai[i].tac = msg->tailist.tac + i;
+ }
+
+ /* Get the GUTI */
+ GUTI_t *pguti = NULL;
+ GUTI_t guti;
+
+ if (msg->presencemask & ATTACH_ACCEPT_GUTI_PRESENT) {
+ pguti = &guti;
+ guti.gummei.plmn.MCCdigit1 = msg->guti.guti.mccdigit1;
+ guti.gummei.plmn.MCCdigit2 = msg->guti.guti.mccdigit2;
+ guti.gummei.plmn.MCCdigit3 = msg->guti.guti.mccdigit3;
+ guti.gummei.plmn.MNCdigit1 = msg->guti.guti.mncdigit1;
+ guti.gummei.plmn.MNCdigit2 = msg->guti.guti.mncdigit2;
+ guti.gummei.plmn.MNCdigit3 = msg->guti.guti.mncdigit3;
+ guti.gummei.MMEgid = msg->guti.guti.mmegroupid;
+ guti.gummei.MMEcode = msg->guti.guti.mmecode;
+ guti.m_tmsi = msg->guti.guti.mtmsi;
+ }
+
+ /* Get the list of equivalent PLMNs */
+ int n_eplmns = 0;
+ plmn_t eplmn;
+
+ if (msg->presencemask & ATTACH_ACCEPT_EQUIVALENT_PLMNS_PRESENT) {
+ n_eplmns = 1;
+ eplmn.MCCdigit1 = msg->equivalentplmns.mccdigit1;
+ eplmn.MCCdigit2 = msg->equivalentplmns.mccdigit2;
+ eplmn.MCCdigit3 = msg->equivalentplmns.mccdigit3;
+ eplmn.MNCdigit1 = msg->equivalentplmns.mncdigit1;
+ eplmn.MNCdigit2 = msg->equivalentplmns.mncdigit2;
+ eplmn.MNCdigit3 = msg->equivalentplmns.mncdigit3;
+ }
+
+ /* Execute attach procedure accepted by the network */
+ rc = emm_proc_attach_accept(T3412, T3402, T3423, n_tais, tai, pguti,
+ n_eplmns, &eplmn,
+ &msg->esmmessagecontainer.esmmessagecontainercontents);
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: emm_recv_attach_reject() **
+ ** **
+ ** Description: Processes Attach Reject message **
+ ** **
+ ** Inputs: msg: The received EMM message **
+ ** Others: None **
+ ** **
+ ** Outputs: emm_cause: EMM cause code **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int emm_recv_attach_reject(attach_reject_msg *msg, int *emm_cause)
+{
+ LOG_FUNC_IN;
+
+ int rc;
+
+ LOG_TRACE(INFO, "EMMAS-SAP - Received Attach Reject message (cause=%d)",
+ msg->emmcause);
+
+ /*
+ * Message checking
+ */
+ if ( (msg->emmcause == EMM_CAUSE_ESM_FAILURE) &&
+ !(msg->presencemask & ATTACH_REJECT_ESM_MESSAGE_CONTAINER_PRESENT) ) {
+ /* The ATTACH REJECT message shall be combined with a PDN
+ * CONNECTIVITY REJECT message contained in the ESM message
+ * container information element */
+ *emm_cause = EMM_CAUSE_INVALID_MANDATORY_INFO;
+ }
+
+ /* Handle message checking error */
+ if (*emm_cause != EMM_CAUSE_SUCCESS) {
+ LOG_FUNC_RETURN (RETURNerror);
+ }
+
+ /*
+ * Message processing
+ */
+ if (msg->presencemask & ATTACH_REJECT_ESM_MESSAGE_CONTAINER_PRESENT) {
+ /* Execute attach procedure rejected by the network */
+ rc = emm_proc_attach_reject(msg->emmcause,
+ &msg->esmmessagecontainer.esmmessagecontainercontents);
+ } else {
+ /* Execute attach procedure rejected by the network */
+ rc = emm_proc_attach_reject(msg->emmcause, NULL);
+ }
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: emm_recv_detach_accept() **
+ ** **
+ ** Description: Processes Detach Accept message **
+ ** **
+ ** Inputs: msg: The received EMM message **
+ ** Others: None **
+ ** **
+ ** Outputs: emm_cause: EMM cause code **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int emm_recv_detach_accept(detach_accept_msg *msg, int *emm_cause)
+{
+ LOG_FUNC_IN;
+
+ int rc;
+
+ LOG_TRACE(INFO, "EMMAS-SAP - Received Detach Accept message");
+
+ /*
+ * Message processing
+ */
+ /* Execute the UE initiated detach procedure completion by the UE */
+ rc = emm_proc_detach_accept();
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: emm_recv_identity_request() **
+ ** **
+ ** Description: Processes Identity Request message **
+ ** **
+ ** Inputs: msg: The received EMM message **
+ ** Others: None **
+ ** **
+ ** Outputs: emm_cause: EMM cause code **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int emm_recv_identity_request(identity_request_msg *msg, int *emm_cause)
+{
+ LOG_FUNC_IN;
+
+ int rc;
+
+ LOG_TRACE(INFO, "EMMAS-SAP - Received Identity Request message");
+
+ /*
+ * Message processing
+ */
+ /* Get the requested identity type */
+ emm_proc_identity_type_t type;
+
+ if (msg->identitytype == IDENTITY_TYPE_2_IMSI) {
+ type = EMM_IDENT_TYPE_IMSI;
+ } else if (msg->identitytype == IDENTITY_TYPE_2_IMEI) {
+ type = EMM_IDENT_TYPE_IMEI;
+ } else if (msg->identitytype == IDENTITY_TYPE_2_IMEISV) {
+ type = EMM_IDENT_TYPE_IMEISV;
+ } else if (msg->identitytype == IDENTITY_TYPE_2_TMSI) {
+ type = EMM_IDENT_TYPE_TMSI;
+ } else {
+ /* All other values are interpreted as IMSI */
+ type = EMM_IDENT_TYPE_IMSI;
+ }
+
+ /* Execute the identification procedure initiated by the network */
+ rc = emm_proc_identification_request(type);
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: emm_recv_authentication_request() **
+ ** **
+ ** Description: Processes Authentication Request message **
+ ** **
+ ** Inputs: msg: The received EMM message **
+ ** Others: None **
+ ** **
+ ** Outputs: emm_cause: EMM cause code **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int emm_recv_authentication_request(authentication_request_msg *msg,
+ int *emm_cause)
+{
+ LOG_FUNC_IN;
+
+ int rc;
+
+ LOG_TRACE(INFO, "EMMAS-SAP - Received Authentication Request message");
+
+ /*
+ * Message checking
+ */
+ if ( (msg->authenticationparameterrand.rand.length == 0) ||
+ (msg->authenticationparameterautn.autn.length == 0) ) {
+ /* RAND and AUTN parameters shall not be null */
+ *emm_cause = EMM_CAUSE_INVALID_MANDATORY_INFO;
+ }
+
+ /* Handle message checking error */
+ if (*emm_cause != EMM_CAUSE_SUCCESS) {
+ LOG_FUNC_RETURN (RETURNerror);
+ }
+
+ /*
+ * Message processing
+ */
+ /* Execute the authentication procedure initiated by the network */
+ rc = emm_proc_authentication_request(
+ msg->naskeysetidentifierasme.tsc != NAS_KEY_SET_IDENTIFIER_MAPPED,
+ msg->naskeysetidentifierasme.naskeysetidentifier,
+ &msg->authenticationparameterrand.rand,
+ &msg->authenticationparameterautn.autn);
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: emm_recv_authentication_reject() **
+ ** **
+ ** Description: Processes Authentication Reject message **
+ ** **
+ ** Inputs: msg: The received EMM message **
+ ** Others: None **
+ ** **
+ ** Outputs: emm_cause: EMM cause code **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int emm_recv_authentication_reject(authentication_reject_msg *msg,
+ int *emm_cause)
+{
+ LOG_FUNC_IN;
+
+ int rc;
+
+ LOG_TRACE(INFO, "EMMAS-SAP - Received Authentication Reject message");
+
+ /*
+ * Message processing
+ */
+ /* Execute the authentication procedure not accepted by the network */
+ rc = emm_proc_authentication_reject();
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: emm_recv_security_mode_command() **
+ ** **
+ ** Description: Processes Security Mode Command message **
+ ** **
+ ** Inputs: msg: The received EMM message **
+ ** Others: None **
+ ** **
+ ** Outputs: emm_cause: EMM cause code **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int emm_recv_security_mode_command(security_mode_command_msg *msg,
+ int *emm_cause)
+{
+ LOG_FUNC_IN;
+
+ int rc;
+
+ LOG_TRACE(INFO, "EMMAS-SAP - Received Security Mode Command message");
+
+ /*
+ * Message processing
+ */
+ /* Execute the security mode control procedure initiated by the network */
+ rc = emm_proc_security_mode_command(
+ msg->naskeysetidentifier.tsc != NAS_KEY_SET_IDENTIFIER_MAPPED,
+ msg->naskeysetidentifier.naskeysetidentifier,
+ msg->selectednassecurityalgorithms.typeofcipheringalgorithm,
+ msg->selectednassecurityalgorithms.typeofintegrityalgorithm,
+ msg->replayeduesecuritycapabilities.eea,
+ msg->replayeduesecuritycapabilities.eia);
+
+ LOG_FUNC_RETURN (rc);
+}
+
+
diff --git a/openair-cn/NAS/UE/EMM/SAP/emm_recv.h b/openair-cn/NAS/UE/EMM/SAP/emm_recv.h
new file mode 100755
index 0000000000..a096eef376
--- /dev/null
+++ b/openair-cn/NAS/UE/EMM/SAP/emm_recv.h
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+
+Source emm_recv.h
+
+Version 0.1
+
+Date 2013/01/30
+
+Product NAS stack
+
+Subsystem EPS Mobility Management
+
+Author Frederic Maurel
+
+Description Defines functions executed at the EMMAS Service Access
+ Point upon receiving EPS Mobility Management messages
+ from the Access Stratum sublayer.
+
+*****************************************************************************/
+#ifndef __EMM_RECV_H__
+#define __EMM_RECV_H__
+
+#include "EmmStatus.h"
+
+#include "DetachRequest.h"
+#include "DetachAccept.h"
+
+#include "AttachAccept.h"
+#include "AttachReject.h"
+#include "TrackingAreaUpdateAccept.h"
+#include "TrackingAreaUpdateReject.h"
+#include "ServiceReject.h"
+#include "GutiReallocationCommand.h"
+#include "AuthenticationRequest.h"
+#include "AuthenticationReject.h"
+#include "IdentityRequest.h"
+#include "NASSecurityModeCommand.h"
+#include "EmmInformation.h"
+#include "DownlinkNasTransport.h"
+#include "CsServiceNotification.h"
+
+/****************************************************************************/
+/********************* G L O B A L C O N S T A N T S *******************/
+/****************************************************************************/
+
+/****************************************************************************/
+/************************ G L O B A L T Y P E S ************************/
+/****************************************************************************/
+
+/****************************************************************************/
+/******************** G L O B A L V A R I A B L E S ********************/
+/****************************************************************************/
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+/*
+ * --------------------------------------------------------------------------
+ * Functions executed by both the UE and the MME upon receiving EMM messages
+ * --------------------------------------------------------------------------
+ */
+int emm_recv_status(unsigned int ueid, emm_status_msg *msg, int *emm_cause);
+
+/*
+ * --------------------------------------------------------------------------
+ * Functions executed by the UE upon receiving EMM message from the network
+ * --------------------------------------------------------------------------
+ */
+int emm_recv_attach_accept(attach_accept_msg *msg, int *emm_cause);
+int emm_recv_attach_reject(attach_reject_msg *msg, int *emm_cause);
+
+int emm_recv_detach_accept(detach_accept_msg *msg, int *emm_cause);
+
+int emm_recv_identity_request(identity_request_msg *msg, int *emm_cause);
+int emm_recv_authentication_request(authentication_request_msg *msg,
+ int *emm_cause);
+int emm_recv_authentication_reject(authentication_reject_msg *msg,
+ int *emm_cause);
+int emm_recv_security_mode_command(security_mode_command_msg *msg,
+ int *emm_cause);
+
+#endif /* __EMM_RECV_H__*/
diff --git a/openair-cn/NAS/UE/EMM/SAP/emm_reg.c b/openair-cn/NAS/UE/EMM/SAP/emm_reg.c
new file mode 100755
index 0000000000..ca19566cb9
--- /dev/null
+++ b/openair-cn/NAS/UE/EMM/SAP/emm_reg.c
@@ -0,0 +1,126 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+
+Source emm_reg.c
+
+Version 0.1
+
+Date 2012/10/16
+
+Product NAS stack
+
+Subsystem EPS Mobility Management
+
+Author Frederic Maurel
+
+Description Defines the EMMREG Service Access Point that provides
+ registration services for location updating and attach/detach
+ procedures.
+
+*****************************************************************************/
+
+#include "emm_reg.h"
+#include "commonDef.h"
+#include "nas_log.h"
+
+#include "emm_fsm.h"
+
+#include
+
+/****************************************************************************/
+/**************** E X T E R N A L D E F I N I T I O N S ****************/
+/****************************************************************************/
+
+/****************************************************************************/
+/******************* L O C A L D E F I N I T I O N S *******************/
+/****************************************************************************/
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+/****************************************************************************
+ ** **
+ ** Name: emm_reg_initialize() **
+ ** **
+ ** Description: Initializes the EMMREG Service Access Point **
+ ** **
+ ** Inputs: None **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: None **
+ ** Others: NONE **
+ ** **
+ ***************************************************************************/
+void emm_reg_initialize(void)
+{
+ LOG_FUNC_IN;
+
+ /* Initialize the EMM state machine */
+ emm_fsm_initialize();
+
+ LOG_FUNC_OUT;
+}
+
+/****************************************************************************
+ ** **
+ ** Name: emm_reg_send() **
+ ** **
+ ** Description: Processes the EMMREG Service Access Point primitive **
+ ** **
+ ** Inputs: msg: The EMMREG-SAP primitive to process **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int emm_reg_send(const emm_reg_t *msg)
+{
+ LOG_FUNC_IN;
+
+ int rc;
+
+ /* Check the EMM-SAP primitive */
+ emm_reg_primitive_t primitive = msg->primitive;
+ assert( (primitive > _EMMREG_START) && (primitive < _EMMREG_END));
+
+ /* Execute the EMM procedure */
+ rc = emm_fsm_process(msg);
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************/
+/********************* L O C A L F U N C T I O N S *********************/
+/****************************************************************************/
+
diff --git a/openair3/RAL-LTE/RAL-DUMMY/INCLUDE/eRALlte_parameters.h b/openair-cn/NAS/UE/EMM/SAP/emm_reg.h
old mode 100644
new mode 100755
similarity index 74%
rename from openair3/RAL-LTE/RAL-DUMMY/INCLUDE/eRALlte_parameters.h
rename to openair-cn/NAS/UE/EMM/SAP/emm_reg.h
index 73f0054c33..62d333395c
--- a/openair3/RAL-LTE/RAL-DUMMY/INCLUDE/eRALlte_parameters.h
+++ b/openair-cn/NAS/UE/EMM/SAP/emm_reg.h
@@ -23,23 +23,32 @@
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@eurecom.fr
- Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
+ Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
*******************************************************************************/
-/*! \file eRALlte_parameters.h
- * \brief
- * \author BRIZZOLA Davide, GAUTHIER Lionel, MAUREL Frederic, WETTERWALD Michelle
- * \date 2012
- * \version
- * \note
- * \bug
- * \warning
- */
+/*****************************************************************************
-#ifndef __RAL_LTE_PARAMETERS_H__
-#define __RAL_LTE_PARAMETERS_H__
+Source emm_reg.h
-#include "MIH_C.h"
+Version 0.1
+
+Date 2012/10/16
+
+Product NAS stack
+
+Subsystem EPS Mobility Management
+
+Author Frederic Maurel
+
+Description Defines the EMMREG Service Access Point that provides
+ registration services for location updating and attach/detach
+ procedures.
+
+*****************************************************************************/
+#ifndef __EMM_REG_H__
+#define __EMM_REG_H__
+
+#include "emm_regDef.h"
/****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/
@@ -57,6 +66,8 @@
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
-void eRALlte_get_parameters_request(MIH_C_Message_Link_Get_Parameters_request_t* messageP);
+void emm_reg_initialize(void);
-#endif
+int emm_reg_send(const emm_reg_t *msg);
+
+#endif /* __EMM_REG_H__*/
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_regDef.h b/openair-cn/NAS/UE/EMM/SAP/emm_regDef.h
old mode 100644
new mode 100755
similarity index 89%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_regDef.h
rename to openair-cn/NAS/UE/EMM/SAP/emm_regDef.h
index c3343eabb7..6a85d8923d
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_regDef.h
+++ b/openair-cn/NAS/UE/EMM/SAP/emm_regDef.h
@@ -59,7 +59,6 @@ Description Defines the EMMREG Service Access Point that provides
*/
typedef enum {
_EMMREG_START = 0,
-#ifdef NAS_UE
_EMMREG_S1_ENABLED, /* S1 mode is enabled */
_EMMREG_S1_DISABLED, /* S1 mode is disabled */
_EMMREG_NO_IMSI, /* The UE is powered on without a valid USIM */
@@ -72,13 +71,6 @@ typedef enum {
_EMMREG_ATTACH_FAILED, /* Attach attempt failed */
_EMMREG_ATTACH_EXCEEDED, /* Attach attempt exceeded */
_EMMREG_AUTH_REJ, /* Authentication rejected */
-#endif
-#ifdef NAS_MME
- _EMMREG_COMMON_PROC_REQ, /* EMM common procedure requested */
- _EMMREG_COMMON_PROC_CNF, /* EMM common procedure successful */
- _EMMREG_COMMON_PROC_REJ, /* EMM common procedure failed */
- _EMMREG_PROC_ABORT, /* EMM procedure aborted */
-#endif
_EMMREG_ATTACH_CNF, /* EPS network attach accepted */
_EMMREG_ATTACH_REJ, /* EPS network attach rejected */
_EMMREG_DETACH_INIT, /* Network detach initiated */
@@ -101,7 +93,6 @@ typedef enum {
/************************ G L O B A L T Y P E S ************************/
/****************************************************************************/
-#ifdef NAS_UE
/*
* EMMREG primitive for network registration procedure
* ----------------------------------------------------
@@ -110,7 +101,6 @@ typedef struct {
int index; /* Index of the currently selected PLMN in the ordered
* list of available PLMNs */
} emm_reg_register_t;
-#endif
/*
* EMMREG primitive for attach procedure
@@ -130,15 +120,6 @@ typedef struct {
int type; /* Network detach type */
} emm_reg_detach_t;
-#ifdef NAS_MME
-/*
- * EMMREG primitive for EMM common procedures
- * ------------------------------------------
- */
-typedef struct {
- int is_attached; /* UE context attach indicator */
-} emm_reg_common_t;
-#endif
/*
* Structure of EMMREG-SAP primitive
@@ -151,12 +132,7 @@ typedef struct {
union {
emm_reg_attach_t attach;
emm_reg_detach_t detach;
-#ifdef NAS_UE
emm_reg_register_t regist;
-#endif
-#ifdef NAS_MME
- emm_reg_common_t common;
-#endif
} u;
} emm_reg_t;
diff --git a/openair-cn/NAS/UE/EMM/SAP/emm_sap.c b/openair-cn/NAS/UE/EMM/SAP/emm_sap.c
new file mode 100755
index 0000000000..84184f4f76
--- /dev/null
+++ b/openair-cn/NAS/UE/EMM/SAP/emm_sap.c
@@ -0,0 +1,143 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+Source emm_sap.c
+
+Version 0.1
+
+Date 2012/10/01
+
+Product NAS stack
+
+Subsystem EPS Mobility Management
+
+Author Frederic Maurel
+
+Description Defines the EMM Service Access Points at which the EPS
+ Mobility Management sublayer provides procedures for the
+ control of security and mobility when the User Equipment
+ is using the Evolved UTRA Network.
+
+*****************************************************************************/
+
+#include "emm_sap.h"
+#include "commonDef.h"
+#include "nas_log.h"
+
+#include "emm_reg.h"
+#include "emm_esm.h"
+#include "emm_as.h"
+
+/****************************************************************************/
+/**************** E X T E R N A L D E F I N I T I O N S ****************/
+/****************************************************************************/
+
+/****************************************************************************/
+/******************* L O C A L D E F I N I T I O N S *******************/
+/****************************************************************************/
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+/****************************************************************************
+ ** **
+ ** Name: emm_sap_initialize() **
+ ** **
+ ** Description: Initializes the EMM Service Access Points **
+ ** **
+ ** Inputs: None **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: None **
+ ** Others: NONE **
+ ** **
+ ***************************************************************************/
+void emm_sap_initialize(void)
+{
+ LOG_FUNC_IN;
+
+ emm_reg_initialize();
+ emm_esm_initialize();
+ emm_as_initialize();
+
+ LOG_FUNC_OUT;
+}
+
+/****************************************************************************
+ ** **
+ ** Name: emm_sap_send() **
+ ** **
+ ** Description: Processes the EMM Service Access Point primitive **
+ ** **
+ ** Inputs: msg: The EMM-SAP primitive to process **
+ ** Others: None **
+ ** **
+ ** Outputs: msg: The EMM-SAP primitive to process **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int emm_sap_send(emm_sap_t *msg)
+{
+ int rc = RETURNerror;
+
+ emm_primitive_t primitive = msg->primitive;
+
+ LOG_FUNC_IN;
+
+ /* Check the EMM-SAP primitive */
+ if ( (primitive > (emm_primitive_t)EMMREG_PRIMITIVE_MIN) &&
+ (primitive < (emm_primitive_t)EMMREG_PRIMITIVE_MAX) ) {
+ /* Forward to the EMMREG-SAP */
+ msg->u.emm_reg.primitive = primitive;
+ rc = emm_reg_send(&msg->u.emm_reg);
+ } else if ( (primitive > (emm_primitive_t)EMMESM_PRIMITIVE_MIN) &&
+ (primitive < (emm_primitive_t)EMMESM_PRIMITIVE_MAX) ) {
+ /* Forward to the EMMESM-SAP */
+ msg->u.emm_esm.primitive = primitive;
+ rc = emm_esm_send(&msg->u.emm_esm);
+ } else if ( (primitive > (emm_primitive_t)EMMAS_PRIMITIVE_MIN) &&
+ (primitive < (emm_primitive_t)EMMAS_PRIMITIVE_MAX) ) {
+ /* Forward to the EMMAS-SAP */
+ msg->u.emm_as.primitive = primitive;
+ rc = emm_as_send(&msg->u.emm_as);
+ }
+ else {
+ LOG_TRACE(WARNING, "EMM-SAP - Out of range primitive (%d)", primitive);
+ }
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************/
+/********************* L O C A L F U N C T I O N S *********************/
+/****************************************************************************/
+
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_sap.h b/openair-cn/NAS/UE/EMM/SAP/emm_sap.h
old mode 100644
new mode 100755
similarity index 89%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_sap.h
rename to openair-cn/NAS/UE/EMM/SAP/emm_sap.h
index 865bc0e012..c0c38d13a6
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_sap.h
+++ b/openair-cn/NAS/UE/EMM/SAP/emm_sap.h
@@ -53,7 +53,6 @@ Description Defines the EMM Service Access Points at which the EPS
#include "emm_regDef.h"
#include "emm_esmDef.h"
#include "emm_asDef.h"
-#include "emm_cnDef.h"
/****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/
@@ -71,7 +70,6 @@ Description Defines the EMM Service Access Points at which the EPS
*/
typedef enum {
/* EMMREG-SAP */
-#ifdef NAS_UE
EMMREG_S1_ENABLED = _EMMREG_S1_ENABLED,
EMMREG_S1_DISABLED = _EMMREG_S1_DISABLED,
EMMREG_NO_IMSI = _EMMREG_NO_IMSI,
@@ -84,13 +82,6 @@ typedef enum {
EMMREG_ATTACH_FAILED = _EMMREG_ATTACH_FAILED,
EMMREG_ATTACH_EXCEEDED = _EMMREG_ATTACH_EXCEEDED,
EMMREG_AUTH_REJ = _EMMREG_AUTH_REJ,
-#endif
-#ifdef NAS_MME
- EMMREG_COMMON_PROC_REQ = _EMMREG_COMMON_PROC_REQ,
- EMMREG_COMMON_PROC_CNF = _EMMREG_COMMON_PROC_CNF,
- EMMREG_COMMON_PROC_REJ = _EMMREG_COMMON_PROC_REJ,
- EMMREG_PROC_ABORT = _EMMREG_PROC_ABORT,
-#endif
EMMREG_ATTACH_CNF = _EMMREG_ATTACH_CNF,
EMMREG_ATTACH_REJ = _EMMREG_ATTACH_REJ,
EMMREG_DETACH_INIT = _EMMREG_DETACH_INIT,
@@ -107,11 +98,9 @@ typedef enum {
EMMREG_LOWERLAYER_FAILURE = _EMMREG_LOWERLAYER_FAILURE,
EMMREG_LOWERLAYER_RELEASE = _EMMREG_LOWERLAYER_RELEASE,
/* EMMESM-SAP */
-#ifdef NAS_UE
EMMESM_ESTABLISH_REQ = _EMMESM_ESTABLISH_REQ,
EMMESM_ESTABLISH_CNF = _EMMESM_ESTABLISH_CNF,
EMMESM_ESTABLISH_REJ = _EMMESM_ESTABLISH_REJ,
-#endif
EMMESM_RELEASE_IND = _EMMESM_RELEASE_IND,
EMMESM_UNITDATA_REQ = _EMMESM_UNITDATA_REQ,
EMMESM_UNITDATA_IND = _EMMESM_UNITDATA_IND,
@@ -132,14 +121,6 @@ typedef enum {
EMMAS_CELL_INFO_REQ = _EMMAS_CELL_INFO_REQ,
EMMAS_CELL_INFO_RES = _EMMAS_CELL_INFO_RES,
EMMAS_CELL_INFO_IND = _EMMAS_CELL_INFO_IND,
-
-#ifdef NAS_BUILT_IN_EPC
- EMMCN_AUTHENTICATION_PARAM_RES = _EMMCN_AUTHENTICATION_PARAM_RES,
- EMMCN_AUTHENTICATION_PARAM_FAIL = _EMMCN_AUTHENTICATION_PARAM_FAIL,
- EMMCN_DEREGISTER_UE = _EMMCN_DEREGISTER_UE,
- EMMCN_PDN_CONNECTIVITY_RES = _EMMCN_PDN_CONNECTIVITY_RES,
- EMMCN_PDN_CONNECTIVITY_FAIL = _EMMCN_PDN_CONNECTIVITY_FAIL
-#endif
} emm_primitive_t;
/*
@@ -165,15 +146,12 @@ typedef enum {
/*
* Structure of EPS Mobility Management primitive
*/
-typedef struct {
+typedef struct emm_sap_s {
emm_primitive_t primitive;
union {
emm_reg_t emm_reg; /* EMMREG-SAP primitives */
emm_esm_t emm_esm; /* EMMESM-SAP primitives */
emm_as_t emm_as; /* EMMAS-SAP primitives */
-#if defined(NAS_BUILT_IN_EPC)
- emm_cn_t emm_cn; /* EMMCN-SAP primitives */
-#endif
} u;
} emm_sap_t;
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_send.c b/openair-cn/NAS/UE/EMM/SAP/emm_send.c
old mode 100644
new mode 100755
similarity index 70%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_send.c
rename to openair-cn/NAS/UE/EMM/SAP/emm_send.c
index d5fac26fe1..75431ae388
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_send.c
+++ b/openair-cn/NAS/UE/EMM/SAP/emm_send.c
@@ -146,7 +146,6 @@ int emm_send_detach_accept(const emm_as_data_t *msg,
* Functions executed by the UE to send EMM messages to the network
* --------------------------------------------------------------------------
*/
-#ifdef NAS_UE
/****************************************************************************
** **
** Name: emm_send_attach_request() **
@@ -904,371 +903,6 @@ int emm_send_security_mode_reject(const emm_as_security_t *msg,
LOG_FUNC_RETURN (size);
}
-#endif // NAS_UE
-
-/*
- * --------------------------------------------------------------------------
- * Functions executed by the MME to send EMM messages to the UE
- * --------------------------------------------------------------------------
- */
-#ifdef NAS_MME
-/****************************************************************************
- ** **
- ** Name: emm_send_attach_accept() **
- ** **
- ** Description: Builds Attach Accept message **
- ** **
- ** The Attach Accept message is sent by the network to the **
- ** UE to indicate that the corresponding attach request has **
- ** been accepted. **
- ** **
- ** Inputs: msg: The EMMAS-SAP primitive to process **
- ** Others: None **
- ** **
- ** Outputs: emm_msg: The EMM message to be sent **
- ** Return: The size of the EMM message **
- ** Others: None **
- ** **
- ***************************************************************************/
-int emm_send_attach_accept(const emm_as_establish_t *msg,
- attach_accept_msg *emm_msg)
-{
- LOG_FUNC_IN;
-
- int size = EMM_HEADER_MAXIMUM_LENGTH;
-
- LOG_TRACE(INFO, "EMMAS-SAP - Send Attach Accept message");
- LOG_TRACE(INFO, "EMMAS-SAP - size = EMM_HEADER_MAXIMUM_LENGTH(%d)",
- size);
-
- /* Mandatory - Message type */
- emm_msg->messagetype = ATTACH_ACCEPT;
-
- /* Mandatory - EPS attach result */
- size += EPS_ATTACH_RESULT_MAXIMUM_LENGTH;
- emm_msg->epsattachresult = EPS_ATTACH_RESULT_EPS;
-
- /* Mandatory - T3412 value */
- size += GPRS_TIMER_MAXIMUM_LENGTH;
- emm_msg->t3412value.unit = GPRS_TIMER_UNIT_0S;
- LOG_TRACE(INFO, "EMMAS-SAP - size += GPRS_TIMER_MAXIMUM_LENGTH(%d) (%d)",
- GPRS_TIMER_MAXIMUM_LENGTH, size);
-
- /* Mandatory - Tracking area identity list */
- size += TRACKING_AREA_IDENTITY_LIST_MINIMUM_LENGTH;
- emm_msg->tailist.typeoflist =
- TRACKING_AREA_IDENTITY_LIST_ONE_PLMN_CONSECUTIVE_TACS;
- emm_msg->tailist.numberofelements = msg->n_tacs;
- emm_msg->tailist.mccdigit1 = msg->UEid.guti->gummei.plmn.MCCdigit1;
- emm_msg->tailist.mccdigit2 = msg->UEid.guti->gummei.plmn.MCCdigit2;
- emm_msg->tailist.mccdigit3 = msg->UEid.guti->gummei.plmn.MCCdigit3;
- emm_msg->tailist.mncdigit1 = msg->UEid.guti->gummei.plmn.MNCdigit1;
- emm_msg->tailist.mncdigit2 = msg->UEid.guti->gummei.plmn.MNCdigit2;
- emm_msg->tailist.mncdigit3 = msg->UEid.guti->gummei.plmn.MNCdigit3;
- emm_msg->tailist.tac = msg->tac;
- LOG_TRACE(INFO,
- "EMMAS-SAP - size += "\
- "TRACKING_AREA_IDENTITY_LIST_MINIMUM_LENGTH(%d) (%d)",
- TRACKING_AREA_IDENTITY_LIST_MINIMUM_LENGTH,
- size);
-
- /* Mandatory - ESM message container */
- size += ESM_MESSAGE_CONTAINER_MINIMUM_LENGTH + msg->NASmsg.length;
- emm_msg->esmmessagecontainer.esmmessagecontainercontents = msg->NASmsg;
- LOG_TRACE(INFO,
- "EMMAS-SAP - size += "\
- "ESM_MESSAGE_CONTAINER_MINIMUM_LENGTH(%d) (%d)",
- ESM_MESSAGE_CONTAINER_MINIMUM_LENGTH,
- size);
-
- /* Optional - GUTI */
- if (msg->new_guti) {
- size += EPS_MOBILE_IDENTITY_MAXIMUM_LENGTH;
- emm_msg->presencemask |= ATTACH_ACCEPT_GUTI_PRESENT;
- emm_msg->guti.guti.typeofidentity = EPS_MOBILE_IDENTITY_GUTI;
- emm_msg->guti.guti.oddeven = EPS_MOBILE_IDENTITY_EVEN;
- emm_msg->guti.guti.mmegroupid = msg->new_guti->gummei.MMEgid;
- emm_msg->guti.guti.mmecode = msg->new_guti->gummei.MMEcode;
- emm_msg->guti.guti.mtmsi = msg->new_guti->m_tmsi;
- emm_msg->guti.guti.mccdigit1 = msg->new_guti->gummei.plmn.MCCdigit1;
- emm_msg->guti.guti.mccdigit2 = msg->new_guti->gummei.plmn.MCCdigit2;
- emm_msg->guti.guti.mccdigit3 = msg->new_guti->gummei.plmn.MCCdigit3;
- emm_msg->guti.guti.mncdigit1 = msg->new_guti->gummei.plmn.MNCdigit1;
- emm_msg->guti.guti.mncdigit2 = msg->new_guti->gummei.plmn.MNCdigit2;
- emm_msg->guti.guti.mncdigit3 = msg->new_guti->gummei.plmn.MNCdigit3;
- LOG_TRACE(INFO,
- "EMMAS-SAP - size += "\
- "EPS_MOBILE_IDENTITY_MAXIMUM_LENGTH(%d) (%d)",
- EPS_MOBILE_IDENTITY_MAXIMUM_LENGTH,
- size);
- }
-
- LOG_FUNC_RETURN (size);
-}
-
-/****************************************************************************
- ** **
- ** Name: emm_send_attach_reject() **
- ** **
- ** Description: Builds Attach Reject message **
- ** **
- ** The Attach Reject message is sent by the network to the **
- ** UE to indicate that the corresponding attach request has **
- ** been rejected. **
- ** **
- ** Inputs: msg: The EMMAS-SAP primitive to process **
- ** Others: None **
- ** **
- ** Outputs: emm_msg: The EMM message to be sent **
- ** Return: The size of the EMM message **
- ** Others: None **
- ** **
- ***************************************************************************/
-int emm_send_attach_reject(const emm_as_establish_t *msg,
- attach_reject_msg *emm_msg)
-{
- LOG_FUNC_IN;
-
- int size = EMM_HEADER_MAXIMUM_LENGTH;
-
- LOG_TRACE(INFO, "EMMAS-SAP - Send Attach Reject message (cause=%d)",
- msg->emm_cause);
-
- /* Mandatory - Message type */
- emm_msg->messagetype = ATTACH_REJECT;
-
- /* Mandatory - EMM cause */
- size += EMM_CAUSE_MAXIMUM_LENGTH;
- emm_msg->emmcause = msg->emm_cause;
-
- /* Optional - ESM message container */
- if (msg->NASmsg.length > 0) {
- size += ESM_MESSAGE_CONTAINER_MINIMUM_LENGTH + msg->NASmsg.length;
- emm_msg->presencemask |= ATTACH_REJECT_ESM_MESSAGE_CONTAINER_PRESENT;
- emm_msg->esmmessagecontainer.esmmessagecontainercontents = msg->NASmsg;
- }
-
- LOG_FUNC_RETURN (size);
-}
-
-/****************************************************************************
- ** **
- ** Name: emm_send_tracking_area_update_reject() **
- ** **
- ** Description: Builds Tracking Area Update Reject message **
- ** **
- ** The Tracking Area Update Reject message is sent by the **
- ** network to the UE to indicate that the corresponding **
- ** tracking area update has been rejected. **
- ** **
- ** Inputs: msg: The EMMAS-SAP primitive to process **
- ** Others: None **
- ** **
- ** Outputs: emm_msg: The EMM message to be sent **
- ** Return: The size of the EMM message **
- ** Others: None **
- ** **
- ***************************************************************************/
-int emm_send_tracking_area_update_reject(const emm_as_establish_t *msg,
- tracking_area_update_reject_msg *emm_msg)
-{
- LOG_FUNC_IN;
-
- int size = EMM_HEADER_MAXIMUM_LENGTH;
-
- LOG_TRACE(INFO, "EMMAS-SAP - Send Tracking Area Update Reject message (cause=%d)",
- msg->emm_cause);
-
- /* Mandatory - Message type */
- emm_msg->messagetype = TRACKING_AREA_UPDATE_REJECT;
-
- /* Mandatory - EMM cause */
- size += EMM_CAUSE_MAXIMUM_LENGTH;
- emm_msg->emmcause = msg->emm_cause;
-
- LOG_FUNC_RETURN (size);
-}
-
-/****************************************************************************
- ** **
- ** Name: emm_send_identity_request() **
- ** **
- ** Description: Builds Identity Request message **
- ** **
- ** The Identity Request message is sent by the network to **
- ** the UE to request the UE to provide the specified identi- **
- ** ty. **
- ** **
- ** Inputs: msg: The EMMAS-SAP primitive to process **
- ** Others: None **
- ** **
- ** Outputs: emm_msg: The EMM message to be sent **
- ** Return: The size of the EMM message **
- ** Others: None **
- ** **
- ***************************************************************************/
-int emm_send_identity_request(const emm_as_security_t *msg,
- identity_request_msg *emm_msg)
-{
- LOG_FUNC_IN;
-
- int size = EMM_HEADER_MAXIMUM_LENGTH;
-
- LOG_TRACE(INFO, "EMMAS-SAP - Send Identity Request message");
-
- /* Mandatory - Message type */
- emm_msg->messagetype = IDENTITY_REQUEST;
-
- /* Mandatory - Identity type 2 */
- size += IDENTITY_TYPE_2_MAXIMUM_LENGTH;
-
- if (msg->identType == EMM_IDENT_TYPE_IMSI) {
- emm_msg->identitytype = IDENTITY_TYPE_2_IMSI;
- } else if (msg->identType == EMM_IDENT_TYPE_TMSI) {
- emm_msg->identitytype = IDENTITY_TYPE_2_TMSI;
- } else if (msg->identType == EMM_IDENT_TYPE_IMEI) {
- emm_msg->identitytype = IDENTITY_TYPE_2_IMEI;
- } else {
- /* All other values are interpreted as "IMSI" */
- emm_msg->identitytype = IDENTITY_TYPE_2_IMSI;
- }
-
- LOG_FUNC_RETURN (size);
-}
-
-/****************************************************************************
- ** **
- ** Name: emm_send_authentication_request() **
- ** **
- ** Description: Builds Authentication Request message **
- ** **
- ** The Authentication Request message is sent by the network **
- ** to the UE to initiate authentication of the UE identity. **
- ** **
- ** Inputs: msg: The EMMAS-SAP primitive to process **
- ** Others: None **
- ** **
- ** Outputs: emm_msg: The EMM message to be sent **
- ** Return: The size of the EMM message **
- ** Others: None **
- ** **
- ***************************************************************************/
-int emm_send_authentication_request(const emm_as_security_t *msg,
- authentication_request_msg *emm_msg)
-{
- LOG_FUNC_IN;
-
- int size = EMM_HEADER_MAXIMUM_LENGTH;
-
- LOG_TRACE(INFO, "EMMAS-SAP - Send Authentication Request message");
-
- /* Mandatory - Message type */
- emm_msg->messagetype = AUTHENTICATION_REQUEST;
-
- /* Mandatory - NAS key set identifier */
- size += NAS_KEY_SET_IDENTIFIER_MAXIMUM_LENGTH;
- emm_msg->naskeysetidentifierasme.tsc = NAS_KEY_SET_IDENTIFIER_NATIVE;
- emm_msg->naskeysetidentifierasme.naskeysetidentifier = msg->ksi;
-
- /* Mandatory - Authentication parameter RAND */
- size += AUTHENTICATION_PARAMETER_RAND_MAXIMUM_LENGTH;
- emm_msg->authenticationparameterrand.rand = *msg->rand;
-
- /* Mandatory - Authentication parameter AUTN */
- size += AUTHENTICATION_PARAMETER_AUTN_MAXIMUM_LENGTH;
- emm_msg->authenticationparameterautn.autn = *msg->autn;
-
- LOG_FUNC_RETURN (size);
-}
-
-/****************************************************************************
- ** **
- ** Name: emm_send_authentication_reject() **
- ** **
- ** Description: Builds Authentication Reject message **
- ** **
- ** The Authentication Reject message is sent by the network **
- ** to the UE to indicate that the authentication procedure **
- ** has failed and that the UE shall abort all activities. **
- ** **
- ** Inputs: None **
- ** Others: None **
- ** **
- ** Outputs: emm_msg: The EMM message to be sent **
- ** Return: The size of the EMM message **
- ** Others: None **
- ** **
- ***************************************************************************/
-int emm_send_authentication_reject(authentication_reject_msg *emm_msg)
-{
- LOG_FUNC_IN;
-
- int size = EMM_HEADER_MAXIMUM_LENGTH;
-
- LOG_TRACE(INFO, "EMMAS-SAP - Send Authentication Reject message");
-
- /* Mandatory - Message type */
- emm_msg->messagetype = AUTHENTICATION_REJECT;
-
- LOG_FUNC_RETURN (size);
-}
-
-/****************************************************************************
- ** **
- ** Name: emm_send_security_mode_command() **
- ** **
- ** Description: Builds Security Mode Command message **
- ** **
- ** The Security Mode Command message is sent by the network **
- ** to the UE to establish NAS signalling security. **
- ** **
- ** Inputs: msg: The EMMAS-SAP primitive to process **
- ** Others: None **
- ** **
- ** Outputs: emm_msg: The EMM message to be sent **
- ** Return: The size of the EMM message **
- ** Others: None **
- ** **
- ***************************************************************************/
-int emm_send_security_mode_command(const emm_as_security_t *msg,
- security_mode_command_msg *emm_msg)
-{
- LOG_FUNC_IN;
-
- int size = EMM_HEADER_MAXIMUM_LENGTH;
-
- LOG_TRACE(INFO, "EMMAS-SAP - Send Security Mode Command message");
-
- /* Mandatory - Message type */
- emm_msg->messagetype = SECURITY_MODE_COMMAND;
-
- /* Selected NAS security algorithms */
- size += NAS_SECURITY_ALGORITHMS_MAXIMUM_LENGTH;
- emm_msg->selectednassecurityalgorithms.typeofcipheringalgorithm =
- msg->selected_eea;
- emm_msg->selectednassecurityalgorithms.typeofintegrityalgorithm =
- msg->selected_eia;
-
- /* NAS key set identifier */
- size += NAS_KEY_SET_IDENTIFIER_MAXIMUM_LENGTH;
- emm_msg->naskeysetidentifier.tsc = NAS_KEY_SET_IDENTIFIER_NATIVE;
- emm_msg->naskeysetidentifier.naskeysetidentifier = msg->ksi;
-
- /* Replayed UE security capabilities */
- size += UE_SECURITY_CAPABILITY_MAXIMUM_LENGTH;
- emm_msg->replayeduesecuritycapabilities.eea = msg->eea;
- emm_msg->replayeduesecuritycapabilities.eia = msg->eia;
- emm_msg->replayeduesecuritycapabilities.umts_present = msg->umts_present;
- emm_msg->replayeduesecuritycapabilities.gprs_present = msg->gprs_present;
-
- emm_msg->replayeduesecuritycapabilities.uea = msg->uea;
- emm_msg->replayeduesecuritycapabilities.uia = msg->uia;
- emm_msg->replayeduesecuritycapabilities.gea = msg->gea;
-
- LOG_FUNC_RETURN (size);
-}
-
-#endif // NAS_MME
/****************************************************************************/
/********************* L O C A L F U N C T I O N S *********************/
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_send.h b/openair-cn/NAS/UE/EMM/SAP/emm_send.h
old mode 100644
new mode 100755
similarity index 78%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_send.h
rename to openair-cn/NAS/UE/EMM/SAP/emm_send.h
index 72791b028e..ea90bd1775
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_send.h
+++ b/openair-cn/NAS/UE/EMM/SAP/emm_send.h
@@ -53,7 +53,6 @@ Description Defines functions executed at the EMMAS Service Access
#include "DetachRequest.h"
#include "DetachAccept.h"
-#ifdef NAS_UE
#include "AttachRequest.h"
#include "AttachComplete.h"
#include "TrackingAreaUpdateRequest.h"
@@ -67,23 +66,7 @@ Description Defines functions executed at the EMMAS Service Access
#include "NASSecurityModeComplete.h"
#include "SecurityModeReject.h"
#include "UplinkNasTransport.h"
-#endif
-#ifdef NAS_MME
-#include "AttachAccept.h"
-#include "AttachReject.h"
-#include "TrackingAreaUpdateAccept.h"
-#include "TrackingAreaUpdateReject.h"
-#include "ServiceReject.h"
-#include "GutiReallocationCommand.h"
-#include "AuthenticationRequest.h"
-#include "AuthenticationReject.h"
-#include "IdentityRequest.h"
-#include "NASSecurityModeCommand.h"
-#include "EmmInformation.h"
-#include "DownlinkNasTransport.h"
-#include "CsServiceNotification.h"
-#endif
#include "emm_asDef.h"
@@ -117,7 +100,6 @@ int emm_send_detach_accept(const emm_as_data_t *, detach_accept_msg *);
* Functions executed by the UE to send EMM messages to the network
* --------------------------------------------------------------------------
*/
-#ifdef NAS_UE
int emm_send_attach_request(const emm_as_establish_t *, attach_request_msg *);
int emm_send_attach_complete(const emm_as_data_t *, attach_complete_msg *);
@@ -145,26 +127,6 @@ int emm_send_security_mode_complete(const emm_as_security_t *,
security_mode_complete_msg *);
int emm_send_security_mode_reject(const emm_as_security_t *,
security_mode_reject_msg *);
-#endif
-/*
- * --------------------------------------------------------------------------
- * Functions executed by the MME to send EMM messages to the UE
- * --------------------------------------------------------------------------
- */
-#ifdef NAS_MME
-int emm_send_attach_accept(const emm_as_establish_t *, attach_accept_msg *);
-int emm_send_attach_reject(const emm_as_establish_t *, attach_reject_msg *);
-
-int emm_send_tracking_area_update_reject(const emm_as_establish_t *msg,
- tracking_area_update_reject_msg *emm_msg);
-
-int emm_send_identity_request(const emm_as_security_t *, identity_request_msg *);
-int emm_send_authentication_request(const emm_as_security_t *,
- authentication_request_msg *);
-int emm_send_authentication_reject(authentication_reject_msg *);
-int emm_send_security_mode_command(const emm_as_security_t *,
- security_mode_command_msg *);
-#endif
#endif /* __EMM_SEND_H__*/
diff --git a/openair-cn/NAS/UE/EMM/SecurityModeControl.c b/openair-cn/NAS/UE/EMM/SecurityModeControl.c
new file mode 100755
index 0000000000..359ce1ea2f
--- /dev/null
+++ b/openair-cn/NAS/UE/EMM/SecurityModeControl.c
@@ -0,0 +1,549 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+Source SecurityModeControl.c
+
+Version 0.1
+
+Date 2013/04/22
+
+Product NAS stack
+
+Subsystem Template body file
+
+Author Frederic Maurel
+
+Description Defines the security mode control EMM procedure executed by the
+ Non-Access Stratum.
+
+ The purpose of the NAS security mode control procedure is to
+ take an EPS security context into use, and initialise and start
+ NAS signalling security between the UE and the MME with the
+ corresponding EPS NAS keys and EPS security algorithms.
+
+ Furthermore, the network may also initiate a SECURITY MODE COM-
+ MAND in order to change the NAS security algorithms for a cur-
+ rent EPS security context already in use.
+
+*****************************************************************************/
+
+#include // malloc, free
+#include // memcpy
+#include
+
+#include "emm_proc.h"
+#include "nas_log.h"
+#include "nas_timer.h"
+
+#include "emmData.h"
+
+#include "emm_sap.h"
+#include "emm_cause.h"
+
+#include "UeSecurityCapability.h"
+
+# include "assertions.h"
+#include "secu_defs.h"
+#include "msc.h"
+
+/****************************************************************************/
+/**************** E X T E R N A L D E F I N I T I O N S ****************/
+/****************************************************************************/
+
+/****************************************************************************/
+/******************* L O C A L D E F I N I T I O N S *******************/
+/****************************************************************************/
+
+/*
+ * --------------------------------------------------------------------------
+ * Internal data handled by the security mode control procedure in the UE
+ * --------------------------------------------------------------------------
+ */
+static int _security_kdf(const OctetString *kasme, OctetString *key,
+ uint8_t algo_dist, uint8_t algo_id);
+
+static int _security_knas_enc(const OctetString *kasme, OctetString *knas_enc,
+ uint8_t eia);
+static int _security_knas_int(const OctetString *kasme, OctetString *knas_int,
+ uint8_t eea);
+static int _security_kenb(const OctetString *kasme, OctetString *kenb,
+ uint32_t count);
+
+/*
+ * Internal data used for security mode control procedure
+ */
+static struct {
+ OctetString kenb; /* eNodeB security key */
+} _security_data;
+
+static void _security_release(emm_security_context_t *ctx);
+
+/*
+ * --------------------------------------------------------------------------
+ * Internal data handled by the security mode control procedure in the MME
+ * --------------------------------------------------------------------------
+ */
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+/*
+ * --------------------------------------------------------------------------
+ * Security mode control procedure executed by the UE
+ * --------------------------------------------------------------------------
+ */
+/****************************************************************************
+ ** **
+ ** Name: emm_proc_security_mode_command() **
+ ** **
+ ** Description: Performs the MME requested security mode control proce- **
+ ** dure. **
+ ** **
+ ** 3GPP TS 24.301, section 5.4.3.3 **
+ ** Upon receiving the SECURITY MODE COMMAND message, the UE **
+ ** shall check whether the message can be accepted or not. **
+ ** If accepted the UE shall send a SECURITY MODE COMPLETE **
+ ** message integrity protected with the selected NAS inte- **
+ ** grity algorithm and ciphered with the selected NAS ciphe- **
+ ** ring algorithm. **
+ ** **
+ ** Inputs: native_ksi: TRUE if the security context is of type **
+ ** native (for KSIASME) **
+ ** ksi: The NAS ket sey identifier **
+ ** seea: Selected EPS cyphering algorithm **
+ ** seia: Selected EPS integrity algorithm **
+ ** reea: Replayed EPS cyphering algorithm **
+ ** reia: Replayed EPS integrity algorithm **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int emm_proc_security_mode_command(int native_ksi, int ksi,
+ int seea, int seia, int reea, int reia)
+{
+ LOG_FUNC_IN;
+
+ int rc = RETURNerror;
+ int emm_cause = EMM_CAUSE_SUCCESS;
+ int security_context_is_new = FALSE;
+
+ LOG_TRACE(INFO, "EMM-PROC - Security mode control requested (ksi=%d)",
+ ksi);
+
+ /* Delete any previously stored RAND and RES and stop timer T3416 */
+ (void) emm_proc_authentication_delete();
+
+ /*
+ * Check the replayed UE security capabilities
+ */
+ uint8_t eea = (0x80 >> _emm_data.security->capability.eps_encryption);
+ uint8_t eia = (0x80 >> _emm_data.security->capability.eps_integrity);
+
+ if ( (reea != eea) || (reia != eia) ) {
+ LOG_TRACE(WARNING, "EMM-PROC - Replayed UE security capabilities "
+ "rejected");
+ emm_cause = EMM_CAUSE_UE_SECURITY_MISMATCH;
+
+ /* XXX - For testing purpose UE always accepts EIA0
+ * The UE shall accept "null integrity protection algorithm" EIA0 only
+ * if a PDN connection for emergency bearer services is established or
+ * the UE is establishing a PDN connection for emergency bearer services
+ */
+ }
+ /*
+ * Check the non-current EPS security context
+ */
+ else if (_emm_data.non_current == NULL) {
+ LOG_TRACE(WARNING, "EMM-PROC - Non-current EPS security context "
+ "is not valid");
+ emm_cause = EMM_CAUSE_SECURITY_MODE_REJECTED;
+ }
+ /*
+ * Update the non-current EPS security context
+ */
+ else {
+ LOG_TRACE(INFO, "EMM-PROC - Update the non-current EPS security context seea=%u seia=%u", seea, seia);
+ /* Update selected cyphering and integrity algorithms */
+ //LG COMENTED _emm_data.non_current->capability.encryption = seea;
+ //LG COMENTED _emm_data.non_current->capability.integrity = seia;
+
+ _emm_data.non_current->selected_algorithms.encryption = seea;
+ _emm_data.non_current->selected_algorithms.integrity = seia;
+
+ /* Derive the NAS cyphering key */
+ if (_emm_data.non_current->knas_enc.value == NULL) {
+ _emm_data.non_current->knas_enc.value =
+ (uint8_t *)calloc(1,AUTH_KNAS_ENC_SIZE);
+ _emm_data.non_current->knas_enc.length = AUTH_KNAS_ENC_SIZE;
+ }
+
+ if (_emm_data.non_current->knas_enc.value != NULL) {
+ LOG_TRACE(INFO, "EMM-PROC - Update the non-current EPS security context knas_enc");
+ rc = _security_knas_enc(&_emm_data.non_current->kasme,
+ &_emm_data.non_current->knas_enc, seea);
+ }
+
+ /* Derive the NAS integrity key */
+ if (_emm_data.non_current->knas_int.value == NULL) {
+ _emm_data.non_current->knas_int.value =
+ (uint8_t *)calloc(1,AUTH_KNAS_INT_SIZE);
+ _emm_data.non_current->knas_int.length = AUTH_KNAS_INT_SIZE;
+ }
+
+ if (_emm_data.non_current->knas_int.value != NULL) {
+ if (rc != RETURNerror) {
+ LOG_TRACE(INFO, "EMM-PROC - Update the non-current EPS security context knas_int");
+ rc = _security_knas_int(&_emm_data.non_current->kasme,
+ &_emm_data.non_current->knas_int, seia);
+ }
+ }
+
+ /* Derive the eNodeB key */
+ if (_security_data.kenb.value == NULL) {
+ _security_data.kenb.value = (uint8_t *)calloc(1,AUTH_KENB_SIZE);
+ _security_data.kenb.length = AUTH_KENB_SIZE;
+ }
+
+ if (_security_data.kenb.value != NULL) {
+ if (rc != RETURNerror) {
+ LOG_TRACE(INFO, "EMM-PROC - Update the non-current EPS security context kenb");
+ // LG COMMENT rc = _security_kenb(&_emm_data.security->kasme,
+ rc = _security_kenb(&_emm_data.non_current->kasme,
+ &_security_data.kenb,
+ *(uint32_t *)(&_emm_data.non_current->ul_count));
+ }
+ }
+
+ /*
+ * NAS security mode command accepted by the UE
+ */
+ if (rc != RETURNerror) {
+ LOG_TRACE(INFO, "EMM-PROC - NAS security mode command accepted by the UE");
+
+ /* Update the current EPS security context */
+ if ( native_ksi && (_emm_data.security->type != EMM_KSI_NATIVE) ) {
+ /* The type of security context flag included in the SECURITY
+ * MODE COMMAND message is set to "native security context" and
+ * the UE has a mapped EPS security context as the current EPS
+ * security context */
+ if ( (_emm_data.non_current->type == EMM_KSI_NATIVE) &&
+ (_emm_data.non_current->eksi == ksi) ) {
+ /* The KSI matches the non-current native EPS security
+ * context; the UE shall take the non-current native EPS
+ * security context into use which then becomes the
+ * current native EPS security context and delete the
+ * mapped EPS security context */
+ LOG_TRACE(INFO,
+ "EMM-PROC - Update Current security context");
+ /* Release non-current security context */
+ _security_release(_emm_data.security);
+ _emm_data.security = _emm_data.non_current;
+ /* Reset the uplink NAS COUNT counter */
+ _emm_data.security->ul_count.overflow = 0;
+ _emm_data.security->ul_count.seq_num = 0;
+ /* Set new security context indicator */
+ security_context_is_new = TRUE;
+ }
+ }
+
+ if ( !native_ksi && (_emm_data.security->type != EMM_KSI_NATIVE) ) {
+ /* The type of security context flag included in the SECURITY
+ * MODE COMMAND message is set to "mapped security context" and
+ * the UE has a mapped EPS security context as the current EPS
+ * security context */
+ if (ksi != _emm_data.security->eksi) {
+ /* The KSI does not match the current EPS security context;
+ * the UE shall reset the uplink NAS COUNT counter */
+ LOG_TRACE(INFO,
+ "EMM-PROC - Reset uplink NAS COUNT counter");
+ _emm_data.security->ul_count.overflow = 0;
+ _emm_data.security->ul_count.seq_num = 0;
+ }
+ }
+
+ _emm_data.security->selected_algorithms.encryption = seea;
+ _emm_data.security->selected_algorithms.integrity = seia;
+
+ }
+ /*
+ * NAS security mode command not accepted by the UE
+ */
+ else {
+ /* Setup EMM cause code */
+ emm_cause = EMM_CAUSE_SECURITY_MODE_REJECTED;
+
+ /* Release security mode control internal data */
+ if (_security_data.kenb.value) {
+ free(_security_data.kenb.value);
+ _security_data.kenb.value = NULL;
+ _security_data.kenb.length = 0;
+ }
+ }
+ }
+
+ /* Setup EMM procedure handler to be executed upon receiving
+ * lower layer notification */
+ rc = emm_proc_lowerlayer_initialize(NULL, NULL, NULL, NULL);
+
+ if (rc != RETURNok) {
+ LOG_TRACE(WARNING,
+ "EMM-PROC - Failed to initialize EMM procedure handler");
+ LOG_FUNC_RETURN (RETURNerror);
+ }
+
+ /*
+ * Notify EMM-AS SAP that Security Mode response message has to be sent
+ * to the network
+ */
+ emm_sap_t emm_sap;
+ emm_sap.primitive = EMMAS_SECURITY_RES;
+ emm_sap.u.emm_as.u.security.guti = _emm_data.guti;
+ emm_sap.u.emm_as.u.security.ueid = 0;
+ emm_sap.u.emm_as.u.security.msgType = EMM_AS_MSG_TYPE_SMC;
+ emm_sap.u.emm_as.u.security.emm_cause = emm_cause;
+ /* Setup EPS NAS security data */
+ emm_as_set_security_data(&emm_sap.u.emm_as.u.security.sctx,
+ _emm_data.security, security_context_is_new, TRUE);
+ rc = emm_sap_send(&emm_sap);
+
+ LOG_FUNC_RETURN (rc);
+}
+
+
+/****************************************************************************/
+/********************* L O C A L F U N C T I O N S *********************/
+/****************************************************************************/
+
+/*
+ * --------------------------------------------------------------------------
+ * UE specific local functions
+ * --------------------------------------------------------------------------
+ */
+
+/****************************************************************************
+ ** **
+ ** Name: _security_release() **
+ ** **
+ ** Description: Releases the given EPS NAS security context **
+ ** **
+ ** Inputs: ctx: The EPS NAS security context to release **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: None **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+static void _security_release(emm_security_context_t *ctx)
+{
+ LOG_FUNC_IN;
+
+ if (ctx) {
+ /* Release Kasme security key */
+ if (ctx->kasme.value) {
+ free(ctx->kasme.value);
+ ctx->kasme.value = NULL;
+ ctx->kasme.length = 0;
+ }
+
+ /* Release NAS cyphering key */
+ if (ctx->knas_enc.value) {
+ free(ctx->knas_enc.value);
+ ctx->knas_enc.value = NULL;
+ ctx->knas_enc.length = 0;
+ }
+
+ /* Release NAS integrity key */
+ if (ctx->knas_int.value) {
+ free(ctx->knas_int.value);
+ ctx->knas_int.value = NULL;
+ ctx->knas_int.length = 0;
+ }
+
+ /* Release the NAS security context */
+ free(ctx);
+ }
+
+ LOG_FUNC_OUT;
+}
+
+/****************************************************************************
+ ** **
+ ** Name: _security_knas_enc() **
+ ** **
+ ** Description: Algorithm Key generation function used for the derivation **
+ ** of NAS encryption key Knas-enc from the Kasme. **
+ ** **
+ ** 3GPP TS 33.401, Annex A.7 **
+ ** **
+ ** Inputs: kasme: Key Access Security Management Entity **
+ ** eea: Cyphering algorithm identity **
+ ** Others: None **
+ ** **
+ ** Outputs: knas_enc: Derived key for NAS cyphering algorithm **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+static int _security_knas_enc(const OctetString *kasme, OctetString *knas_enc,
+ uint8_t eea)
+{
+ LOG_FUNC_IN;
+ LOG_TRACE(INFO, "%s with algo dist %d algo id %d", __FUNCTION__,0x01, eea);
+ LOG_FUNC_RETURN (_security_kdf(kasme, knas_enc, 0x01, eea));
+}
+
+/****************************************************************************
+ ** **
+ ** Name: _security_knas_int() **
+ ** **
+ ** Description: Algorithm Key generation function used for the derivation **
+ ** of NAS integrity key Knas-int from the Kasme. **
+ ** **
+ ** 3GPP TS 33.401, Annex A.7 **
+ ** **
+ ** Inputs: kasme: Key Access Security Management Entity **
+ ** eia: Integrity algorithm identity **
+ ** Others: None **
+ ** **
+ ** Outputs: knas_int: Derived key for NAS integrity algorithm **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+static int _security_knas_int(const OctetString *kasme, OctetString *knas_int,
+ uint8_t eia)
+{
+ LOG_FUNC_IN;
+ LOG_TRACE(INFO, "%s with algo dist %d algo id %d", __FUNCTION__,0x02, eia);
+ LOG_FUNC_RETURN (_security_kdf(kasme, knas_int, 0x02, eia));
+}
+
+/****************************************************************************
+ ** **
+ ** Name: _security_kenb() **
+ ** **
+ ** Description: Computes the eNodeB key from Kasme and the given value of **
+ ** uplink NAS counter. **
+ ** **
+ ** 3GPP TS 33.401, Annex A.3 **
+ ** **
+ ** Inputs: kasme: Key Access Security Management Entity **
+ ** count: Uplink NAS counter value **
+ ** Others: None **
+ ** **
+ ** Outputs: kenb: eNodeB security key **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+static int _security_kenb(const OctetString *kasme, OctetString *kenb,
+ uint32_t count)
+{
+ /* Compute the KDF input parameter
+ * S = FC(0x11) || UL NAS Count || 0x00 0x04
+ */
+ uint8_t input[32];
+ // uint16_t length = 4;
+ // int offset = 0;
+
+ LOG_TRACE(INFO, "%s with count= %d", __FUNCTION__, count);
+ memset(input, 0, 32);
+ input[0] = 0x11;
+ // P0
+ input[1] = count >> 24;
+ input[2] = (uint8_t)(count >> 16);
+ input[3] = (uint8_t)(count >> 8);
+ input[4] = (uint8_t)count;
+ // L0
+ input[5] = 0;
+ input[6] = 4;
+
+ kdf(kasme->value, 32, input, 7, kenb->value, 32);
+ kenb->length = 32;
+ return (RETURNok);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: _security_kdf() **
+ ** **
+ ** Description: Algorithm Key generation function used for the derivation **
+ ** of keys for NAS integrity and NAS encryption algorithms **
+ ** from Kasme, algorithm types and algorithm identities. **
+ ** **
+ ** 3GPP TS 33.401, Annex A.7 **
+ ** **
+ ** Inputs: kasme: Key Access Security Management Entity **
+ ** algo_dist: Algorithm type distinguisher **
+ ** algo_id: Algorithm identity **
+ ** Others: None **
+ ** **
+ ** Outputs: key: Derived key for NAS security protection **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+static int _security_kdf(const OctetString *kasme, OctetString *key,
+ uint8_t algo_dist, uint8_t algo_id)
+{
+ /* Compute the KDF input parameter
+ * S = FC(0x15) || Algorithm distinguisher || 0x00 0x01
+ || Algorithm identity || 0x00 0x01
+ */
+ uint8_t input[32];
+ uint8_t output[32];
+ LOG_TRACE(DEBUG, "%s:%u output key mem %p lenth %u",
+ __FUNCTION__, __LINE__,
+ key->value,
+ key->length);
+ memset(input, 0, 32);
+ // FC
+ input[0] = 0x15;
+ // P0 = Algorithm distinguisher
+ input[1] = algo_dist;
+ // L0 = 0x00 01
+ input[2] = 0x00;
+ input[3] = 0x01;
+ // P1 = Algorithm identity
+ input[4] = algo_id;
+ // L1 = length of Algorithm identity 0x00 0x01
+ input[5] = 0x00;
+ input[6] = 0x01;
+
+ /* Compute the derived key */
+ kdf(kasme->value, kasme->length, input, 7, output, 32);
+ memcpy(key->value, &output[31 - key->length + 1], key->length);
+ return (RETURNok);
+}
+
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/ServiceRequestHdl.c b/openair-cn/NAS/UE/EMM/ServiceRequestHdl.c
old mode 100644
new mode 100755
similarity index 98%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/ServiceRequestHdl.c
rename to openair-cn/NAS/UE/EMM/ServiceRequestHdl.c
index c00653823c..6f74b4fbbe
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/ServiceRequestHdl.c
+++ b/openair-cn/NAS/UE/EMM/ServiceRequestHdl.c
@@ -74,20 +74,17 @@ Description Defines the service request EMM procedure executed by the
* Internal data handled by the service request procedure in the UE
* --------------------------------------------------------------------------
*/
-#ifdef NAS_UE
/*
* Timer handlers
*/
void *_emm_service_t3417_handler(void *);
-#endif // NAS_UE
/*
* --------------------------------------------------------------------------
* Internal data handled by the service request procedure in the MME
* --------------------------------------------------------------------------
*/
-#ifdef NAS_MME
-#endif // NAS_MME
+
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
@@ -97,7 +94,6 @@ void *_emm_service_t3417_handler(void *);
/********************* L O C A L F U N C T I O N S *********************/
/****************************************************************************/
-#ifdef NAS_UE
/*
* --------------------------------------------------------------------------
* Timer handlers
@@ -132,4 +128,3 @@ void *_emm_service_t3417_handler(void *args)
LOG_FUNC_RETURN(NULL);
}
-#endif // NAS_UE
diff --git a/openair-cn/NAS/UE/EMM/TrackingAreaUpdate.c b/openair-cn/NAS/UE/EMM/TrackingAreaUpdate.c
new file mode 100755
index 0000000000..fbec3f7060
--- /dev/null
+++ b/openair-cn/NAS/UE/EMM/TrackingAreaUpdate.c
@@ -0,0 +1,132 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+Source TrackingAreaUpdate.c
+
+Version 0.1
+
+Date 2013/05/07
+
+Product NAS stack
+
+Subsystem EPS Mobility Management
+
+Author Frederic Maurel
+
+Description Defines the tracking area update EMM procedure executed by the
+ Non-Access Stratum.
+
+ The tracking area updating procedure is always initiated by the
+ UE and is used to update the registration of the actual tracking
+ area of a UE in the network, to periodically notify the availa-
+ bility of the UE to the network, for MME load balancing, to up-
+ date certain UE specific parameters in the network.
+
+*****************************************************************************/
+
+#include "emm_proc.h"
+#include "nas_log.h"
+#include "nas_timer.h"
+
+#include "emmData.h"
+
+#include "emm_sap.h"
+#include "emm_cause.h"
+
+#include // memcmp, memcpy
+
+/****************************************************************************/
+/**************** E X T E R N A L D E F I N I T I O N S ****************/
+/****************************************************************************/
+
+/****************************************************************************/
+/******************* L O C A L D E F I N I T I O N S *******************/
+/****************************************************************************/
+
+/*
+ * --------------------------------------------------------------------------
+ * Internal data handled by the tracking area update procedure in the UE
+ * --------------------------------------------------------------------------
+ */
+/*
+ * Timer handlers
+ */
+void *_emm_tau_t3430_handler(void *);
+
+/*
+ * --------------------------------------------------------------------------
+ * Internal data handled by the tracking area update procedure in the MME
+ * --------------------------------------------------------------------------
+ */
+
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+
+/****************************************************************************/
+/********************* L O C A L F U N C T I O N S *********************/
+/****************************************************************************/
+
+/*
+ * --------------------------------------------------------------------------
+ * Timer handlers
+ * --------------------------------------------------------------------------
+ */
+
+/****************************************************************************
+ ** **
+ ** Name: _emm_tau_t3430_handler() **
+ ** **
+ ** Description: T3430 timeout handler **
+ ** **
+ ** 3GPP TS 24.301, section 5.5.3.2.6 case c **
+ ** **
+ ** Inputs: args: handler parameters **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: None **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+void *_emm_tau_t3430_handler(void *args)
+{
+ LOG_FUNC_IN;
+
+ LOG_TRACE(WARNING, "EMM-PROC - T3430 timer expired");
+
+ /* Stop timer T3430 */
+ T3430.id = nas_timer_stop(T3430.id);
+
+ LOG_FUNC_RETURN(NULL);
+}
+
+
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/emmData.h b/openair-cn/NAS/UE/EMM/emmData.h
old mode 100644
new mode 100755
similarity index 69%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/emmData.h
rename to openair-cn/NAS/UE/EMM/emmData.h
index f1eb78d517..7a81600871
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/emmData.h
+++ b/openair-cn/NAS/UE/EMM/emmData.h
@@ -55,19 +55,12 @@ Description Defines internal private data handled by EPS Mobility
#include "esmData.h"
-#ifdef NAS_MME
-#include "emm_fsm.h"
-#include "mme_api.h"
-# if defined(NAS_BUILT_IN_EPC)
-# include "tree.h"
-# endif
-#endif
+
/****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/
/****************************************************************************/
-#ifdef NAS_UE
/*
* The name of the file used as non-volatile memory device to store
* persistent EMM data when the UE is switched off
@@ -84,7 +77,6 @@ Description Defines internal private data handled by EPS Mobility
#define EMM_DATA_PLMN_AUTO NET_PLMN_AUTO
#define EMM_DATA_PLMN_MANUAL NET_PLMN_MANUAL
-#endif // NAS_UE
/* Checks Mobile Country Code equality */
#define MCCS_ARE_EQUAL(n1, n2) (((n1).MCCdigit1 == (n2).MCCdigit1) && \
@@ -130,22 +122,22 @@ typedef struct emm_security_context_s {
OctetString knas_enc; /* NAS cyphering key */
OctetString knas_int; /* NAS integrity key */
struct count_s{
- UInt32_t spare:8;
- UInt32_t overflow:16;
- UInt32_t seq_num:8;
+ uint32_t spare:8;
+ uint32_t overflow:16;
+ uint32_t seq_num:8;
} dl_count, ul_count; /* Downlink and uplink count parameters */
struct {
- UInt8_t eps_encryption; /* algorithm used for ciphering */
- UInt8_t eps_integrity; /* algorithm used for integrity protection */
- UInt8_t umts_encryption; /* algorithm used for ciphering */
- UInt8_t umts_integrity; /* algorithm used for integrity protection */
- UInt8_t gprs_encryption; /* algorithm used for ciphering */
- UInt8_t umts_present:1;
- UInt8_t gprs_present:1;
+ uint8_t eps_encryption; /* algorithm used for ciphering */
+ uint8_t eps_integrity; /* algorithm used for integrity protection */
+ uint8_t umts_encryption; /* algorithm used for ciphering */
+ uint8_t umts_integrity; /* algorithm used for integrity protection */
+ uint8_t gprs_encryption; /* algorithm used for ciphering */
+ uint8_t umts_present:1;
+ uint8_t gprs_present:1;
} capability; /* UE network capability */
struct {
- UInt8_t encryption:4; /* algorithm used for ciphering */
- UInt8_t integrity:4; /* algorithm used for integrity protection */
+ uint8_t encryption:4; /* algorithm used for ciphering */
+ uint8_t integrity:4; /* algorithm used for integrity protection */
} selected_algorithms; /* MME selected algorithms */
} emm_security_context_t;
@@ -154,7 +146,6 @@ typedef struct emm_security_context_s {
* EMM internal data handled by EPS Mobility Management sublayer in the UE
* --------------------------------------------------------------------------
*/
-#ifdef NAS_UE
/*
* EPS update status
* -----------------
@@ -284,14 +275,14 @@ typedef struct emm_data_s {
/* List of user controlled PLMNs */
#define EMM_DATA_PLMN_MAX 4
PLMN_LIST_T(EMM_DATA_PLMN_MAX) plmn;
- UInt16_t userAcT[EMM_DATA_PLMN_MAX];
+ uint16_t userAcT[EMM_DATA_PLMN_MAX];
/* List of operator controlled PLMNs */
#define EMM_DATA_OPLMN_MAX 4
PLMN_LIST_T(EMM_DATA_OPLMN_MAX) oplmn;
- UInt16_t operAcT[EMM_DATA_OPLMN_MAX];
+ uint16_t operAcT[EMM_DATA_OPLMN_MAX];
/* List of operator network name records */
#define EMM_DATA_OPNN_MAX 16
- UInt8_t n_opnns;
+ uint8_t n_opnns;
struct {
const plmn_t *plmn;
const char *fullname;
@@ -343,93 +334,7 @@ typedef struct emm_data_s {
} emm_data_t;
-#endif // NAS_UE
-/*
- * --------------------------------------------------------------------------
- * EMM internal data handled by EPS Mobility Management sublayer in the MME
- * --------------------------------------------------------------------------
- */
-#ifdef NAS_MME
-/*
- * Structure of the EMM context established by the network for a particular UE
- * ---------------------------------------------------------------------------
- */
-typedef struct emm_data_context_s {
-#if defined(NAS_BUILT_IN_EPC)
- RB_ENTRY(emm_data_context_s) entries;
-#endif
-
- unsigned int ueid; /* UE identifier */
- int is_dynamic; /* Dynamically allocated context indicator */
- int is_attached; /* Attachment indicator */
- int is_emergency;/* Emergency bearer services indicator */
-
- imsi_t *imsi; /* The IMSI provided by the UE or the MME */
- imei_t *imei; /* The IMEI provided by the UE */
- int guti_is_new; /* New GUTI indicator */
- GUTI_t *guti; /* The GUTI assigned to the UE */
- GUTI_t *old_guti; /* The old GUTI */
- int n_tacs; /* Number of consecutive tracking areas the UE is
- * registered to */
- tac_t tac; /* Code of the first tracking area the UE is
- * registered to */
-
- int ksi; /* Security key set identifier provided by the UE */
- int eea; /* EPS encryption algorithms supported by the UE */
- int eia; /* EPS integrity algorithms supported by the UE */
- int ucs2; /* UCS2 Alphabet*/
- int uea; /* UMTS encryption algorithms supported by the UE */
- int uia; /* UMTS integrity algorithms supported by the UE */
- int gea; /* GPRS encryption algorithms supported by the UE */
- int umts_present; /* For encoding ue network capabilities (variable size)*/
- int gprs_present; /* For encoding ue network capabilities (variable size)*/
-
- auth_vector_t vector;/* EPS authentication vector */
- emm_security_context_t *security; /* Current EPS NAS security context */
- OctetString esm_msg; /* ESM message contained within the initial request*/
- int emm_cause; /* EMM failure cause code */
-
- emm_fsm_state_t _emm_fsm_status;
-
- esm_data_context_t esm_data_ctx;
-} emm_data_context_t;
-
-/*
- * Structure of the EMM data
- * -------------------------
- */
-typedef struct {
- /*
- * MME configuration
- * -----------------
- */
- mme_api_emm_config_t conf;
- /*
- * EMM contexts
- * ------------
- */
-# if defined(NAS_BUILT_IN_EPC)
- /* Use a tree for ue data context within MME */
- RB_HEAD(emm_data_context_map, emm_data_context_s) ctx_map;
-# else
-# define EMM_DATA_NB_UE_MAX (MME_API_NB_UE_MAX + 1)
- emm_data_context_t *ctx [EMM_DATA_NB_UE_MAX];
-# endif
-} emm_data_t;
-
-struct emm_data_context_s *emm_data_context_get(
- emm_data_t *_emm_data, unsigned int _ueid);
-
-struct emm_data_context_s *emm_data_context_remove(
- emm_data_t *_emm_data, struct emm_data_context_s *elm);
-
-void emm_data_context_add(emm_data_t *emm_data, struct emm_data_context_s *elm);
-void emm_data_context_dump(struct emm_data_context_s *elm_pP);
-
-void emm_data_context_dump_all(void);
-
-#endif // NAS_MME
/****************************************************************************/
/******************** G L O B A L V A R I A B L E S ********************/
@@ -447,7 +352,6 @@ emm_data_t _emm_data;
* EPS mobility management timers – UE side
* --------------------------------------------------------------------------
*/
-#ifdef NAS_UE
#define T3402_DEFAULT_VALUE 720 /* 12 minutes */
#define T3410_DEFAULT_VALUE 15 /* 15 seconds */
#define T3411_DEFAULT_VALUE 10 /* 10 seconds */
@@ -474,56 +378,6 @@ struct nas_timer_t T3421; /* Detach timer */
struct nas_timer_t T3430; /* tracking area update timer */
struct nas_timer_t T3423; /* E-UTRAN deactivate ISR timer */
-#endif
-
-/*
- * --------------------------------------------------------------------------
- * EPS mobility management timers – Network side
- * --------------------------------------------------------------------------
- */
-#ifdef NAS_MME
-#define T3450_DEFAULT_VALUE 6 /* 6 seconds */
-#define T3460_DEFAULT_VALUE 6 /* 6 seconds */
-#define T3470_DEFAULT_VALUE 6 /* 6 seconds */
-
-struct nas_timer_t T3450; /* EMM message retransmission timer */
-struct nas_timer_t T3460; /* Authentication timer */
-struct nas_timer_t T3470; /* Identification timer */
-
-/*
- * mobile reachable timer
- * ----------------------
- * The network supervises the periodic tracking area updating procedure
- * of the UE by means of the mobile reachable timer.
- * If the UE is not attached for emergency bearer services, the mobile
- * reachable timer is 4 minutes greater than T3412.
- * If the UE is attached for emergency bearer services, the MME shall
- * set the mobile reachable timer with a value equal to T3412. When
- * the mobile reachable timer expires, the MME shall locally detach the UE.
- *
- * The mobile reachable timer shall be reset and started, when the MME
- * releases the NAS signalling connection for the UE. The mobile reachable
- * timer shall be stopped when a NAS signalling connection is established
- * for the UE.
- */
-
-/*
- * implicit detach timer
- * ---------------------
- * If ISR is activated, the default value of the implicit detach timer is
- * 4 minutes greater than T3423.
- * If the implicit detach timer expires before the UE contacts the network,
- * the network shall implicitly detach the UE.
- * If the MME includes timer T3346 in the TRACKING AREA UPDATE REJECT message
- * or the SERVICE REJECT message and T3346 is greater than T3412, the MME
- * sets the mobile reachable timer and the implicit detach timer such that
- * the sum of the timer values is greater than T3346.
- *
- * Upon expiry of the mobile reachable timer the network shall start the
- * implicit detach timer. The implicit detach timer shall be stopped when
- * a NAS signalling connection is established for the UE.
- */
-#endif
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/emm_main.c b/openair-cn/NAS/UE/EMM/emm_main.c
old mode 100644
new mode 100755
similarity index 95%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/emm_main.c
rename to openair-cn/NAS/UE/EMM/emm_main.c
index 8d91573c89..51b6b693fb
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/emm_main.c
+++ b/openair-cn/NAS/UE/EMM/emm_main.c
@@ -48,7 +48,6 @@ Description Defines the EPS Mobility Management procedure call manager,
#include "nas_log.h"
#include "emmData.h"
-#ifdef NAS_UE
#include "memory.h"
#include "usim_api.h"
#include "IdleMode.h"
@@ -56,11 +55,6 @@ Description Defines the EPS Mobility Management procedure call manager,
#include // memset, memcpy, strlen
#include // sprintf
#include // malloc, free
-#endif
-
-#if defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)
-# include "mme_config.h"
-#endif
/****************************************************************************/
/**************** E X T E R N A L D E F I N I T I O N S ****************/
@@ -70,7 +64,6 @@ Description Defines the EPS Mobility Management procedure call manager,
/******************* L O C A L D E F I N I T I O N S *******************/
/****************************************************************************/
-#ifdef NAS_UE
static int _emm_main_get_imei(imei_t *imei, const char *imei_str);
static int _emm_main_imsi_cmp(imsi_t *imsi1, imsi_t *imsi2);
@@ -91,13 +84,11 @@ static usim_data_t _usim_data;
*/
static emm_indication_callback_t _emm_main_user_callback;
static int _emm_main_callback(int);
-#endif
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
-#ifdef NAS_UE
/****************************************************************************
** **
** Name: emm_main_initialize() **
@@ -296,14 +287,14 @@ void emm_main_initialize(emm_indication_callback_t cb, const char *imei)
}
/* Downlink count parameter */
- if (_usim_data.securityctx.dlNAScount.length <= sizeof(UInt32_t)) {
+ if (_usim_data.securityctx.dlNAScount.length <= sizeof(uint32_t)) {
memcpy(&_emm_data.security->dl_count,
_usim_data.securityctx.dlNAScount.value,
_usim_data.securityctx.dlNAScount.length);
}
/* Uplink count parameter */
- if (_usim_data.securityctx.ulNAScount.length <= sizeof(UInt32_t)) {
+ if (_usim_data.securityctx.ulNAScount.length <= sizeof(uint32_t)) {
memcpy(&_emm_data.security->ul_count,
_usim_data.securityctx.ulNAScount.value,
_usim_data.securityctx.ulNAScount.length);
@@ -409,58 +400,7 @@ void emm_main_initialize(emm_indication_callback_t cb, const char *imei)
LOG_FUNC_OUT;
}
-#endif
-#ifdef NAS_MME
-/****************************************************************************
- ** **
- ** Name: emm_main_initialize() **
- ** **
- ** Description: Initializes EMM internal data **
- ** **
- ** Inputs: None **
- ** Others: None **
- ** **
- ** Outputs: None **
- ** Return: None **
- ** Others: _emm_data **
- ** **
- ***************************************************************************/
-#if defined(NAS_BUILT_IN_EPC)
-void emm_main_initialize(mme_config_t *mme_config_p)
-#else
-void emm_main_initialize(void)
-#endif
-{
- LOG_FUNC_IN;
- /* Retreive MME supported configuration data */
-#if defined(NAS_BUILT_IN_EPC)
-
- if (mme_api_get_emm_config(&_emm_data.conf, mme_config_p) != RETURNok)
-#else
- if (mme_api_get_emm_config(&_emm_data.conf) != RETURNok)
-#endif
- {
- LOG_TRACE(ERROR, "EMM-MAIN - Failed to get MME configuration data");
- }
-
-#if defined(NAS_BUILT_IN_EPC)
- RB_INIT(&_emm_data.ctx_map);
-#endif
-
- /*
- * Initialize EMM timers
- */
- T3450.id = NAS_TIMER_INACTIVE_ID;
- T3450.sec = T3450_DEFAULT_VALUE;
- T3460.id = NAS_TIMER_INACTIVE_ID;
- T3460.sec = T3460_DEFAULT_VALUE;
- T3470.id = NAS_TIMER_INACTIVE_ID;
- T3470.sec = T3470_DEFAULT_VALUE;
-
- LOG_FUNC_OUT;
-}
-#endif
/****************************************************************************
** **
@@ -480,8 +420,6 @@ void emm_main_cleanup(void)
{
LOG_FUNC_IN;
-#ifdef NAS_UE
-
if (_emm_data.usim_is_valid) {
/*
* TODO: Update USIM application data
@@ -577,13 +515,9 @@ void emm_main_cleanup(void)
free(_emm_data.security);
_emm_data.security = NULL;
}
-
-#endif // NAS_UE
-
LOG_FUNC_OUT;
}
-#ifdef NAS_UE
/****************************************************************************
** **
** Name: emm_main_get_imsi() **
@@ -934,13 +868,11 @@ int emm_main_is_emergency(void)
LOG_FUNC_IN;
LOG_FUNC_RETURN (_emm_data.is_attached && _emm_data.is_emergency);
}
-#endif // NAS_UE
/****************************************************************************/
/********************* L O C A L F U N C T I O N S *********************/
/****************************************************************************/
-#ifdef NAS_UE
/****************************************************************************
** **
** Name: _emm_main_callback() **
@@ -1144,5 +1076,4 @@ static int _emm_main_get_plmn_index(const char *plmn, int format)
return (index);
}
-#endif // NAS_UE
diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/emm_main.h b/openair-cn/NAS/UE/EMM/emm_main.h
old mode 100644
new mode 100755
similarity index 93%
rename from openair-cn/NAS/EURECOM-NAS/src/emm/emm_main.h
rename to openair-cn/NAS/UE/EMM/emm_main.h
index 09eff87635..3d3d441843
--- a/openair-cn/NAS/EURECOM-NAS/src/emm/emm_main.h
+++ b/openair-cn/NAS/UE/EMM/emm_main.h
@@ -46,10 +46,6 @@ Description Defines the EPS Mobility Management procedure call manager,
#ifndef __EMM_MAIN_H__
#define __EMM_MAIN_H__
-#if defined(NAS_BUILT_IN_EPC)
-# include "mme_config.h"
-#endif
-
#include "commonDef.h"
#include "networkDef.h"
@@ -69,19 +65,10 @@ Description Defines the EPS Mobility Management procedure call manager,
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
-#ifdef NAS_UE
void emm_main_initialize(emm_indication_callback_t cb, const char *imei);
-#endif
-#ifdef NAS_MME
-# if defined(NAS_BUILT_IN_EPC)
-void emm_main_initialize(mme_config_t *mme_config_p);
-# else
-void emm_main_initialize(void);
-# endif
-#endif
+
void emm_main_cleanup(void);
-#ifdef NAS_UE
/* User's getter of UE's identity */
const imsi_t *emm_main_get_imsi(void);
@@ -107,6 +94,5 @@ const char *emm_main_get_registered_plmn(network_plmn_t *plmn, int format);
int emm_main_is_attached(void);
int emm_main_is_emergency(void);
-#endif // NAS_UE
#endif /* __EMM_MAIN_H__*/
diff --git a/openair-cn/NAS/UE/EMM/emm_proc.h b/openair-cn/NAS/UE/EMM/emm_proc.h
new file mode 100755
index 0000000000..267a64fcef
--- /dev/null
+++ b/openair-cn/NAS/UE/EMM/emm_proc.h
@@ -0,0 +1,195 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+Source emm_proc.h
+
+Version 0.1
+
+Date 2012/10/16
+
+Product NAS stack
+
+Subsystem EPS Mobility Management
+
+Author Frederic Maurel
+
+Description Defines the EPS Mobility Management procedures executed at
+ the EMM Service Access Points.
+
+*****************************************************************************/
+#ifndef __EMM_PROC_H__
+#define __EMM_PROC_H__
+
+#include "commonDef.h"
+#include "OctetString.h"
+#include "LowerLayer.h"
+
+/****************************************************************************/
+/********************* G L O B A L C O N S T A N T S *******************/
+/****************************************************************************/
+
+/* Type of network attachment */
+typedef enum {
+ EMM_ATTACH_TYPE_EPS = 0,
+ EMM_ATTACH_TYPE_IMSI,
+ EMM_ATTACH_TYPE_EMERGENCY,
+ EMM_ATTACH_TYPE_RESERVED,
+} emm_proc_attach_type_t;
+
+/* Type of network detach */
+typedef enum {
+ EMM_DETACH_TYPE_EPS = 0,
+ EMM_DETACH_TYPE_IMSI,
+ EMM_DETACH_TYPE_EPS_IMSI,
+ EMM_DETACH_TYPE_REATTACH,
+ EMM_DETACH_TYPE_NOT_REATTACH,
+ EMM_DETACH_TYPE_RESERVED,
+} emm_proc_detach_type_t;
+
+/* Type of requested identity */
+typedef enum {
+ EMM_IDENT_TYPE_NOT_AVAILABLE = 0,
+ EMM_IDENT_TYPE_IMSI,
+ EMM_IDENT_TYPE_IMEI,
+ EMM_IDENT_TYPE_IMEISV,
+ EMM_IDENT_TYPE_TMSI
+} emm_proc_identity_type_t;
+
+/****************************************************************************/
+/************************ G L O B A L T Y P E S ************************/
+/****************************************************************************/
+
+/****************************************************************************/
+/******************** G L O B A L V A R I A B L E S ********************/
+/****************************************************************************/
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+/*
+ *---------------------------------------------------------------------------
+ * EMM status procedure
+ *---------------------------------------------------------------------------
+ */
+int emm_proc_status_ind(unsigned int ueid, int emm_cause);
+int emm_proc_status(unsigned int ueid, int emm_cause);
+
+/*
+ *---------------------------------------------------------------------------
+ * Lower layer procedure
+ *---------------------------------------------------------------------------
+ */
+int emm_proc_lowerlayer_initialize(lowerlayer_success_callback_t success,
+ lowerlayer_failure_callback_t failure,
+ lowerlayer_release_callback_t release,
+ void *args);
+int emm_proc_lowerlayer_success(void);
+int emm_proc_lowerlayer_failure(int is_initial);
+int emm_proc_lowerlayer_release(void);
+
+/*
+ *---------------------------------------------------------------------------
+ * UE's Idle mode procedure
+ *---------------------------------------------------------------------------
+ */
+int emm_proc_initialize(void);
+int emm_proc_plmn_selection(int index);
+int emm_proc_plmn_selection_end(int found, tac_t tac, ci_t ci, AcT_t rat);
+
+/*
+ * --------------------------------------------------------------------------
+ * Attach procedure
+ * --------------------------------------------------------------------------
+ */
+int emm_proc_attach(emm_proc_attach_type_t type);
+int emm_proc_attach_request(void *args);
+int emm_proc_attach_accept(long T3412, long T3402, long T3423, int n_tais,
+ tai_t *tai, GUTI_t *guti, int n_eplmns, plmn_t *eplmn,
+ const OctetString *esm_msg);
+int emm_proc_attach_reject(int emm_cause, const OctetString *esm_msg);
+int emm_proc_attach_complete(void *args);
+int emm_proc_attach_failure(int is_initial, void *args);
+int emm_proc_attach_release(void *args);
+int emm_proc_attach_restart(void);
+
+int emm_proc_attach_set_emergency(void);
+int emm_proc_attach_set_detach(void);
+
+
+
+/*
+ * --------------------------------------------------------------------------
+ * Detach procedure
+ * --------------------------------------------------------------------------
+ */
+int emm_proc_detach(emm_proc_detach_type_t type, int switch_off);
+int emm_proc_detach_request(void *args);
+int emm_proc_detach_accept(void);
+int emm_proc_detach_failure(int is_initial, void *args);
+int emm_proc_detach_release(void *args);
+
+
+/*
+ * --------------------------------------------------------------------------
+ * Identification procedure
+ * --------------------------------------------------------------------------
+ */
+int emm_proc_identification_request(emm_proc_identity_type_t type);
+
+
+/*
+ * --------------------------------------------------------------------------
+ * Authentication procedure
+ * --------------------------------------------------------------------------
+ */
+int emm_proc_authentication_request(int native_ksi, int ksi,
+ const OctetString *rand, const OctetString *autn);
+int emm_proc_authentication_reject(void);
+int emm_proc_authentication_delete(void);
+
+
+/*
+ * --------------------------------------------------------------------------
+ * Security mode control procedure
+ * --------------------------------------------------------------------------
+ */
+int emm_proc_security_mode_command(int native_ksi, int ksi, int seea, int seia,
+ int reea, int reia);
+
+/*
+ *---------------------------------------------------------------------------
+ * Network indication handlers
+ *---------------------------------------------------------------------------
+ */
+int emm_proc_registration_notify(Stat_t status);
+int emm_proc_location_notify(tac_t tac, ci_t ci, AcT_t rat);
+int emm_proc_network_notify(int index);
+
+#endif /* __EMM_PROC_H__*/
diff --git a/openair-cn/NAS/UE/ESM/DedicatedEpsBearerContextActivation.c b/openair-cn/NAS/UE/ESM/DedicatedEpsBearerContextActivation.c
new file mode 100755
index 0000000000..65fdaf4b3e
--- /dev/null
+++ b/openair-cn/NAS/UE/ESM/DedicatedEpsBearerContextActivation.c
@@ -0,0 +1,317 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+Source DedicatedEpsBearerContextActivation.c
+
+Version 0.1
+
+Date 2013/07/16
+
+Product NAS stack
+
+Subsystem EPS Session Management
+
+Author Frederic Maurel
+
+Description Defines the dedicated EPS bearer context activation ESM
+ procedure executed by the Non-Access Stratum.
+
+ The purpose of the dedicated EPS bearer context activation
+ procedure is to establish an EPS bearer context with specific
+ QoS and TFT between the UE and the EPC.
+
+ The procedure is initiated by the network, but may be requested
+ by the UE by means of the UE requested bearer resource alloca-
+ tion procedure or the UE requested bearer resource modification
+ procedure.
+ It can be part of the attach procedure or be initiated together
+ with the default EPS bearer context activation procedure when
+ the UE initiated stand-alone PDN connectivity procedure.
+
+*****************************************************************************/
+
+#include "esm_proc.h"
+#include "commonDef.h"
+#include "nas_log.h"
+
+#include "esm_cause.h"
+#include "esm_ebr.h"
+#include "esm_ebr_context.h"
+
+#include "emm_sap.h"
+
+/****************************************************************************/
+/**************** E X T E R N A L D E F I N I T I O N S ****************/
+/****************************************************************************/
+
+/****************************************************************************/
+/******************* L O C A L D E F I N I T I O N S *******************/
+/****************************************************************************/
+
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+/*
+ * --------------------------------------------------------------------------
+ * Dedicated EPS bearer context activation procedure executed by the MME
+ * --------------------------------------------------------------------------
+ */
+
+/*
+ * --------------------------------------------------------------------------
+ * Dedicated EPS bearer context activation procedure executed by the UE
+ * --------------------------------------------------------------------------
+ */
+/****************************************************************************
+ ** **
+ ** Name: esm_proc_dedicated_eps_bearer_context_request() **
+ ** **
+ ** Description: Creates local dedicated EPS bearer context upon receipt **
+ ** of the ACTIVATE DEDICATED EPS BEARER CONTEXT REQUEST **
+ ** message. **
+ ** **
+ ** Inputs: ebi: EPS bearer identity **
+ ** default_ebi: EPS bearer identity of the associated de- **
+ ** fault EPS bearer context **
+ ** esm_qos: EPS bearer level QoS parameters **
+ ** tft: Traffic flow template parameters **
+ ** Others: None **
+ ** **
+ ** Outputs: esm_cause: Cause code returned upon ESM procedure **
+ ** failure **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int esm_proc_dedicated_eps_bearer_context_request(int ebi, int default_ebi,
+ const esm_proc_qos_t *qos,
+ const esm_proc_tft_t *tft,
+ int *esm_cause)
+{
+ LOG_FUNC_IN;
+
+ int rc = RETURNerror;
+
+ LOG_TRACE(INFO, "ESM-PROC - Dedicated EPS bearer context activation "
+ "requested by the network (ebi=%d)", ebi);
+
+ /* Get the PDN connection the dedicated EPS bearer is linked to */
+ int pid = esm_ebr_context_get_pid(default_ebi);
+
+ if (pid < 0) {
+ /* 3GPP TS 24.301, section 6.4.2.5, abnormal case c
+ * No default EPS bearer context with linked EPS bearer identity
+ * activated
+ */
+ LOG_TRACE(WARNING, "ESM-PROC - Failed to get PDN connection the "
+ "dedicated EPS bearer is linked to (ebi=%d)", default_ebi);
+ *esm_cause = ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY;
+ LOG_FUNC_RETURN (RETURNerror);
+ }
+
+ /* Assign dedicated EPS bearer context */
+ int new_ebi = esm_ebr_assign(ebi, pid+1, FALSE);
+
+ if (new_ebi == ESM_EBI_UNASSIGNED) {
+ /* 3GPP TS 24.301, section 6.4.2.5, abnormal cases a and b
+ * Dedicated EPS bearer context activation request for an already
+ * activated default or dedicated EPS bearer context
+ */
+ int old_pid, old_bid;
+ /* Locally deactivate the existing EPS bearer context and proceed
+ * with the requested dedicated EPS bearer context activation */
+ rc = esm_proc_eps_bearer_context_deactivate(TRUE, ebi,
+ &old_pid, &old_bid);
+
+ if (rc != RETURNok) {
+ /* Failed to release EPS bearer context */
+ *esm_cause = ESM_CAUSE_PROTOCOL_ERROR;
+ } else {
+ /* Assign new dedicated EPS bearer context */
+ ebi = esm_ebr_assign(ebi, pid+1, FALSE);
+ }
+ }
+
+ if (ebi != ESM_EBI_UNASSIGNED) {
+ /* Check syntactical errors in packet filters */
+ rc = esm_ebr_context_check_tft(pid, ebi, tft,
+ ESM_EBR_CONTEXT_TFT_CREATE);
+
+ if (rc != RETURNok) {
+ /* Syntactical errors in packet filters */
+ LOG_TRACE(WARNING, "ESM-PROC - Syntactical errors in packet "
+ "filters");
+ *esm_cause = ESM_CAUSE_SYNTACTICAL_ERROR_IN_PACKET_FILTER;
+ } else {
+ /* Create new dedicated EPS bearer context */
+ default_ebi = esm_ebr_context_create(pid, ebi, FALSE, qos, tft);
+
+ if (default_ebi != ESM_EBI_UNASSIGNED) {
+ /* Dedicated EPS bearer contextx successfully created */
+ rc = RETURNok;
+ } else {
+ /* No resource available */
+ LOG_TRACE(WARNING, "ESM-PROC - Failed to create new dedicated "
+ "EPS bearer context");
+ *esm_cause = ESM_CAUSE_INSUFFICIENT_RESOURCES;
+ }
+ }
+ }
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: esm_proc_dedicated_eps_bearer_context_accept() **
+ ** **
+ ** Description: Performs dedicated EPS bearer context activation proce- **
+ ** dure accepted by the UE. **
+ ** **
+ ** 3GPP TS 24.301, section 6.4.2.3 **
+ ** The UE accepts dedicated EPS bearer context activation by **
+ ** sending ACTIVATE DEDICATED EPS BEARER CONTEXT ACCEPT mes- **
+ ** sage and entering the state BEARER CONTEXT ACTIVE. **
+ ** **
+ ** Inputs: is_standalone: Not used **
+ ** ebi: EPS bearer identity **
+ ** msg: Encoded ESM message to be sent **
+ ** ue_triggered: TRUE if the EPS bearer context procedure **
+ ** was triggered by the UE **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int esm_proc_dedicated_eps_bearer_context_accept(int is_standalone, int ebi,
+ OctetString *msg, int ue_triggered)
+{
+ LOG_FUNC_IN;
+
+ int rc;
+
+ LOG_TRACE(INFO,"ESM-PROC - Dedicated EPS bearer context activation "
+ "accepted by the UE (ebi=%d)", ebi);
+
+ emm_sap_t emm_sap;
+ emm_esm_data_t *emm_esm = &emm_sap.u.emm_esm.u.data;
+ /*
+ * Notity EMM that ESM PDU has to be forwarded to lower layers
+ */
+ emm_sap.primitive = EMMESM_UNITDATA_REQ;
+ emm_sap.u.emm_esm.ueid = 0;
+ emm_esm->msg.length = msg->length;
+ emm_esm->msg.value = msg->value;
+ rc = emm_sap_send(&emm_sap);
+
+ if (rc != RETURNerror) {
+ /* Set the EPS bearer context state to ACTIVE */
+ rc = esm_ebr_set_status(ebi, ESM_EBR_ACTIVE, ue_triggered);
+
+ if (rc != RETURNok) {
+ /* The EPS bearer context was already in ACTIVE state */
+ LOG_TRACE(WARNING, "ESM-PROC - EBI %d was already ACTIVE", ebi);
+ /* Accept network retransmission of already accepted activate
+ * dedicated EPS bearer context request */
+ LOG_FUNC_RETURN (RETURNok);
+ }
+ }
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: esm_proc_dedicated_eps_bearer_context_reject() **
+ ** **
+ ** Description: Performs dedicated EPS bearer context activation proce- **
+ ** dure not accepted by the UE. **
+ ** **
+ ** 3GPP TS 24.301, section 6.4.2.4 **
+ ** The UE rejects dedicated EPS bearer context activation by **
+ ** sending ACTIVATE DEDICATED EPS BEARER CONTEXT REJECT mes- **
+ ** sage. **
+ ** **
+ ** Inputs: is_standalone: Not used **
+ ** ebi: EPS bearer identity **
+ ** msg: Encoded ESM message to be sent **
+ ** ue_triggered: Not used **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int esm_proc_dedicated_eps_bearer_context_reject(int is_standalone, int ebi,
+ OctetString *msg, int ue_triggered)
+{
+ LOG_FUNC_IN;
+
+ int rc = RETURNok;
+
+ LOG_TRACE(WARNING, "ESM-PROC - Dedicated EPS bearer context activation "
+ "not accepted by the UE (ebi=%d)", ebi);
+
+ if ( !esm_ebr_is_not_in_use(ebi) ) {
+ /* Release EPS bearer data currently in use */
+ rc = esm_ebr_release(ebi);
+ }
+
+ if (rc != RETURNok) {
+ LOG_TRACE(WARNING, "ESM-PROC - Failed to release EPS bearer data");
+ } else {
+ emm_sap_t emm_sap;
+ emm_esm_data_t *emm_esm = &emm_sap.u.emm_esm.u.data;
+ /*
+ * Notity EMM that ESM PDU has to be forwarded to lower layers
+ */
+ emm_sap.primitive = EMMESM_UNITDATA_REQ;
+ emm_sap.u.emm_esm.ueid = 0;
+ emm_esm->msg.length = msg->length;
+ emm_esm->msg.value = msg->value;
+ rc = emm_sap_send(&emm_sap);
+ }
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************/
+/********************* L O C A L F U N C T I O N S *********************/
+/****************************************************************************/
+
+/*
+ * --------------------------------------------------------------------------
+ * Timer handlers
+ * --------------------------------------------------------------------------
+ */
diff --git a/openair-cn/NAS/UE/ESM/DefaultEpsBearerContextActivation.c b/openair-cn/NAS/UE/ESM/DefaultEpsBearerContextActivation.c
new file mode 100755
index 0000000000..b6b7fb13fa
--- /dev/null
+++ b/openair-cn/NAS/UE/ESM/DefaultEpsBearerContextActivation.c
@@ -0,0 +1,385 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+Source DefaultEpsBearerContextActivation.c
+
+Version 0.1
+
+Date 2013/01/28
+
+Product NAS stack
+
+Subsystem EPS Session Management
+
+Author Frederic Maurel
+
+Description Defines the default EPS bearer context activation ESM
+ procedure executed by the Non-Access Stratum.
+
+ The purpose of the default bearer context activation procedure
+ is to establish a default EPS bearer context between the UE
+ and the EPC.
+
+ The procedure is initiated by the network as a response to
+ the PDN CONNECTIVITY REQUEST message received from the UE.
+ It can be part of the attach procedure.
+
+*****************************************************************************/
+
+#include "esm_proc.h"
+#include "commonDef.h"
+#include "nas_log.h"
+
+#include "esm_cause.h"
+#include "esm_ebr.h"
+#include "esm_ebr_context.h"
+
+#include "emm_sap.h"
+
+/****************************************************************************/
+/**************** E X T E R N A L D E F I N I T I O N S ****************/
+/****************************************************************************/
+
+/****************************************************************************/
+/******************* L O C A L D E F I N I T I O N S *******************/
+/****************************************************************************/
+
+/*
+ * --------------------------------------------------------------------------
+ * Internal data handled by the default EPS bearer context activation
+ * procedure in the UE
+ * --------------------------------------------------------------------------
+ */
+static struct {
+ int ebi; /* EPS bearer identity of the default EPS bearer associated
+ * to the PDN connection to be activated */
+} _default_eps_bearer_context_data = {ESM_EBI_UNASSIGNED};
+
+
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+
+/*
+ * --------------------------------------------------------------------------
+ * Default EPS bearer context activation procedure executed by the UE
+ * --------------------------------------------------------------------------
+ */
+/****************************************************************************
+ ** **
+ ** Name: esm_proc_default_eps_bearer_context_request() **
+ ** **
+ ** Description: Creates local default EPS bearer context upon receipt of **
+ ** the ACTIVATE DEFAULT EPS BEARER CONTEXT REQUEST message. **
+ ** **
+ ** Inputs: pid: PDN connection identifier **
+ ** ebi: EPS bearer identity **
+ ** qos: EPS bearer level QoS parameters **
+ ** Others: None **
+ ** **
+ ** Outputs: esm_cause: Cause code returned upon ESM procedure **
+ ** failure **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: _default_eps_bearer_context_data **
+ ** **
+ ***************************************************************************/
+int esm_proc_default_eps_bearer_context_request(int pid, int ebi,
+ const esm_proc_qos_t *qos,
+ int *esm_cause)
+{
+ LOG_FUNC_IN;
+
+ int rc = RETURNerror;
+
+ LOG_TRACE(INFO, "ESM-PROC - Default EPS bearer context activation "
+ "requested by the network (ebi=%d)", ebi);
+
+ /* Assign default EPS bearer context */
+ int new_ebi = esm_ebr_assign(ebi, pid+1, TRUE);
+
+ if (new_ebi == ESM_EBI_UNASSIGNED) {
+ /* 3GPP TS 24.301, section 6.4.1.5, abnormal cases a and b
+ * Default EPS bearer context activation request for an already
+ * activated default or dedicated EPS bearer context
+ */
+ int old_pid, old_bid;
+ /* Locally deactivate the existing EPS bearer context and proceed
+ * with the requested default EPS bearer context activation */
+ rc = esm_proc_eps_bearer_context_deactivate(TRUE, ebi,
+ &old_pid, &old_bid);
+
+ if (rc != RETURNok) {
+ /* Failed to release EPS bearer context */
+ *esm_cause = ESM_CAUSE_PROTOCOL_ERROR;
+ } else {
+ /* Assign new default EPS bearer context */
+ ebi = esm_ebr_assign(ebi, pid+1, TRUE);
+ }
+ }
+
+ if (ebi != ESM_EBI_UNASSIGNED) {
+ /* Create new default EPS bearer context */
+ ebi = esm_ebr_context_create(pid, ebi, TRUE, qos, NULL);
+
+ if (ebi != ESM_EBI_UNASSIGNED) {
+ /* Default EPS bearer contextx successfully created */
+ _default_eps_bearer_context_data.ebi = ebi;
+ rc = RETURNok;
+ } else {
+ /* No resource available */
+ LOG_TRACE(WARNING, "ESM-PROC - Failed to create new default EPS "
+ "bearer context");
+ *esm_cause = ESM_CAUSE_INSUFFICIENT_RESOURCES;
+ }
+ }
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: esm_proc_default_eps_bearer_context_accept() **
+ ** **
+ ** Description: Performs default EPS bearer context activation procedure **
+ ** accepted by the UE. **
+ ** **
+ ** 3GPP TS 24.301, section 6.4.1.3 **
+ ** The UE accepts default EPS bearer context activation by **
+ ** sending ACTIVATE DEFAULT EPS BEARER CONTEXT ACCEPT mes- **
+ ** sage and entering the state BEARER CONTEXT ACTIVE. **
+ ** If the default bearer is activated as part of the attach **
+ ** procedure, the UE shall send the accept message together **
+ ** with ATTACH COMPLETE message. **
+ ** **
+ ** Inputs: is_standalone: Indicates whether the activate default EPS **
+ ** bearer context accept has to be sent stand-**
+ ** alone or together within an attach comple- **
+ ** te message **
+ ** ebi: EPS bearer identity **
+ ** msg: Encoded ESM message to be sent **
+ ** ue_triggered: TRUE if the EPS bearer context procedure **
+ ** was triggered by the UE (should be always **
+ ** TRUE) **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int esm_proc_default_eps_bearer_context_accept(int is_standalone, int ebi,
+ OctetString *msg, int ue_triggered)
+{
+ LOG_FUNC_IN;
+
+ int rc = RETURNok;
+
+ LOG_TRACE(INFO,"ESM-PROC - Default EPS bearer context activation "
+ "accepted by the UE (ebi=%d)", ebi);
+
+ if (is_standalone) {
+ emm_sap_t emm_sap;
+ emm_esm_data_t *emm_esm = &emm_sap.u.emm_esm.u.data;
+ /*
+ * Notity EMM that ESM PDU has to be forwarded to lower layers
+ */
+ emm_sap.primitive = EMMESM_UNITDATA_REQ;
+ emm_sap.u.emm_esm.ueid = 0;
+ emm_esm->msg.length = msg->length;
+ emm_esm->msg.value = msg->value;
+ rc = emm_sap_send(&emm_sap);
+ }
+
+ if (rc != RETURNerror) {
+ /* Set the EPS bearer context state to ACTIVE */
+ rc = esm_ebr_set_status(ebi, ESM_EBR_ACTIVE, ue_triggered);
+
+ if (rc != RETURNok) {
+ /* The EPS bearer context was already in ACTIVE state */
+ LOG_TRACE(WARNING, "ESM-PROC - EBI %d was already ACTIVE", ebi);
+ /* Accept network retransmission of already accepted activate
+ * default EPS bearer context request */
+ LOG_FUNC_RETURN (RETURNok);
+ }
+ }
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: esm_proc_default_eps_bearer_context_reject() **
+ ** **
+ ** Description: Performs default EPS bearer context activation procedure **
+ ** not accepted by the UE. **
+ ** **
+ ** 3GPP TS 24.301, section 6.4.1.4 **
+ ** The UE rejects default EPS bearer context activation by **
+ ** sending ACTIVATE DEFAULT EPS BEARER CONTEXT REJECT mes- **
+ ** sage and entering the state BEARER CONTEXT INACTIVE. **
+ ** If the default EPS bearer context activation is part of **
+ ** the attach procedure, the ESM sublayer shall notify the **
+ ** EMM sublayer of an ESM failure. **
+ ** **
+ ** Inputs: is_standalone: Indicates whether the activate default EPS **
+ ** bearer context accept has to be sent stand-**
+ ** alone or together within an attach comple- **
+ ** te message **
+ ** ebi: EPS bearer identity **
+ ** msg: Encoded ESM message to be sent **
+ ** ue_triggered: Not used **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int esm_proc_default_eps_bearer_context_reject(int is_standalone, int ebi,
+ OctetString *msg, int ue_triggered)
+{
+ LOG_FUNC_IN;
+
+ int rc = RETURNok;
+
+ LOG_TRACE(WARNING, "ESM-PROC - Default EPS bearer context activation "
+ "not accepted by the UE (ebi=%d)", ebi);
+
+ if ( !esm_ebr_is_not_in_use(ebi) ) {
+ /* Release EPS bearer data currently in use */
+ rc = esm_ebr_release(ebi);
+ }
+
+ if (rc != RETURNok) {
+ LOG_TRACE(WARNING, "ESM-PROC - Failed to release EPS bearer data");
+ } else if (is_standalone) {
+ emm_sap_t emm_sap;
+ emm_esm_data_t *emm_esm = &emm_sap.u.emm_esm.u.data;
+ /*
+ * Notity EMM that ESM PDU has to be forwarded to lower layers
+ */
+ emm_sap.primitive = EMMESM_UNITDATA_REQ;
+ emm_sap.u.emm_esm.ueid = 0;
+ emm_esm->msg.length = msg->length;
+ emm_esm->msg.value = msg->value;
+ rc = emm_sap_send(&emm_sap);
+ } else {
+ /* An error is returned to notify EMM that the default EPS bearer
+ * activation procedure initiated as part of the initial attach
+ * procedure has failed
+ */
+ rc = RETURNerror;
+ }
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: esm_proc_default_eps_bearer_context_complete() **
+ ** **
+ ** Description: Terminates the default EPS bearer context activation pro- **
+ ** cedure upon receiving indication from the EPS Mobility **
+ ** Management sublayer that the ACTIVATE DEFAULT EPS BEARER **
+ ** CONTEXT ACCEPT message has been successfully delivered to **
+ ** the MME. **
+ ** **
+ ** Inputs: None **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: _default_eps_bearer_context_data **
+ ** **
+ ***************************************************************************/
+int esm_proc_default_eps_bearer_context_complete(void)
+{
+ LOG_FUNC_IN;
+
+ LOG_TRACE(INFO,
+ "ESM-PROC - Default EPS bearer context activation complete");
+
+ /* Reset default EPS bearer context internal data */
+ _default_eps_bearer_context_data.ebi = ESM_EBI_UNASSIGNED;
+
+ LOG_FUNC_RETURN (RETURNok);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: esm_proc_default_eps_bearer_context_failure() **
+ ** **
+ ** Description: Performs default EPS bearer context activation procedure **
+ ** upon receiving transmission failure of ESM message indi- **
+ ** cation from the EPS Mobility Management sublayer **
+ ** **
+ ** The UE releases the default EPS bearer context previously **
+ ** allocated before the ACTIVATE DEFAULT EPS BEARER CONTEXT **
+ ** ACCEPT message was sent. **
+ ** **
+ ** Inputs: None **
+ ** Others: _default_eps_bearer_context_data **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: _default_eps_bearer_context_data **
+ ** **
+ ***************************************************************************/
+int esm_proc_default_eps_bearer_context_failure(void)
+{
+ LOG_FUNC_IN;
+
+ int ebi = _default_eps_bearer_context_data.ebi;
+ int pid, bid;
+
+ LOG_TRACE(WARNING,
+ "ESM-PROC - Default EPS bearer context activation failure");
+
+ /* Release the default EPS bearer context and enter state INACTIVE */
+ int rc = esm_proc_eps_bearer_context_deactivate(TRUE, ebi, &pid, &bid);
+
+ if (rc != RETURNerror) {
+ /* Reset default EPS bearer context internal data */
+ _default_eps_bearer_context_data.ebi = ESM_EBI_UNASSIGNED;
+ }
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************/
+/********************* L O C A L F U N C T I O N S *********************/
+/****************************************************************************/
+
+/*
+ * --------------------------------------------------------------------------
+ * Timer handlers
+ * --------------------------------------------------------------------------
+ */
diff --git a/openair-cn/NAS/UE/ESM/EpsBearerContextDeactivation.c b/openair-cn/NAS/UE/ESM/EpsBearerContextDeactivation.c
new file mode 100755
index 0000000000..a8a5a4c952
--- /dev/null
+++ b/openair-cn/NAS/UE/ESM/EpsBearerContextDeactivation.c
@@ -0,0 +1,392 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+Source EpsBearerContextDeactivation.c
+
+Version 0.1
+
+Date 2013/05/22
+
+Product NAS stack
+
+Subsystem EPS Session Management
+
+Author Frederic Maurel
+
+Description Defines the EPS bearer context deactivation ESM procedure
+ executed by the Non-Access Stratum.
+
+ The purpose of the EPS bearer context deactivation procedure
+ is to deactivate an EPS bearer context or disconnect from a
+ PDN by deactivating all EPS bearer contexts to the PDN.
+ The EPS bearer context deactivation procedure is initiated
+ by the network, and it may be triggered by the UE by means
+ of the UE requested bearer resource modification procedure
+ or UE requested PDN disconnect procedure.
+
+*****************************************************************************/
+
+#include "esm_proc.h"
+#include "commonDef.h"
+#include "nas_log.h"
+
+#include "emmData.h"
+#include "esmData.h"
+#include "esm_cause.h"
+#include "esm_ebr.h"
+#include "esm_ebr_context.h"
+
+#include "esm_main.h"
+
+#include "emm_sap.h"
+#include "esm_sap.h"
+
+/****************************************************************************/
+/**************** E X T E R N A L D E F I N I T I O N S ****************/
+/****************************************************************************/
+
+/****************************************************************************/
+/******************* L O C A L D E F I N I T I O N S *******************/
+/****************************************************************************/
+
+/*
+ * --------------------------------------------------------------------------
+ * Internal data handled by the EPS bearer context deactivation procedure
+ * in the UE
+ * --------------------------------------------------------------------------
+ */
+static int _eps_bearer_release(int ebi, int *pid, int *bid);
+
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+
+/*
+ * --------------------------------------------------------------------------
+ * EPS bearer context deactivation procedure executed by the UE
+ * --------------------------------------------------------------------------
+ */
+/****************************************************************************
+ ** **
+ ** Name: esm_proc_eps_bearer_context_deactivate() **
+ ** **
+ ** Description: Locally releases the EPS bearer context identified by the **
+ ** given EPS bearer identity, without peer-to-peer signal- **
+ ** ling between the UE and the MME, or checks whether the UE **
+ ** has an EPS bearer context with specified EPS bearer iden- **
+ ** tity activated. **
+ ** **
+ ** Inputs: is local: TRUE if the EPS bearer context has to be **
+ ** locally released without peer-to-peer si- **
+ ** gnalling between the UE and the MME **
+ ** ebi: EPS bearer identity of the EPS bearer con- **
+ ** text to be deactivated **
+ ** Others: _esm_data **
+ ** **
+ ** Outputs: pid: Identifier of the PDN connection the EPS **
+ ** bearer belongs to **
+ ** bid: Identifier of the released EPS bearer con- **
+ ** text entry **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int esm_proc_eps_bearer_context_deactivate(int is_local, int ebi,
+ int *pid, int *bid)
+{
+ LOG_FUNC_IN;
+
+ int rc = RETURNerror;
+ int i;
+
+ if (is_local) {
+ if (ebi != ESM_SAP_ALL_EBI) {
+ /* Locally release the EPS bearer context */
+ rc = _eps_bearer_release(ebi, pid, bid);
+ } else {
+ /* Locally release all the EPS bearer contexts */
+ *bid = 0;
+
+ for (*pid = 0; *pid < ESM_DATA_PDN_MAX; (*pid)++) {
+ if (_esm_data.pdn[*pid].data) {
+ rc = _eps_bearer_release(ESM_EBI_UNASSIGNED, pid, bid);
+
+ if (rc != RETURNok) {
+ break;
+ }
+ }
+ }
+ }
+
+ LOG_FUNC_RETURN (rc);
+ }
+
+ LOG_TRACE(WARNING, "ESM-PROC - EPS bearer context deactivation (ebi=%d)",
+ ebi);
+
+ if (*pid < ESM_DATA_PDN_MAX) {
+ if (_esm_data.pdn[*pid].pid != *pid) {
+ LOG_TRACE(ERROR, "ESM-PROC - PDN connection identifier %d "
+ "is not valid", *pid);
+ } else if (_esm_data.pdn[*pid].data == NULL) {
+ LOG_TRACE(ERROR, "ESM-PROC - PDN connection %d has not been "
+ "allocated", *pid);
+ } else if (!_esm_data.pdn[*pid].is_active) {
+ LOG_TRACE(WARNING, "ESM-PROC - PDN connection %d is not active",
+ *pid);
+ } else {
+ esm_pdn_t *pdn = _esm_data.pdn[*pid].data;
+
+ for (i = 0; i < pdn->n_bearers; i++) {
+ if (pdn->bearer[i]->ebi != ebi) {
+ continue;
+ }
+
+ /* The EPS bearer context to be released is valid */
+ rc = RETURNok;
+ }
+ }
+ }
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: esm_proc_eps_bearer_context_deactivate_request() **
+ ** **
+ ** Description: Deletes the EPS bearer context identified by the EPS bea- **
+ ** rer identity upon receipt of the DEACTIVATE EPS BEARER **
+ ** CONTEXT REQUEST message. **
+ ** **
+ ** Inputs: ebi: EPS bearer identity **
+ ** Others: None **
+ ** **
+ ** Outputs: esm_cause: Cause code returned upon ESM procedure **
+ ** failure **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int esm_proc_eps_bearer_context_deactivate_request(int ebi, int *esm_cause)
+{
+ LOG_FUNC_IN;
+
+ int pid, bid;
+ int rc = RETURNok;
+
+ LOG_TRACE(INFO, "ESM-PROC - EPS bearer context deactivation "
+ "requested by the network (ebi=%d)", ebi);
+
+ /* Release the EPS bearer context entry */
+ if (esm_ebr_context_release(ebi, &pid, &bid) == ESM_EBI_UNASSIGNED) {
+ LOG_TRACE(WARNING, "ESM-PROC - Failed to release EPS bearer context");
+ *esm_cause = ESM_CAUSE_PROTOCOL_ERROR;
+ LOG_FUNC_RETURN (RETURNerror);
+ }
+
+ if (bid == 0) {
+ /* The EPS bearer identity is that of the default bearer assigned to
+ * the PDN connection */
+ if (*esm_cause == ESM_CAUSE_REACTIVATION_REQUESTED) {
+ esm_sap_t esm_sap;
+ int active = FALSE;
+
+ /* 3GPP TS 24.301, section 6.4.4.3
+ * The UE should re-initiate the UE requested PDN connectivity
+ * procedure for the APN associated to the PDN it was connected
+ * to in order to reactivate the EPS bearer context
+ */
+ LOG_TRACE(WARNING, "ESM-PROC - The network requests PDN "
+ "connection reactivation");
+
+ /* Get PDN context parameters */
+ rc = esm_main_get_pdn(pid + 1, &esm_sap.data.pdn_connect.pdn_type,
+ &esm_sap.data.pdn_connect.apn,
+ &esm_sap.data.pdn_connect.is_emergency,
+ &active);
+
+ if (rc != RETURNerror) {
+ if (active) {
+ LOG_TRACE(ERROR, "ESM-PROC - Connectivity to APN %s "
+ "has not been deactivated",
+ esm_sap.data.pdn_connect.apn);
+ *esm_cause = ESM_CAUSE_REQUEST_REJECTED_UNSPECIFIED;
+ LOG_FUNC_RETURN (RETURNerror);
+ }
+
+ /*
+ * Notify ESM to re-initiate PDN connectivity procedure
+ */
+ esm_sap.primitive = ESM_PDN_CONNECTIVITY_REQ;
+ esm_sap.is_standalone = TRUE;
+ esm_sap.data.pdn_connect.is_defined = TRUE;
+ esm_sap.data.pdn_connect.cid = pid + 1;
+ rc = esm_sap_send(&esm_sap);
+ }
+ }
+ }
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: esm_proc_eps_bearer_context_deactivate_accept() **
+ ** **
+ ** Description: Performs EPS bearer context deactivation procedure accep- **
+ ** ted by the UE. **
+ ** **
+ ** 3GPP TS 24.301, section 6.4.4.3 **
+ ** The UE accepts EPS bearer context deactivation by sending **
+ ** DEACTIVATE EPS BEARER CONTEXT ACCEPT message and entering **
+ ** the state BEARER CONTEXT INACTIVE. **
+ ** **
+ ** Inputs: is_standalone: Should be always TRUE **
+ ** ebi: EPS bearer identity **
+ ** msg: Encoded ESM message to be sent **
+ ** ue_triggered: TRUE if the EPS bearer context procedure **
+ ** was triggered by the UE **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int esm_proc_eps_bearer_context_deactivate_accept(int is_standalone, int ebi,
+ OctetString *msg, int ue_triggered)
+{
+ LOG_FUNC_IN;
+
+ int rc = RETURNok;
+
+ LOG_TRACE(INFO,"ESM-PROC - EPS bearer context deactivation accepted");
+
+ if (is_standalone) {
+ emm_sap_t emm_sap;
+ /*
+ * Notity EMM that ESM PDU has to be forwarded to lower layers
+ */
+ emm_sap.primitive = EMMESM_UNITDATA_REQ;
+ emm_sap.u.emm_esm.ueid = 0;
+ emm_sap.u.emm_esm.u.data.msg.length = msg->length;
+ emm_sap.u.emm_esm.u.data.msg.value = msg->value;
+ rc = emm_sap_send(&emm_sap);
+ }
+
+ if (rc != RETURNerror) {
+ /* Set the EPS bearer context state to INACTIVE */
+ rc = esm_ebr_set_status(ebi, ESM_EBR_INACTIVE, ue_triggered);
+
+ if (rc != RETURNok) {
+ /* The EPS bearer context was already in INACTIVE state */
+ LOG_TRACE(WARNING, "ESM-PROC - EBI %d was already INACTIVE", ebi);
+ /* Accept network retransmission of already accepted deactivate
+ * EPS bearer context request */
+ LOG_FUNC_RETURN (RETURNok);
+ }
+
+ /* Release EPS bearer data */
+ rc = esm_ebr_release(ebi);
+ }
+
+ LOG_FUNC_RETURN (rc);
+}
+
+
+/****************************************************************************/
+/********************* L O C A L F U N C T I O N S *********************/
+/****************************************************************************/
+
+/*
+ * --------------------------------------------------------------------------
+ * Timer handlers
+ * --------------------------------------------------------------------------
+ */
+
+
+
+/*
+ * --------------------------------------------------------------------------
+ * UE specific local functions
+ * --------------------------------------------------------------------------
+ */
+
+/****************************************************************************
+ ** **
+ ** Name: _eps_bearer_release() **
+ ** **
+ ** Description: Releases the EPS bearer context identified by the given **
+ ** EPS bearer identity and enters state INACTIVE. **
+ ** **
+ ** Inputs: ebi: EPS bearer identity **
+ ** Others: None **
+ ** **
+ ** Outputs: pid: Identifier of the PDN connection the EPS **
+ ** bearer belongs to **
+ ** bid: Identifier of the released EPS bearer con- **
+ ** text entry **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+static int _eps_bearer_release(int ebi, int *pid, int *bid)
+{
+ LOG_FUNC_IN;
+
+ int rc = RETURNerror;
+
+ /* Release the EPS bearer context entry */
+ ebi = esm_ebr_context_release(ebi, pid, bid);
+
+ if (ebi == ESM_EBI_UNASSIGNED) {
+ LOG_TRACE(WARNING, "ESM-PROC - Failed to release EPS bearer context");
+ } else {
+ /* Set the EPS bearer context state to INACTIVE */
+ rc = esm_ebr_set_status(ebi, ESM_EBR_INACTIVE, FALSE);
+
+ if (rc != RETURNok) {
+ /* The EPS bearer context was already in INACTIVE state */
+ LOG_TRACE(WARNING, "ESM-PROC - EBI %d was already INACTIVE", ebi);
+ } else {
+ /* Release EPS bearer data */
+ rc = esm_ebr_release(ebi);
+
+ if (rc != RETURNok) {
+ LOG_TRACE(WARNING,
+ "ESM-PROC - Failed to release EPS bearer data");
+ }
+ }
+ }
+
+ LOG_FUNC_RETURN (rc);
+}
diff --git a/openair-cn/NAS/UE/ESM/EsmStatusHdl.c b/openair-cn/NAS/UE/ESM/EsmStatusHdl.c
new file mode 100755
index 0000000000..8ff3a21b0b
--- /dev/null
+++ b/openair-cn/NAS/UE/ESM/EsmStatusHdl.c
@@ -0,0 +1,196 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+Source EsmStatus.c
+
+Version 0.1
+
+Date 2013/06/17
+
+Product NAS stack
+
+Subsystem EPS Session Management
+
+Author Frederic Maurel
+
+Description Defines the ESM status procedure executed by the Non-Access
+ Stratum.
+
+ ESM status procedure can be related to an EPS bearer context
+ or to a procedure transaction.
+
+ The purpose of the sending of the ESM STATUS message is to
+ report at any time certain error conditions detected upon
+ receipt of ESM protocol data. The ESM STATUS message can be
+ sent by both the MME and the UE.
+
+*****************************************************************************/
+
+#include "esm_proc.h"
+#include "commonDef.h"
+#include "nas_log.h"
+
+#include "esm_cause.h"
+
+#include "emm_sap.h"
+
+/****************************************************************************/
+/**************** E X T E R N A L D E F I N I T I O N S ****************/
+/****************************************************************************/
+
+/****************************************************************************/
+/******************* L O C A L D E F I N I T I O N S *******************/
+/****************************************************************************/
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+/****************************************************************************
+ ** **
+ ** Name: esm_proc_status_ind() **
+ ** **
+ ** Description: Processes received ESM status message. **
+ ** **
+ ** 3GPP TS 24.301, section 6.7 **
+ ** Upon receiving ESM Status message the UE/MME shall take **
+ ** different actions depending on the received ESM cause **
+ ** value. **
+ ** **
+ ** Inputs: ueid: UE lower layer identifier **
+ ** pti: Procedure transaction identity **
+ ** ebi: EPS bearer identity **
+ ** esm_cause: Received ESM cause code **
+ ** failure **
+ ** Others: None **
+ ** **
+ ** Outputs: esm_cause: Cause code returned upon ESM procedure **
+ ** failure **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int esm_proc_status_ind(
+ int pti, int ebi, int *esm_cause)
+{
+ LOG_FUNC_IN;
+
+ int rc;
+
+ LOG_TRACE(INFO,"ESM-PROC - ESM status procedure requested (cause=%d)",
+ *esm_cause);
+
+ LOG_TRACE(DEBUG, "ESM-PROC - To be implemented");
+
+ switch (*esm_cause) {
+ case ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY:
+ /*
+ * Abort any ongoing ESM procedure related to the received EPS
+ * bearer identity, stop any related timer, and deactivate the
+ * corresponding EPS bearer context locally
+ */
+ /* TODO */
+ rc = RETURNok;
+ break;
+
+ case ESM_CAUSE_INVALID_PTI_VALUE:
+ /*
+ * Abort any ongoing ESM procedure related to the received PTI
+ * value and stop any related timer
+ */
+ /* TODO */
+ rc = RETURNok;
+ break;
+
+ case ESM_CAUSE_MESSAGE_TYPE_NOT_IMPLEMENTED:
+ /*
+ * Abort any ongoing ESM procedure related to the PTI or
+ * EPS bearer identity and stop any related timer
+ */
+ /* TODO */
+ rc = RETURNok;
+ break;
+
+ default:
+ /*
+ * No state transition and no specific action shall be taken;
+ * local actions are possible
+ */
+ /* TODO */
+ rc = RETURNok;
+ break;
+ }
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: esm_proc_status() **
+ ** **
+ ** Description: Initiates ESM status procedure. **
+ ** **
+ ** Inputs: is_standalone: Not used - Always TRUE **
+ ** ueid: UE lower layer identifier **
+ ** ebi: Not used **
+ ** msg: Encoded ESM status message to be sent **
+ ** ue_triggered: Not used **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int esm_proc_status(int is_standalone,
+ int ebi, OctetString *msg,
+ int ue_triggered)
+{
+ LOG_FUNC_IN;
+
+ int rc;
+ emm_sap_t emm_sap;
+
+ LOG_TRACE(INFO,"ESM-PROC - ESM status procedure requested");
+
+ /*
+ * Notity EMM that ESM PDU has to be forwarded to lower layers
+ */
+ emm_sap.primitive = EMMESM_UNITDATA_REQ;
+ emm_sap.u.emm_esm.ueid = 0;
+ emm_sap.u.emm_esm.u.data.msg.length = msg->length;
+ emm_sap.u.emm_esm.u.data.msg.value = msg->value;
+ rc = emm_sap_send(&emm_sap);
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************/
+/********************* L O C A L F U N C T I O N S *********************/
+/****************************************************************************/
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/PdnConnectivity.c b/openair-cn/NAS/UE/ESM/PdnConnectivity.c
old mode 100644
new mode 100755
similarity index 68%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/PdnConnectivity.c
rename to openair-cn/NAS/UE/ESM/PdnConnectivity.c
index 76552f12c3..2cfc2f58f0
--- a/openair-cn/NAS/EURECOM-NAS/src/esm/PdnConnectivity.c
+++ b/openair-cn/NAS/UE/ESM/PdnConnectivity.c
@@ -66,10 +66,6 @@ Description Defines the PDN connectivity ESM procedure executed by the
#include "esm_cause.h"
#include "esm_pt.h"
-#ifdef NAS_MME
-# include "mme_api.h"
-#endif
-
#include "emm_sap.h"
#if defined(ENABLE_ITTI)
@@ -89,7 +85,6 @@ Description Defines the PDN connectivity ESM procedure executed by the
* Internal data handled by the PDN connectivity procedure in the UE
* --------------------------------------------------------------------------
*/
-#ifdef NAS_UE
/*
* PDN connection handlers
*/
@@ -112,26 +107,6 @@ static void *_pdn_connectivity_t3482_handler(void *);
/* Maximum value of the PDN connectivity request retransmission counter */
#define ESM_PDN_CONNECTIVITY_COUNTER_MAX 5
-#endif // NAS_UE
-
-/*
- * --------------------------------------------------------------------------
- * Internal data handled by the PDN connectivity procedure in the MME
- * --------------------------------------------------------------------------
- */
-#ifdef NAS_MME
-/*
- * PDN connection handlers
- */
-static int _pdn_connectivity_create(emm_data_context_t *ctx,
- int pti,
- const OctetString *apn,
- esm_proc_pdn_type_t pdn_type,
- const OctetString *pdn_addr,
- int is_emergency);
-int _pdn_connectivity_delete(emm_data_context_t *ctx, int pid);
-
-#endif // NAS_MME
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
@@ -142,7 +117,6 @@ int _pdn_connectivity_delete(emm_data_context_t *ctx, int pid);
* PDN connectivity procedure executed by the UE
* --------------------------------------------------------------------------
*/
-#ifdef NAS_UE
/****************************************************************************
** **
** Name: esm_proc_pdn_connectivity() **
@@ -601,293 +575,12 @@ int esm_proc_pdn_connectivity_failure(int is_pending)
LOG_FUNC_RETURN(rc);
}
-#endif // NAS_UE
-/*
- * --------------------------------------------------------------------------
- * PDN connectivity procedure executed by the MME
- * --------------------------------------------------------------------------
- */
-#ifdef NAS_MME
-/****************************************************************************
- ** **
- ** Name: esm_proc_pdn_connectivity_request() **
- ** **
- ** Description: Performs PDN connectivity procedure requested by the UE. **
- ** **
- ** 3GPP TS 24.301, section 6.5.1.3 **
- ** Upon receipt of the PDN CONNECTIVITY REQUEST message, the **
- ** MME checks if connectivity with the requested PDN can be **
- ** established. If no requested APN is provided the MME **
- ** shall use the default APN as the requested APN if the **
- ** request type is different from "emergency", or the APN **
- ** configured for emergency bearer services if the request **
- ** type is "emergency". **
- ** If connectivity with the requested PDN is accepted by the **
- ** network, the MME shall initiate the default EPS bearer **
- ** context activation procedure. **
- ** **
- ** Inputs: ueid: UE local identifier **
- ** pti: Identifies the PDN connectivity procedure **
- ** requested by the UE **
- ** request_type: Type of the PDN request **
- ** pdn_type: PDN type value (IPv4, IPv6, IPv4v6) **
- ** apn: Requested Access Point Name **
- ** Others: _esm_data **
- ** **
- ** Outputs: apn: Default Access Point Name **
- ** pdn_addr: Assigned IPv4 address and/or IPv6 suffix **
- ** esm_qos: EPS bearer level QoS parameters **
- ** esm_cause: Cause code returned upon ESM procedure **
- ** failure **
- ** Return: The identifier of the PDN connection if **
- ** successfully created; **
- ** RETURNerror otherwise. **
- ** Others: _esm_data **
- ** **
- ***************************************************************************/
-int esm_proc_pdn_connectivity_request(emm_data_context_t *ctx, int pti,
- esm_proc_pdn_request_t request_type,
- OctetString *apn,
- esm_proc_pdn_type_t pdn_type,
- OctetString *pdn_addr,
- esm_proc_qos_t *esm_qos,
- int *esm_cause)
-{
- int rc = RETURNerror;
- int pid = RETURNerror;
-
- LOG_FUNC_IN;
-
- LOG_TRACE(INFO, "ESM-PROC - PDN connectivity requested by the UE "
- "(ueid=%u, pti=%d) PDN type = %s, APN = %s pdn addr = %s", ctx->ueid, pti,
- (pdn_type == ESM_PDN_TYPE_IPV4)? "IPv4" :
- (pdn_type == ESM_PDN_TYPE_IPV6)? "IPv6" : "IPv4v6",
- (apn) ? (char *)(apn->value) : "null",
- (pdn_addr) ? (char *)(pdn_addr->value) : "null");
-
-#if !defined(NAS_BUILT_IN_EPC)
-
- /* UE identifier sanity check */
- if (ctx->ueid >= ESM_DATA_NB_UE_MAX) {
- LOG_TRACE(WARNING, "ESM-PROC - Number of connected UEs exceeded");
- LOG_FUNC_RETURN (RETURNerror);
- }
-
-#endif
-
- /*
- * Check network IP capabilities
- */
- *esm_cause = ESM_CAUSE_SUCCESS;
- LOG_TRACE(INFO, "ESM-PROC - _esm_data.conf.features %08x", _esm_data.conf.features);
-#warning "Uncomment code about _esm_data.conf.features & (MME_API_IPV4 | MME_API_IPV6) later"
-#if defined(ORIGINAL_CODE)
-
- switch (_esm_data.conf.features & (MME_API_IPV4 | MME_API_IPV6)) {
- case (MME_API_IPV4 | MME_API_IPV6):
-
- /* The network supports both IPv4 and IPv6 connection */
- if ( (pdn_type == ESM_PDN_TYPE_IPV4V6) &&
- (_esm_data.conf.features & MME_API_SINGLE_ADDR_BEARERS) ) {
- /* The network supports single IP version bearers only */
- *esm_cause = ESM_CAUSE_SINGLE_ADDRESS_BEARERS_ONLY_ALLOWED;
- }
-
- rc = RETURNok;
- break;
-
- case MME_API_IPV6:
- /* The network supports connection to IPv6 only */
- *esm_cause = ESM_CAUSE_PDN_TYPE_IPV6_ONLY_ALLOWED;
-
- if (pdn_type != ESM_PDN_TYPE_IPV4) {
- rc = RETURNok;
- }
-
- break;
-
- case MME_API_IPV4:
- /* The network supports connection to IPv4 only */
- *esm_cause = ESM_CAUSE_PDN_TYPE_IPV4_ONLY_ALLOWED;
-
- if (pdn_type != ESM_PDN_TYPE_IPV6) {
- rc = RETURNok;
- }
-
- break;
-
- default:
- LOG_TRACE(ERROR,
- "ESM-PROC - _esm_data.conf.features incorrect value (no IPV4 or IPV6 ) %X",
- _esm_data.conf.features);
- }
-
-#else
- rc = RETURNok;
-#endif
-
- if (rc != RETURNerror) {
- int is_emergency = (request_type == ESM_PDN_REQUEST_EMERGENCY);
-#if defined(ORIGINAL_CODE)
- mme_api_ip_version_t mme_pdn_index;
- mme_api_qos_t qos;
-
- switch (pdn_type) {
- case ESM_PDN_TYPE_IPV4:
- mme_pdn_index = MME_API_IPV4_ADDR;
- break;
-
- case ESM_PDN_TYPE_IPV6:
- mme_pdn_index = MME_API_IPV6_ADDR;
- break;
-
- case ESM_PDN_TYPE_IPV4V6:
- default:
- mme_pdn_index = MME_API_IPV4V6_ADDR;
- break;
- }
-
- /* Check if connectivity with the requested PDN can be established */
- rc = mme_api_subscribe(apn, mme_pdn_index, pdn_addr, is_emergency, &qos);
-
- if (rc != RETURNok) {
- LOG_TRACE(WARNING, "ESM-PROC - Connectivity to the requested PDN "
- "cannot be established");
- *esm_cause = ESM_CAUSE_REQUEST_REJECTED_UNSPECIFIED;
- LOG_FUNC_RETURN (RETURNerror);
- }
-
-#endif
-
- /* Create new PDN connection */
- pid = _pdn_connectivity_create(ctx, pti, apn, pdn_type,
- pdn_addr, is_emergency);
-#if defined(ORIGINAL_CODE)
-
- /* Setup ESM QoS parameters */
- if (esm_qos) {
- esm_qos->gbrUL = qos.gbr[MME_API_UPLINK];
- esm_qos->gbrDL = qos.gbr[MME_API_DOWNLINK];
- esm_qos->mbrUL = qos.mbr[MME_API_UPLINK];
- esm_qos->mbrDL = qos.mbr[MME_API_DOWNLINK];
- esm_qos->qci = qos.qci;
- }
-
-#endif
-
- if (pid < 0) {
- LOG_TRACE(WARNING, "ESM-PROC - Failed to create PDN connection");
- *esm_cause = ESM_CAUSE_INSUFFICIENT_RESOURCES;
- LOG_FUNC_RETURN(RETURNerror);
- }
- }
-
- LOG_FUNC_RETURN(pid);
-}
-
-/****************************************************************************
- ** **
- ** Name: esm_proc_pdn_connectivity_reject() **
- ** **
- ** Description: Performs PDN connectivity procedure not accepted by the **
- ** network. **
- ** **
- ** 3GPP TS 24.301, section 6.5.1.4 **
- ** If connectivity with the requested PDN cannot be accepted **
- ** by the network, the MME shall send a PDN CONNECTIVITY RE- **
- ** JECT message to the UE. **
- ** **
- ** Inputs: is_standalone: Indicates whether the PDN connectivity **
- ** procedure was initiated as part of the at- **
- ** tach procedure **
- ** ueid: UE lower layer identifier **
- ** ebi: Not used **
- ** msg: Encoded PDN connectivity reject message to **
- ** be sent **
- ** ue_triggered: Not used **
- ** Others: None **
- ** **
- ** Outputs: None **
- ** Return: RETURNok, RETURNerror **
- ** Others: None **
- ** **
- ***************************************************************************/
-int esm_proc_pdn_connectivity_reject(int is_standalone, emm_data_context_t *ctx,
- int ebi, OctetString *msg, int ue_triggered)
-{
- LOG_FUNC_IN;
-
- int rc = RETURNerror;
-
- LOG_TRACE(WARNING, "ESM-PROC - PDN connectivity not accepted by the "
- "network (ueid=%d)", ctx->ueid);
-
- if (is_standalone) {
- emm_sap_t emm_sap;
- /*
- * Notity EMM that ESM PDU has to be forwarded to lower layers
- */
- emm_sap.primitive = EMMESM_UNITDATA_REQ;
- emm_sap.u.emm_esm.ctx = ctx;
- emm_sap.u.emm_esm.u.data.msg.length = msg->length;
- emm_sap.u.emm_esm.u.data.msg.value = msg->value;
- rc = emm_sap_send(&emm_sap);
- }
-
- /* If the PDN connectivity procedure initiated as part of the initial
- * attach procedure has failed, an error is returned to notify EMM that
- * the ESM sublayer did not accept UE requested PDN connectivity */
- LOG_FUNC_RETURN (rc);
-}
-
-/****************************************************************************
- ** **
- ** Name: esm_proc_pdn_connectivity_failure() **
- ** **
- ** Description: Performs PDN connectivity procedure upon receiving noti- **
- ** fication from the EPS Mobility Management sublayer that **
- ** EMM procedure that initiated PDN connectivity activation **
- ** locally failed. **
- ** **
- ** The MME releases the PDN connection entry allocated when **
- ** the PDN connectivity procedure was requested by the UE. **
- ** **
- ** Inputs: ueid: UE local identifier **
- ** pid: Identifier of the PDN connection to be **
- ** released **
- ** Others: None **
- ** **
- ** Outputs: None **
- ** Return: RETURNok, RETURNerror **
- ** Others: None **
- ** **
- ***************************************************************************/
-int esm_proc_pdn_connectivity_failure(emm_data_context_t *ctx, int pid)
-{
- int pti;
-
- LOG_FUNC_IN;
-
- LOG_TRACE(WARNING, "ESM-PROC - PDN connectivity failure (ueid=%u, pid=%d)",
- ctx->ueid, pid);
-
- /* Delete the PDN connection entry */
- pti = _pdn_connectivity_delete(ctx, pid);
-
- if (pti != ESM_PT_UNASSIGNED) {
- LOG_FUNC_RETURN (RETURNok);
- }
-
- LOG_FUNC_RETURN (RETURNerror);
-}
-#endif // NAS_MME
/****************************************************************************/
/********************* L O C A L F U N C T I O N S *********************/
/****************************************************************************/
-#ifdef NAS_UE
/*
*---------------------------------------------------------------------------
* Timer handlers
@@ -1341,173 +1034,3 @@ static int _pdn_connectivity_find_pdn(const OctetString *apn,
/* Return the identifier of the PDN connection */
return (_esm_data.pdn[i].pid);
}
-#endif // NAS_UE
-
-#ifdef NAS_MME
-/*
- *---------------------------------------------------------------------------
- * PDN connection handlers
- *---------------------------------------------------------------------------
- */
-/****************************************************************************
- ** **
- ** Name: _pdn_connectivity_create() **
- ** **
- ** Description: Creates a new PDN connection entry for the specified UE **
- ** **
- ** Inputs: ueid: UE local identifier **
- ** ctx: UE context **
- ** pti: Procedure transaction identity **
- ** apn: Access Point Name of the PDN connection **
- ** pdn_type: PDN type (IPv4, IPv6, IPv4v6) **
- ** pdn_addr: Network allocated PDN IPv4 or IPv6 address **
- ** is_emergency: TRUE if the PDN connection has to be esta- **
- ** blished for emergency bearer services **
- ** Others: _esm_data **
- ** **
- ** Outputs: None **
- ** Return: The identifier of the PDN connection if **
- ** successfully created; -1 otherwise. **
- ** Others: _esm_data **
- ** **
- ***************************************************************************/
-static int _pdn_connectivity_create(emm_data_context_t *ctx,
- int pti,
- const OctetString *apn,
- esm_proc_pdn_type_t pdn_type,
- const OctetString *pdn_addr,
- int is_emergency)
-{
- int pid = ESM_DATA_PDN_MAX;
-
- LOG_TRACE(INFO, "ESM-PROC - Create new PDN connection "
- "(pti=%d) APN = %s, IP address = %s (ueid=%u)", pti, apn->value,
- (pdn_type == ESM_PDN_TYPE_IPV4)? esm_data_get_ipv4_addr(pdn_addr) :
- (pdn_type == ESM_PDN_TYPE_IPV6)? esm_data_get_ipv6_addr(pdn_addr) :
- esm_data_get_ipv4v6_addr(pdn_addr), ctx->ueid);
-
- /* Search for an available PDN connection entry */
- for (pid = 0; pid < ESM_DATA_PDN_MAX; pid++) {
- if (ctx->esm_data_ctx.pdn[pid].data != NULL) {
- continue;
- }
-
- break;
- }
-
- if (pid < ESM_DATA_PDN_MAX) {
- /* Create new PDN connection */
- esm_pdn_t *pdn = (esm_pdn_t *)malloc(sizeof(esm_pdn_t));
-
- if (pdn != NULL) {
- memset(pdn, 0, sizeof(esm_pdn_t));
- /* Increment the number of PDN connections */
- ctx->esm_data_ctx.n_pdns += 1;
- /* Set the PDN connection identifier */
- ctx->esm_data_ctx.pdn[pid].pid = pid;
- /* Reset the PDN connection active indicator */
- ctx->esm_data_ctx.pdn[pid].is_active = FALSE;
- /* Setup the PDN connection data */
- ctx->esm_data_ctx.pdn[pid].data = pdn;
-
- /* Set the procedure transaction identity */
- pdn->pti = pti;
- /* Set the emergency bearer services indicator */
- pdn->is_emergency = is_emergency;
-
- /* Setup the Access Point Name */
- if ( apn && (apn->length > 0) ) {
- pdn->apn.value = (uint8_t *)malloc(apn->length + 1);
-
- if (pdn->apn.value) {
- pdn->apn.length = apn->length;
- memcpy(pdn->apn.value, apn->value, apn->length);
- pdn->apn.value[pdn->apn.length] = '\0';
- }
- }
-
- /* Setup the IP address allocated by the network */
- if ( pdn_addr && (pdn_addr->length > 0) ) {
- int length =
- ((pdn_addr->length < ESM_DATA_IP_ADDRESS_SIZE) ?
- pdn_addr->length : ESM_DATA_IP_ADDRESS_SIZE);
- memcpy(pdn->ip_addr, pdn_addr->value, length);
- pdn->type = pdn_type;
- }
-
- /* Return the identifier of the new PDN connection */
- return (ctx->esm_data_ctx.pdn[pid].pid);
- }
-
- LOG_TRACE(WARNING, "ESM-PROC - Failed to create new PDN connection "
- "(pid=%d)", pid);
- }
-
- return (-1);
-}
-
-/****************************************************************************
- ** **
- ** Name: _pdn_connectivity_delete() **
- ** **
- ** Description: Deletes PDN connection to the specified UE associated to **
- ** PDN connection entry with given identifier **
- ** **
- ** Inputs: ueid: UE local identifier **
- ** pid: Identifier of the PDN connection to be **
- ** released **
- ** Others: _esm_data **
- ** **
- ** Outputs: None **
- ** Return: The identity of the procedure transaction **
- ** assigned to the PDN connection when suc- **
- ** cessfully released; **
- ** UNASSIGNED value otherwise. **
- ** Others: _esm_data **
- ** **
- ***************************************************************************/
-int _pdn_connectivity_delete(emm_data_context_t *ctx, int pid)
-{
- int pti = ESM_PT_UNASSIGNED;
-
- if (ctx == NULL) {
- return pti;
- }
-
- if (pid < ESM_DATA_PDN_MAX) {
- if (pid != ctx->esm_data_ctx.pdn[pid].pid) {
- LOG_TRACE(ERROR,
- "ESM-PROC - PDN connection identifier is not valid");
- } else if (ctx->esm_data_ctx.pdn[pid].data == NULL) {
- LOG_TRACE(ERROR,
- "ESM-PROC - PDN connection has not been allocated");
- } else if (ctx->esm_data_ctx.pdn[pid].is_active) {
- LOG_TRACE(ERROR, "ESM-PROC - PDN connection is active");
- } else {
- /* Get the identity of the procedure transaction that created
- * the PDN connection */
- pti = ctx->esm_data_ctx.pdn[pid].data->pti;
- }
- }
-
- if (pti != ESM_PT_UNASSIGNED) {
- /* Decrement the number of PDN connections */
- ctx->esm_data_ctx.n_pdns -= 1;
- /* Set the PDN connection as available */
- ctx->esm_data_ctx.pdn[pid].pid = -1;
-
- /* Release allocated PDN connection data */
- if (ctx->esm_data_ctx.pdn[pid].data->apn.length > 0) {
- free(ctx->esm_data_ctx.pdn[pid].data->apn.value);
- }
-
- free(ctx->esm_data_ctx.pdn[pid].data);
- ctx->esm_data_ctx.pdn[pid].data = NULL;
- LOG_TRACE(WARNING, "ESM-PROC - PDN connection %d released", pid);
- }
-
- /* Return the procedure transaction identity */
- return (pti);
-}
-
-#endif // NAS_MME
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/PdnDisconnect.c b/openair-cn/NAS/UE/ESM/PdnDisconnect.c
old mode 100644
new mode 100755
similarity index 68%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/PdnDisconnect.c
rename to openair-cn/NAS/UE/ESM/PdnDisconnect.c
index 6fb091ae43..54105a1c3b
--- a/openair-cn/NAS/EURECOM-NAS/src/esm/PdnDisconnect.c
+++ b/openair-cn/NAS/UE/ESM/PdnDisconnect.c
@@ -58,9 +58,7 @@ Description Defines the PDN disconnect ESM procedure executed by the
#include "esm_cause.h"
#include "esm_pt.h"
-#ifdef NAS_UE
#include "esm_sap.h"
-#endif
#include "emm_sap.h"
@@ -68,9 +66,7 @@ Description Defines the PDN disconnect ESM procedure executed by the
/**************** E X T E R N A L D E F I N I T I O N S ****************/
/****************************************************************************/
-#ifdef NAS_MME
-extern int _pdn_connectivity_delete(emm_data_context_t *ctx, int pid);
-#endif
+
/****************************************************************************/
/******************* L O C A L D E F I N I T I O N S *******************/
@@ -81,7 +77,6 @@ extern int _pdn_connectivity_delete(emm_data_context_t *ctx, int pid);
* Internal data handled by the PDN disconnect procedure in the UE
* --------------------------------------------------------------------------
*/
-#ifdef NAS_UE
/*
* PDN disconnection handlers
*/
@@ -95,20 +90,7 @@ static void *_pdn_disconnect_t3492_handler(void *);
/* Maximum value of the PDN disconnect request retransmission counter */
#define ESM_PDN_DISCONNECT_COUNTER_MAX 5
-#endif // NAS_UE
-/*
- * --------------------------------------------------------------------------
- * Internal data handled by the PDN disconnect procedure in the MME
- * --------------------------------------------------------------------------
- */
-#ifdef NAS_MME
-/*
- * PDN disconnection handlers
- */
-static int _pdn_disconnect_get_pid(esm_data_context_t *ctx, int pti);
-
-#endif // NAS_MME
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
@@ -119,7 +101,6 @@ static int _pdn_disconnect_get_pid(esm_data_context_t *ctx, int pti);
* PDN disconnect procedure executed by the UE
* --------------------------------------------------------------------------
*/
-#ifdef NAS_UE
/****************************************************************************
** **
** Name: esm_proc_pdn_disconnect() **
@@ -368,163 +349,8 @@ int esm_proc_pdn_disconnect_reject(int pti, int *esm_cause)
LOG_FUNC_RETURN(rc);
}
-#endif // NAS_UE
-/*
- * --------------------------------------------------------------------------
- * PDN disconnect procedure executed by the MME
- * --------------------------------------------------------------------------
- */
-#ifdef NAS_MME
-/****************************************************************************
- ** **
- ** Name: esm_proc_pdn_disconnect_request() **
- ** **
- ** Description: Performs PDN disconnect procedure requested by the UE. **
- ** **
- ** 3GPP TS 24.301, section 6.5.2.3 **
- ** Upon receipt of the PDN DISCONNECT REQUEST message, if it **
- ** is accepted by the network, the MME shall initiate the **
- ** bearer context deactivation procedure. **
- ** **
- ** Inputs: ueid: UE lower layer identifier **
- ** pti: Identifies the PDN disconnect procedure **
- ** requested by the UE **
- ** Others: _esm_data **
- ** **
- ** Outputs: esm_cause: Cause code returned upon ESM procedure **
- ** failure **
- ** Return: The identifier of the PDN connection to be **
- ** released, if it exists; **
- ** RETURNerror otherwise. **
- ** Others: None **
- ** **
- ***************************************************************************/
-int esm_proc_pdn_disconnect_request(emm_data_context_t *ctx, int pti, int *esm_cause)
-{
- int pid = RETURNerror;
-
- LOG_FUNC_IN;
-
- LOG_TRACE(INFO, "ESM-PROC - PDN disconnect requested by the UE "
- "(ueid=%d, pti=%d)", ctx->ueid, pti);
-
- /* Get UE's ESM context */
- if (ctx->esm_data_ctx.n_pdns > 1) {
- /* Get the identifier of the PDN connection entry assigned to the
- * procedure transaction identity */
- pid = _pdn_disconnect_get_pid(&ctx->esm_data_ctx, pti);
-
- if (pid < 0) {
- LOG_TRACE(ERROR, "ESM-PROC - No PDN connection found (pti=%d)",
- pti);
- *esm_cause = ESM_CAUSE_PROTOCOL_ERROR;
- LOG_FUNC_RETURN (RETURNerror);
- }
- } else {
- /* Attempt to disconnect from the last PDN disconnection
- * is not allowed */
- *esm_cause = ESM_CAUSE_LAST_PDN_DISCONNECTION_NOT_ALLOWED;
- }
-
- LOG_FUNC_RETURN(pid);
-}
-
-/****************************************************************************
- ** **
- ** Name: esm_proc_pdn_disconnect_accept() **
- ** **
- ** Description: Performs PDN disconnect procedure accepted by the UE. **
- ** **
- ** 3GPP TS 24.301, section 6.5.2.3 **
- ** On reception of DEACTIVATE EPS BEARER CONTEXT ACCEPT mes- **
- ** sage from the UE, the MME releases all the resources re- **
- ** served for the PDN in the network. **
- ** **
- ** Inputs: ueid: UE lower layer identifier **
- ** pid: Identifier of the PDN connection to be **
- ** released **
- ** Others: _esm_data **
- ** **
- ** Outputs: esm_cause: Cause code returned upon ESM procedure **
- ** failure **
- ** Return: RETURNok, RETURNerror **
- ** Others: None **
- ** **
- ***************************************************************************/
-int esm_proc_pdn_disconnect_accept(emm_data_context_t *ctx, int pid, int *esm_cause)
-{
- LOG_FUNC_IN;
-
- LOG_TRACE(INFO, "ESM-PROC - PDN disconnect accepted by the UE "
- "(ueid=%d, pid=%d)", ctx->ueid, pid);
-
- /* Release the connectivity with the requested PDN */
- int rc = mme_api_unsubscribe(NULL);
-
- if (rc != RETURNerror) {
- /* Delete the PDN connection entry */
- int pti = _pdn_connectivity_delete(ctx, pid);
-
- if (pti != ESM_PT_UNASSIGNED) {
- LOG_FUNC_RETURN (RETURNok);
- }
- }
-
- *esm_cause = ESM_CAUSE_PROTOCOL_ERROR;
- LOG_FUNC_RETURN (RETURNerror);
-}
-
-/****************************************************************************
- ** **
- ** Name: esm_proc_pdn_disconnect_reject() **
- ** **
- ** Description: Performs PDN disconnect procedure not accepted by the **
- ** network. **
- ** **
- ** 3GPP TS 24.301, section 6.5.2.4 **
- ** Upon receipt of the PDN DISCONNECT REQUEST message, if it **
- ** is not accepted by the network, the MME shall send a PDN **
- ** DISCONNECT REJECT message to the UE. **
- ** **
- ** Inputs: is_standalone: Not used - Always TRUE **
- ** ueid: UE lower layer identifier **
- ** ebi: Not used **
- ** msg: Encoded PDN disconnect reject message to **
- ** be sent **
- ** ue_triggered: Not used **
- ** Others: None **
- ** **
- ** Outputs: None **
- ** Return: RETURNok, RETURNerror **
- ** Others: None **
- ** **
- ***************************************************************************/
-int esm_proc_pdn_disconnect_reject(int is_standalone, emm_data_context_t *ctx,
- int ebi, OctetString *msg, int ue_triggered)
-{
- LOG_FUNC_IN;
-
- int rc;
- emm_sap_t emm_sap;
-
- LOG_TRACE(WARNING, "ESM-PROC - PDN disconnect not accepted by the network "
- "(ueid=%d)", ctx->ueid);
-
- /*
- * Notity EMM that ESM PDU has to be forwarded to lower layers
- */
- emm_sap.primitive = EMMESM_UNITDATA_REQ;
- emm_sap.u.emm_esm.ueid = ctx->ueid;
- emm_sap.u.emm_esm.ctx = ctx;
- emm_sap.u.emm_esm.u.data.msg.length = msg->length;
- emm_sap.u.emm_esm.u.data.msg.value = msg->value;
- rc = emm_sap_send(&emm_sap);
-
- LOG_FUNC_RETURN(rc);
-}
-#endif // NAS_MME
/****************************************************************************/
/********************* L O C A L F U N C T I O N S *********************/
@@ -536,7 +362,6 @@ int esm_proc_pdn_disconnect_reject(int is_standalone, emm_data_context_t *ctx,
* --------------------------------------------------------------------------
*/
-#ifdef NAS_UE
/****************************************************************************
** **
** Name: _pdn_disconnect_t3492_handler() **
@@ -637,7 +462,6 @@ static void *_pdn_disconnect_t3492_handler(void *args)
LOG_FUNC_RETURN(NULL);
}
-#endif // NAS_UE
/*
*---------------------------------------------------------------------------
@@ -645,7 +469,6 @@ static void *_pdn_disconnect_t3492_handler(void *args)
*---------------------------------------------------------------------------
*/
-#ifdef NAS_UE
/****************************************************************************
** **
** Name: _pdn_disconnect_get_default_ebi() **
@@ -687,46 +510,3 @@ static int _pdn_disconnect_get_default_ebi(int pti)
return (ebi);
}
-#endif // NAS_UE
-
-#ifdef NAS_MME
-/****************************************************************************
- ** **
- ** Name: _pdn_disconnect_get_pid() **
- ** **
- ** Description: Returns the identifier of the PDN connection to which the **
- ** given procedure transaction identity has been assigned **
- ** to establish connectivity to the specified UE **
- ** **
- ** Inputs: ueid: UE local identifier **
- ** pti: The procedure transaction identity **
- ** Others: _esm_data **
- ** **
- ** Outputs: None **
- ** Return: The identifier of the PDN connection if **
- ** found in the list; -1 otherwise. **
- ** Others: None **
- ** **
- ***************************************************************************/
-static int _pdn_disconnect_get_pid(esm_data_context_t *ctx, int pti)
-{
- int i = ESM_DATA_PDN_MAX;
-
- if (ctx != NULL) {
- for (i = 0; i < ESM_DATA_PDN_MAX; i++) {
- if ( (ctx->pdn[i].pid != -1) &&
- (ctx->pdn[i].data != NULL) ) {
- if (ctx->pdn[i].data->pti != pti) {
- continue;
- }
-
- /* PDN entry found */
- break;
- }
- }
- }
-
- /* Return the identifier of the PDN connection */
- return (ctx->pdn[i].pid);
-}
-#endif // NAS_MME
diff --git a/openair-cn/NAS/EURECOM-NAS/tools/COPYING b/openair-cn/NAS/UE/ESM/SAP/COPYING
old mode 100644
new mode 100755
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/tools/COPYING
rename to openair-cn/NAS/UE/ESM/SAP/COPYING
diff --git a/openair-cn/NAS/UE/ESM/SAP/esm_recv.c b/openair-cn/NAS/UE/ESM/SAP/esm_recv.c
new file mode 100755
index 0000000000..77805030a7
--- /dev/null
+++ b/openair-cn/NAS/UE/ESM/SAP/esm_recv.c
@@ -0,0 +1,695 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+Source esm_recv.c
+
+Version 0.1
+
+Date 2013/02/06
+
+Product NAS stack
+
+Subsystem EPS Session Management
+
+Author Frederic Maurel
+
+Description Defines functions executed at the ESM Service Access
+ Point upon receiving EPS Session Management messages
+ from the EPS Mobility Management sublayer.
+
+*****************************************************************************/
+
+#include "esm_recv.h"
+#include "commonDef.h"
+#include "nas_log.h"
+
+#include "esm_pt.h"
+#include "esm_ebr.h"
+#include "esm_proc.h"
+
+#include "esm_cause.h"
+
+#include // malloc, free
+#include // memset
+
+/****************************************************************************/
+/**************** E X T E R N A L D E F I N I T I O N S ****************/
+/****************************************************************************/
+
+/****************************************************************************/
+/******************* L O C A L D E F I N I T I O N S *******************/
+/****************************************************************************/
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+/*
+ * --------------------------------------------------------------------------
+ * Functions executed by both the UE and the MME upon receiving ESM messages
+ * --------------------------------------------------------------------------
+ */
+/****************************************************************************
+ ** **
+ ** Name: esm_recv_status() **
+ ** **
+ ** Description: Processes ESM status message **
+ ** **
+ ** Inputs: ueid: UE local identifier **
+ ** pti: Procedure transaction identity **
+ ** ebi: EPS bearer identity **
+ ** msg: The received ESM message **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: ESM cause code whenever the processing of **
+ ** the ESM message fails **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int esm_recv_status(int pti, int ebi, const esm_status_msg *msg)
+{
+ int esm_cause;
+ int rc;
+
+ LOG_FUNC_IN;
+
+ LOG_TRACE(INFO, "ESM-SAP - Received ESM status message (pti=%d, ebi=%d)",
+ pti, ebi);
+
+ /*
+ * Message processing
+ */
+ /* Get the ESM cause */
+ esm_cause = msg->esmcause;
+
+ /* Execute the ESM status procedure */
+ rc = esm_proc_status_ind(pti, ebi, &esm_cause);
+
+ if (rc != RETURNerror) {
+ esm_cause = ESM_CAUSE_SUCCESS;
+ }
+
+ /* Return the ESM cause value */
+ LOG_FUNC_RETURN (esm_cause);
+}
+
+/*
+ * --------------------------------------------------------------------------
+ * Functions executed by the UE upon receiving ESM message from the network
+ * --------------------------------------------------------------------------
+ */
+/****************************************************************************
+ ** **
+ ** Name: esm_recv_pdn_connectivity_reject() **
+ ** **
+ ** Description: Processes PDN Connectivity Reject message **
+ ** **
+ ** Inputs: pti: Procedure transaction identity **
+ ** ebi: EPS bearer identity **
+ ** msg: The received ESM message **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: ESM cause code whenever the processing of **
+ ** the ESM message fails **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int esm_recv_pdn_connectivity_reject(int pti, int ebi,
+ const pdn_connectivity_reject_msg *msg)
+{
+ LOG_FUNC_IN;
+
+ int esm_cause;
+
+ LOG_TRACE(INFO, "ESM-SAP - Received PDN Connectivity Reject message "
+ "(pti=%d, ebi=%d, cause=%d)", pti, ebi, msg->esmcause);
+
+ /*
+ * Procedure transaction identity checking
+ */
+ if ( (pti == ESM_PT_UNASSIGNED) || esm_pt_is_reserved(pti) ) {
+ /* 3GPP TS 24.301, section 7.3.1, case a
+ * Reserved or unassigned PTI value
+ */
+ LOG_TRACE(WARNING, "ESM-SAP - Invalid PTI value (pti=%d)", pti);
+ LOG_FUNC_RETURN (ESM_CAUSE_INVALID_PTI_VALUE);
+ } else if ( esm_pt_is_not_in_use(pti) ) {
+ /* 3GPP TS 24.301, section 7.3.1, case a
+ * Assigned value that does not match any PTI in use
+ */
+ LOG_TRACE(WARNING, "ESM-SAP - PTI mismatch (pti=%d)", pti);
+ LOG_FUNC_RETURN (ESM_CAUSE_PTI_MISMATCH);
+ }
+ /*
+ * EPS bearer identity checking
+ */
+ else if ( (ebi != ESM_EBI_UNASSIGNED) || esm_ebr_is_reserved(ebi) ) {
+ /* 3GPP TS 24.301, section 7.3.2, case a
+ * Assigned or reserved EPS bearer identity value */
+ LOG_TRACE(WARNING, "ESM-SAP - Invalid EPS bearer identity (ebi=%d)",
+ ebi);
+ LOG_FUNC_RETURN (ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY);
+ }
+
+ /*
+ * Message processing
+ */
+ /* Get the ESM cause */
+ esm_cause = msg->esmcause;
+
+ /* Execute the PDN connectivity procedure not accepted by the network */
+ int rc = esm_proc_pdn_connectivity_reject(pti, &esm_cause);
+
+ if (rc != RETURNerror) {
+ esm_cause = ESM_CAUSE_SUCCESS;
+ }
+
+ /* Return the ESM cause value */
+ LOG_FUNC_RETURN (esm_cause);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: esm_recv_pdn_disconnect_reject() **
+ ** **
+ ** Description: Processes PDN Disconnect Reject message **
+ ** **
+ ** Inputs: pti: Procedure transaction identity **
+ ** ebi: EPS bearer identity **
+ ** msg: The received ESM message **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: ESM cause code whenever the processing of **
+ ** the ESM message fails **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int esm_recv_pdn_disconnect_reject(int pti, int ebi,
+ const pdn_disconnect_reject_msg *msg)
+{
+ LOG_FUNC_IN;
+
+ int esm_cause;
+
+ LOG_TRACE(INFO, "ESM-SAP - Received PDN Disconnect Reject message "
+ "(pti=%d, ebi=%d, cause=%d)", pti, ebi, msg->esmcause);
+
+ /*
+ * Procedure transaction identity checking
+ */
+ if ( (pti == ESM_PT_UNASSIGNED) || esm_pt_is_reserved(pti) ) {
+ /* 3GPP TS 24.301, section 7.3.1, case b
+ * Reserved or unassigned PTI value
+ */
+ LOG_TRACE(WARNING, "ESM-SAP - Invalid PTI value (pti=%d)", pti);
+ LOG_FUNC_RETURN (ESM_CAUSE_INVALID_PTI_VALUE);
+ } else if ( esm_pt_is_not_in_use(pti) ) {
+ /* 3GPP TS 24.301, section 7.3.1, case b
+ * Assigned value that does not match any PTI in use
+ */
+ LOG_TRACE(WARNING, "ESM-SAP - PTI mismatch (pti=%d)", pti);
+ LOG_FUNC_RETURN (ESM_CAUSE_PTI_MISMATCH);
+ }
+ /*
+ * EPS bearer identity checking
+ */
+ else if ( (ebi != ESM_EBI_UNASSIGNED) || esm_ebr_is_reserved(ebi) ) {
+ /* 3GPP TS 24.301, section 7.3.2, case b
+ * Assigned or reserved EPS bearer identity value */
+ LOG_TRACE(WARNING, "ESM-SAP - Invalid EPS bearer identity (ebi=%d)",
+ ebi);
+ LOG_FUNC_RETURN (ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY);
+ }
+
+ /*
+ * Message processing
+ */
+ /* Get the ESM cause */
+ esm_cause = msg->esmcause;
+
+ /* Execute the PDN disconnect procedure not accepted by the network */
+ int rc = esm_proc_pdn_disconnect_reject(pti, &esm_cause);
+
+ if (rc != RETURNerror) {
+ esm_cause = ESM_CAUSE_SUCCESS;
+ }
+
+ /* Return the ESM cause value */
+ LOG_FUNC_RETURN (esm_cause);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: esm_recv_activate_default_eps_bearer_context_request() **
+ ** **
+ ** Description: Processes Activate Default EPS Bearer Context Request **
+ ** message **
+ ** **
+ ** Inputs: pti: Procedure transaction identity **
+ ** ebi: EPS bearer identity **
+ ** msg: The received ESM message **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: ESM cause code whenever the processing of **
+ ** the ESM message fails **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int esm_recv_activate_default_eps_bearer_context_request(int pti, int ebi,
+ const activate_default_eps_bearer_context_request_msg *msg)
+{
+ LOG_FUNC_IN;
+
+ int esm_cause = ESM_CAUSE_SUCCESS;
+
+ LOG_TRACE(INFO, "ESM-SAP - Received Activate Default EPS Bearer Context "
+ "Request message (pti=%d, ebi=%d)", pti, ebi);
+
+ /*
+ * Procedure transaction identity checking
+ */
+ if ( (pti == ESM_PT_UNASSIGNED) || esm_pt_is_reserved(pti) ) {
+ /* 3GPP TS 24.301, section 7.3.1, case h
+ * Reserved or unassigned PTI value
+ */
+ LOG_TRACE(WARNING, "ESM-SAP - Invalid PTI value (pti=%d)", pti);
+ LOG_FUNC_RETURN (ESM_CAUSE_INVALID_PTI_VALUE);
+ } else if ( esm_pt_is_not_in_use(pti) ) {
+ /* 3GPP TS 24.301, section 7.3.1, case g
+ * Assigned value that does not match any PTI in use
+ */
+ LOG_TRACE(WARNING, "ESM-SAP - PTI mismatch (pti=%d)", pti);
+ LOG_FUNC_RETURN (ESM_CAUSE_PTI_MISMATCH);
+ }
+ /*
+ * EPS bearer identity checking
+ */
+ else if ( (ebi == ESM_EBI_UNASSIGNED) || esm_ebr_is_reserved(ebi) ) {
+ /* 3GPP TS 24.301, section 7.3.2, case g
+ * Reserved or unassigned EPS bearer identity value
+ */
+ LOG_TRACE(WARNING, "ESM-SAP - Invalid EPS bearer identity (ebi=%d)",
+ ebi);
+ LOG_FUNC_RETURN (ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY);
+ }
+
+ /*
+ * Message processing
+ */
+ esm_proc_qos_t qos = {-1, -1, -1, -1, -1};
+
+ /* Get the maximum bit rate for uplink and downlink */
+ if (msg->epsqos.bitRatesExtPresent) {
+ qos.mbrUL =
+ eps_qos_bit_rate_ext_value(msg->epsqos.bitRatesExt.maxBitRateForUL);
+ qos.mbrDL =
+ eps_qos_bit_rate_ext_value(msg->epsqos.bitRatesExt.maxBitRateForDL);
+ } else if (msg->epsqos.bitRatesPresent) {
+ qos.mbrUL =
+ eps_qos_bit_rate_value(msg->epsqos.bitRates.maxBitRateForUL);
+ qos.mbrDL =
+ eps_qos_bit_rate_value(msg->epsqos.bitRates.maxBitRateForDL);
+ }
+
+ /* Get the guaranteed bit rate for uplink and downlink */
+ if (msg->epsqos.bitRatesExtPresent) {
+ qos.gbrUL =
+ eps_qos_bit_rate_ext_value(msg->epsqos.bitRatesExt.guarBitRateForUL);
+ qos.gbrDL =
+ eps_qos_bit_rate_ext_value(msg->epsqos.bitRatesExt.guarBitRateForDL);
+ } else if (msg->epsqos.bitRatesPresent) {
+ qos.gbrUL =
+ eps_qos_bit_rate_value(msg->epsqos.bitRates.guarBitRateForUL);
+ qos.gbrDL =
+ eps_qos_bit_rate_value(msg->epsqos.bitRates.guarBitRateForDL);
+ }
+
+ /* Get the QoS Class Identifier */
+ qos.qci = msg->epsqos.qci;
+ /* Get the value of the PDN type indicator */
+ int pdn_type = -1;
+
+ if (msg->pdnaddress.pdntypevalue == PDN_VALUE_TYPE_IPV4) {
+ pdn_type = ESM_PDN_TYPE_IPV4;
+ } else if (msg->pdnaddress.pdntypevalue == PDN_VALUE_TYPE_IPV6) {
+ pdn_type = ESM_PDN_TYPE_IPV6;
+ } else if (msg->pdnaddress.pdntypevalue == PDN_VALUE_TYPE_IPV4V6) {
+ pdn_type = ESM_PDN_TYPE_IPV4V6;
+ }
+
+ /* Get the ESM cause */
+ if (msg->presencemask &
+ ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_ESM_CAUSE_PRESENT) {
+ /* The network allocated a PDN address of a PDN type which is different
+ * from the requested PDN type */
+ esm_cause = msg->esmcause;
+ }
+
+ /* Execute the PDN connectivity procedure accepted by the network */
+ int pid = esm_proc_pdn_connectivity_accept(pti, pdn_type,
+ &msg->pdnaddress.pdnaddressinformation,
+ &msg->accesspointname.accesspointnamevalue,
+ &esm_cause);
+
+ if (pid != RETURNerror) {
+ /* Create local default EPS bearer context */
+ int rc = esm_proc_default_eps_bearer_context_request(pid, ebi, &qos,
+ &esm_cause);
+
+ if (rc != RETURNerror) {
+ esm_cause = ESM_CAUSE_SUCCESS;
+ }
+ }
+
+ /* Return the ESM cause value */
+ LOG_FUNC_RETURN (esm_cause);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: esm_recv_activate_dedicated_eps_bearer_context_request() **
+ ** **
+ ** Description: Processes Activate Dedicated EPS Bearer Context Request **
+ ** message **
+ ** **
+ ** Inputs: pti: Procedure transaction identity **
+ ** ebi: EPS bearer identity **
+ ** msg: The received ESM message **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: ESM cause code whenever the processing of **
+ ** the ESM message fails **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int esm_recv_activate_dedicated_eps_bearer_context_request(int pti, int ebi,
+ const activate_dedicated_eps_bearer_context_request_msg *msg)
+{
+ LOG_FUNC_IN;
+
+ int esm_cause = ESM_CAUSE_SUCCESS;
+ int i;
+ int j;
+
+ LOG_TRACE(INFO, "ESM-SAP - Received Activate Dedicated EPS Bearer "
+ "Context Request message (pti=%d, ebi=%d)", pti, ebi);
+
+ /*
+ * Procedure transaction identity checking
+ */
+ if ( esm_pt_is_reserved(pti) ) {
+ /* 3GPP TS 24.301, section 7.3.1, case j
+ * Reserved PTI value
+ */
+ LOG_TRACE(WARNING, "ESM-SAP - Invalid PTI value (pti=%d)", pti);
+ LOG_FUNC_RETURN (ESM_CAUSE_INVALID_PTI_VALUE);
+ } else if ( (pti != ESM_PT_UNASSIGNED) && esm_pt_is_not_in_use(pti) ) {
+ /* 3GPP TS 24.301, section 7.3.1, case i
+ * Assigned value that does not match any PTI in use
+ */
+ LOG_TRACE(WARNING, "ESM-SAP - PTI mismatch (pti=%d)", pti);
+ LOG_FUNC_RETURN (ESM_CAUSE_PTI_MISMATCH);
+ }
+ /*
+ * EPS bearer identity checking
+ */
+ else if ( (ebi == ESM_EBI_UNASSIGNED) || esm_ebr_is_reserved(ebi) ) {
+ /* 3GPP TS 24.301, section 7.3.2, case h
+ * Reserved or unassigned EPS bearer identity value
+ */
+ LOG_TRACE(WARNING, "ESM-SAP - Invalid EPS bearer identity (ebi=%d)",
+ ebi);
+ LOG_FUNC_RETURN (ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY);
+ }
+ /*
+ * TFT checking
+ */
+ else if (msg->tft.tftoperationcode != TRAFFIC_FLOW_TEMPLATE_OPCODE_CREATE) {
+ /* 3GPP TS 24.301, section 6.4.2.4, case a1
+ * Semantic errors in TFT operations
+ */
+ LOG_FUNC_RETURN (ESM_CAUSE_SEMANTIC_ERROR_IN_THE_TFT_OPERATION);
+ } else if (msg->tft.numberofpacketfilters == 0) {
+ /* 3GPP TS 24.301, section 6.4.2.4, case b1
+ * Syntactical errors in TFT operations
+ */
+ LOG_FUNC_RETURN (ESM_CAUSE_SYNTACTICAL_ERROR_IN_THE_TFT_OPERATION);
+ }
+
+ /*
+ * Message processing
+ */
+ /* Processing of the EPS bearer level QoS parameters */
+ esm_proc_qos_t qos = {-1, -1, -1, -1, -1};
+
+ /* Get the maximum bit rate for uplink and downlink */
+ if (msg->epsqos.bitRatesExtPresent) {
+ qos.mbrUL =
+ eps_qos_bit_rate_ext_value(msg->epsqos.bitRatesExt.maxBitRateForUL);
+ qos.mbrDL =
+ eps_qos_bit_rate_ext_value(msg->epsqos.bitRatesExt.maxBitRateForDL);
+ } else if (msg->epsqos.bitRatesPresent) {
+ qos.mbrUL =
+ eps_qos_bit_rate_value(msg->epsqos.bitRates.maxBitRateForUL);
+ qos.mbrDL =
+ eps_qos_bit_rate_value(msg->epsqos.bitRates.maxBitRateForDL);
+ }
+
+ /* Get the guaranteed bit rate for uplink and downlink */
+ if (msg->epsqos.bitRatesExtPresent) {
+ qos.gbrUL =
+ eps_qos_bit_rate_ext_value(msg->epsqos.bitRatesExt.guarBitRateForUL);
+ qos.gbrDL =
+ eps_qos_bit_rate_ext_value(msg->epsqos.bitRatesExt.guarBitRateForDL);
+ } else if (msg->epsqos.bitRatesPresent) {
+ qos.gbrUL =
+ eps_qos_bit_rate_value(msg->epsqos.bitRates.guarBitRateForUL);
+ qos.gbrDL =
+ eps_qos_bit_rate_value(msg->epsqos.bitRates.guarBitRateForDL);
+ }
+
+ /* Get the QoS Class Identifier */
+ qos.qci = msg->epsqos.qci;
+
+ /* Processing of the traffic flow template parameters */
+ esm_proc_tft_t tft = {0, {NULL}};
+ /* Get the list of packet filters */
+ const PacketFilters *pkfs = &(msg->tft.packetfilterlist.createtft);
+
+ for (i = 0; i < msg->tft.numberofpacketfilters; i++) {
+ /* Create new temporary packet filter */
+ tft.pkf[i] = (network_pkf_t *)malloc(sizeof(network_pkf_t));
+
+ if (tft.pkf[i] != NULL) {
+ /* Initialize the temporary packet filter */
+ memset(tft.pkf[i], 0, sizeof(network_pkf_t));
+ /* Increment the number of packet filters contained in the TFT */
+ tft.n_pkfs += 1;
+ /* Packet filter identifier */
+ tft.pkf[i]->id = pkfs[i]->identifier;
+ /* Packet filter direction */
+ tft.pkf[i]->dir = pkfs[i]->direction;
+ /* Evaluation precedence */
+ tft.pkf[i]->precedence = pkfs[i]->eval_precedence;
+
+ /* Get the packet filter components */
+ const PacketFilter *pkf = &(pkfs[i]->packetfilter);
+
+ if (pkf->flags & TRAFFIC_FLOW_TEMPLATE_IPV4_REMOTE_ADDR_FLAG) {
+ /* IPv4 remote address component */
+ for (j = 0;
+ (j < TRAFFIC_FLOW_TEMPLATE_IPV4_ADDR_SIZE)
+ && (j < NET_PACKET_FILTER_IPV4_ADDR_SIZE); j++) {
+ tft.pkf[i]->data.ipv4.addr[j] = pkf->ipv4remoteaddr[j].addr;
+ tft.pkf[i]->data.ipv4.mask[j] = pkf->ipv4remoteaddr[j].mask;
+ }
+ } else if (pkf->flags & TRAFFIC_FLOW_TEMPLATE_IPV6_REMOTE_ADDR_FLAG) {
+ /* IPv6 remote address component */
+ for (j = 0;
+ (j < TRAFFIC_FLOW_TEMPLATE_IPV6_ADDR_SIZE)
+ && (j < NET_PACKET_FILTER_IPV6_ADDR_SIZE); j++) {
+ tft.pkf[i]->data.ipv6.addr[j] = pkf->ipv6remoteaddr[j].addr;
+ tft.pkf[i]->data.ipv6.mask[j] = pkf->ipv6remoteaddr[j].mask;
+ }
+ }
+
+ if (pkf->flags & TRAFFIC_FLOW_TEMPLATE_PROTOCOL_NEXT_HEADER_FLAG) {
+ /* Protocol identifier/Next header component */
+ tft.pkf[i]->data.ipv4.protocol =
+ pkf->protocolidentifier_nextheader;
+ }
+
+ if (pkf->flags & TRAFFIC_FLOW_TEMPLATE_SINGLE_LOCAL_PORT_FLAG) {
+ /* Single local port component */
+ tft.pkf[i]->lport = pkf->singlelocalport;
+ } else if (pkf->flags & TRAFFIC_FLOW_TEMPLATE_LOCAL_PORT_RANGE_FLAG) {
+ /* Local port range component */
+ /* TODO: Add port range type to network_pkf_t in networkDef.h */
+ tft.pkf[i]->lport = pkf->localportrange.lowlimit;
+ }
+
+ if (pkf->flags & TRAFFIC_FLOW_TEMPLATE_SINGLE_REMOTE_PORT_FLAG) {
+ /* Single remote port component */
+ tft.pkf[i]->rport = pkf->singleremoteport;
+ } else if (pkf->flags & TRAFFIC_FLOW_TEMPLATE_REMOTE_PORT_RANGE_FLAG) {
+ /* Remote port range component */
+ /* TODO: Add port range type to network_pkf_t in networkDef.h */
+ tft.pkf[i]->rport = pkf->remoteportrange.lowlimit;
+ }
+
+ if (pkf->flags & TRAFFIC_FLOW_TEMPLATE_SECURITY_PARAMETER_INDEX) {
+ /* Security parameter index component */
+ tft.pkf[i]->data.ipv6.ipsec = pkf->securityparameterindex;
+ }
+
+ if (pkf->flags & TRAFFIC_FLOW_TEMPLATE_TYPE_OF_SERVICE_TRAFFIC_CLASS) {
+ /* Type of service/Traffic class component */
+ tft.pkf[i]->data.ipv4.tos =
+ pkf->typdeofservice_trafficclass.value;
+ }
+
+ if (pkf->flags & TRAFFIC_FLOW_TEMPLATE_FLOW_LABEL) {
+ /* Flow label component */
+ tft.pkf[i]->data.ipv6.fl = pkf->flowlabel;
+ }
+ }
+ }
+
+ /* Execute the dedicated EPS bearer context activation procedure */
+ int rc = esm_proc_dedicated_eps_bearer_context_request(ebi,
+ msg->linkedepsbeareridentity,
+ &qos, &tft, &esm_cause);
+
+ if (rc != RETURNerror) {
+ esm_cause = ESM_CAUSE_SUCCESS;
+ }
+
+ /* Release temporary traffic flow template data */
+ for (i = 0; i < tft.n_pkfs; i++) {
+ free(tft.pkf[i]);
+ }
+
+ /* Return the ESM cause value */
+ LOG_FUNC_RETURN (esm_cause);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: esm_recv_deactivate_eps_bearer_context_request() **
+ ** **
+ ** Description: Processes Deactivate EPS Bearer Context Request message **
+ ** **
+ ** Inputs: pti: Procedure transaction identity **
+ ** ebi: EPS bearer identity **
+ ** msg: The received ESM message **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: ESM cause code whenever the processing of **
+ ** the ESM message fails **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int esm_recv_deactivate_eps_bearer_context_request(int pti, int ebi,
+ const deactivate_eps_bearer_context_request_msg *msg)
+{
+ LOG_FUNC_IN;
+
+ int rc = RETURNok;
+ int esm_cause;
+
+ LOG_TRACE(INFO, "ESM-SAP - Received Deactivate EPS Bearer Context "
+ "Request message (pti=%d, ebi=%d)", pti, ebi);
+
+ /*
+ * Procedure transaction identity checking
+ */
+ if ( esm_pt_is_reserved(pti) ) {
+ /* 3GPP TS 24.301, section 7.3.1, case m
+ * Reserved PTI value
+ */
+ LOG_TRACE(WARNING, "ESM-SAP - Invalid PTI value (pti=%d)", pti);
+ LOG_FUNC_RETURN (ESM_CAUSE_INVALID_PTI_VALUE);
+ } else if ( esm_pt_is_not_in_use(pti) ) {
+ /* 3GPP TS 24.301, section 7.3.1, case m
+ * Assigned value does not match any PTI in use
+ */
+ LOG_TRACE(WARNING, "ESM-SAP - PTI mismatch (pti=%d)", pti);
+ LOG_FUNC_RETURN (ESM_CAUSE_PTI_MISMATCH);
+ }
+ /*
+ * EPS bearer identity checking
+ */
+ else if ( (ebi == ESM_EBI_UNASSIGNED) || esm_ebr_is_reserved(ebi) ||
+ esm_ebr_is_not_in_use(ebi) ) {
+ /* 3GPP TS 24.301, section 7.3.2, case j
+ * Reserved or unassigned EPS bearer identity value or,
+ * assigned value that does not match an existing EPS bearer context
+ */
+ LOG_TRACE(WARNING, "ESM-SAP - Invalid EPS bearer identity (ebi=%d)",
+ ebi);
+ /* Respond with a DEACTIVATE EPS BEARER CONTEXT ACCEPT message with
+ * the EPS bearer identity set to the received EPS bearer identity */
+ LOG_FUNC_RETURN (ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY);
+ }
+
+ /*
+ * Message processing
+ */
+ /* Get the ESM cause */
+ esm_cause = msg->esmcause;
+
+ /* Execute the PDN disconnect procedure accepted by the network */
+ if (pti != ESM_PT_UNASSIGNED) {
+ rc = esm_proc_pdn_disconnect_accept(pti, &esm_cause);
+ }
+
+ if (rc != RETURNerror) {
+ /* Execute the EPS bearer context deactivation procedure */
+ rc = esm_proc_eps_bearer_context_deactivate_request(ebi, &esm_cause);
+
+ if (rc != RETURNerror) {
+ esm_cause = ESM_CAUSE_SUCCESS;
+ }
+ }
+
+ /* Return the ESM cause value */
+ LOG_FUNC_RETURN (esm_cause);
+}
+
+
+
+/****************************************************************************/
+/********************* L O C A L F U N C T I O N S *********************/
+/****************************************************************************/
diff --git a/openair-cn/NAS/UE/ESM/SAP/esm_recv.h b/openair-cn/NAS/UE/ESM/SAP/esm_recv.h
new file mode 100755
index 0000000000..f3c6a174d0
--- /dev/null
+++ b/openair-cn/NAS/UE/ESM/SAP/esm_recv.h
@@ -0,0 +1,118 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+Source esm_recv.h
+
+Version 0.1
+
+Date 2013/02/06
+
+Product NAS stack
+
+Subsystem EPS Session Management
+
+Author Frederic Maurel
+
+Description Defines functions executed at the ESM Service Access
+ Point upon receiving EPS Session Management messages
+ from the EPS Mobility Management sublayer.
+
+*****************************************************************************/
+#ifndef __ESM_RECV_H__
+#define __ESM_RECV_H__
+
+#include "EsmStatus.h"
+#include "emmData.h"
+
+#include "PdnConnectivityReject.h"
+#include "PdnDisconnectReject.h"
+#include "BearerResourceAllocationReject.h"
+#include "BearerResourceModificationReject.h"
+
+#include "ActivateDefaultEpsBearerContextRequest.h"
+#include "ActivateDedicatedEpsBearerContextRequest.h"
+#include "ModifyEpsBearerContextRequest.h"
+#include "DeactivateEpsBearerContextRequest.h"
+
+#include "EsmInformationRequest.h"
+
+/****************************************************************************/
+/********************* G L O B A L C O N S T A N T S *******************/
+/****************************************************************************/
+
+/****************************************************************************/
+/************************ G L O B A L T Y P E S ************************/
+/****************************************************************************/
+
+/****************************************************************************/
+/******************** G L O B A L V A R I A B L E S ********************/
+/****************************************************************************/
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+/*
+ * --------------------------------------------------------------------------
+ * Functions executed by both the UE and the MME upon receiving ESM messages
+ * --------------------------------------------------------------------------
+ */
+int esm_recv_status(int pti, int ebi, const esm_status_msg *msg);
+
+
+/*
+ * --------------------------------------------------------------------------
+ * Functions executed by the UE upon receiving ESM message from the network
+ * --------------------------------------------------------------------------
+ */
+/*
+ * Transaction related messages
+ * ----------------------------
+ */
+int esm_recv_pdn_connectivity_reject(int pti, int ebi,
+ const pdn_connectivity_reject_msg *msg);
+
+int esm_recv_pdn_disconnect_reject(int pti, int ebi,
+ const pdn_disconnect_reject_msg *msg);
+
+/*
+ * Messages related to EPS bearer contexts
+ * ---------------------------------------
+ */
+int esm_recv_activate_default_eps_bearer_context_request(int pti, int ebi,
+ const activate_default_eps_bearer_context_request_msg *msg);
+
+int esm_recv_activate_dedicated_eps_bearer_context_request(int pti, int ebi,
+ const activate_dedicated_eps_bearer_context_request_msg *msg);
+
+int esm_recv_deactivate_eps_bearer_context_request(int pti, int ebi,
+ const deactivate_eps_bearer_context_request_msg *msg);
+
+
+#endif /* __ESM_RECV_H__*/
diff --git a/openair-cn/NAS/UE/ESM/SAP/esm_sap.c b/openair-cn/NAS/UE/ESM/SAP/esm_sap.c
new file mode 100755
index 0000000000..dd0c0114a9
--- /dev/null
+++ b/openair-cn/NAS/UE/ESM/SAP/esm_sap.c
@@ -0,0 +1,797 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+Source esm_sap.c
+
+Version 0.1
+
+Date 2012/11/22
+
+Product NAS stack
+
+Subsystem EPS Session Management
+
+Author Frederic Maurel
+
+Description Defines the ESM Service Access Points at which the EPS
+ Session Management sublayer provides procedures for the
+ EPS bearer context handling and resources allocation.
+
+*****************************************************************************/
+
+#include "esm_sap.h"
+#include "esm_recv.h"
+#include "esm_send.h"
+#include "commonDef.h"
+#include "nas_log.h"
+
+#include "OctetString.h"
+#include "TLVDecoder.h"
+#include "esm_msgDef.h"
+#include "esm_msg.h"
+
+#include "esm_cause.h"
+#include "esm_proc.h"
+
+#include // memset, strlen
+#include
+
+/****************************************************************************/
+/**************** E X T E R N A L D E F I N I T I O N S ****************/
+/****************************************************************************/
+
+/****************************************************************************/
+/******************* L O C A L D E F I N I T I O N S *******************/
+/****************************************************************************/
+
+static int _esm_sap_recv(int msg_type, int is_standalone,
+ const OctetString *req, OctetString *rsp, esm_sap_error_t *err);
+static int _esm_sap_send(int msg_type, int is_standalone, int pti, int ebi,
+ const esm_sap_data_t *data, OctetString *rsp);
+
+
+/*
+ * String representation of ESM-SAP primitives
+ */
+static const char *_esm_sap_primitive_str[] = {
+ "ESM_DEFAULT_EPS_BEARER_CONTEXT_ACTIVATE_REQ",
+ "ESM_DEFAULT_EPS_BEARER_CONTEXT_ACTIVATE_CNF",
+ "ESM_DEFAULT_EPS_BEARER_CONTEXT_ACTIVATE_REJ",
+ "ESM_DEDICATED_EPS_BEARER_CONTEXT_ACTIVATE_REQ",
+ "ESM_DEDICATED_EPS_BEARER_CONTEXT_ACTIVATE_CNF",
+ "ESM_DEDICATED_EPS_BEARER_CONTEXT_ACTIVATE_REJ",
+ "ESM_EPS_BEARER_CONTEXT_MODIFY_REQ",
+ "ESM_EPS_BEARER_CONTEXT_MODIFY_CNF",
+ "ESM_EPS_BEARER_CONTEXT_MODIFY_REJ",
+ "ESM_EPS_BEARER_CONTEXT_DEACTIVATE_REQ",
+ "ESM_EPS_BEARER_CONTEXT_DEACTIVATE_CNF",
+ "ESM_PDN_CONNECTIVITY_REQ",
+ "ESM_PDN_CONNECTIVITY_REJ",
+ "ESM_PDN_DISCONNECT_REQ",
+ "ESM_PDN_DISCONNECT_REJ",
+ "ESM_BEARER_RESOURCE_ALLOCATE_REQ",
+ "ESM_BEARER_RESOURCE_ALLOCATE_REJ",
+ "ESM_BEARER_RESOURCE_MODIFY_REQ",
+ "ESM_BEARER_RESOURCE_MODIFY_REJ",
+ "ESM_UNITDATA_IND",
+};
+
+/*
+ * Buffer used to encode ESM messages before being returned to the EPS
+ * Mobility Management sublayer in order to be sent onto the network
+ */
+#define ESM_SAP_BUFFER_SIZE 4096
+static char _esm_sap_buffer[ESM_SAP_BUFFER_SIZE];
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+/****************************************************************************
+ ** **
+ ** Name: esm_sap_initialize() **
+ ** **
+ ** Description: Initializes the ESM Service Access Point state machine **
+ ** **
+ ** Inputs: None **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: None **
+ ** Others: NONE **
+ ** **
+ ***************************************************************************/
+void esm_sap_initialize(void)
+{
+ LOG_FUNC_IN;
+
+ /* Initialize ESM state machine */
+ //esm_fsm_initialize();
+
+ LOG_FUNC_OUT;
+}
+
+/****************************************************************************
+ ** **
+ ** Name: esm_sap_send() **
+ ** **
+ ** Description: Processes the ESM Service Access Point primitive **
+ ** **
+ ** Inputs: msg: The ESM-SAP primitive to process **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int esm_sap_send(esm_sap_t *msg)
+{
+ LOG_FUNC_IN;
+
+ int rc = RETURNerror;
+ int pid;
+
+ /* Check the ESM-SAP primitive */
+ esm_primitive_t primitive = msg->primitive;
+ assert( (primitive > ESM_START) && (primitive < ESM_END));
+
+ LOG_TRACE(INFO, "ESM-SAP - Received primitive %s (%d)",
+ _esm_sap_primitive_str[primitive - ESM_START - 1], primitive);
+
+ switch (primitive) {
+ case ESM_PDN_CONNECTIVITY_REQ:
+ {
+ esm_pdn_connectivity_t *pdn_connect = &msg->data.pdn_connect;
+
+ if ( !msg->is_standalone || !pdn_connect->is_defined ) {
+ OctetString apn = {0, NULL};
+
+ if (pdn_connect->apn) {
+ apn.length = strlen(pdn_connect->apn);
+ apn.value = (uint8_t *)pdn_connect->apn;
+ }
+
+ /* Define new PDN context */
+ rc = esm_proc_pdn_connectivity(pdn_connect->cid, TRUE,
+ pdn_connect->pdn_type, &apn,
+ pdn_connect->is_emergency, NULL);
+
+ if ( msg->is_standalone || (rc != RETURNok) ) {
+ break;
+ }
+ }
+
+ if (pdn_connect->is_defined) {
+ unsigned int pti;
+ /* Assign new procedure transaction identity */
+ rc = esm_proc_pdn_connectivity(pdn_connect->cid, TRUE,
+ pdn_connect->pdn_type, NULL,
+ pdn_connect->is_emergency, &pti);
+
+ if (rc != RETURNerror) {
+ /* Send PDN connectivity request */
+ rc = _esm_sap_send(PDN_CONNECTIVITY_REQUEST,
+ msg->is_standalone,
+ pti, EPS_BEARER_IDENTITY_UNASSIGNED,
+ &msg->data, &msg->send);
+ }
+ }
+ }
+ break;
+
+ case ESM_PDN_CONNECTIVITY_REJ:
+
+ {
+ esm_pdn_connectivity_t *pdn_connect = &msg->data.pdn_connect;
+
+ if ( msg->is_standalone && pdn_connect->is_defined ) {
+ /* Undefine the specified PDN context */
+ rc = esm_proc_pdn_connectivity(pdn_connect->cid, FALSE,
+ pdn_connect->pdn_type, NULL,
+ pdn_connect->is_emergency, NULL);
+ } else if (msg->recv != NULL) {
+ /* The UE received a PDN connectivity reject message */
+ rc = _esm_sap_recv(PDN_CONNECTIVITY_REJECT, msg->is_standalone,
+ msg->recv, &msg->send, &msg->err);
+ } else {
+ /* The PDN connectivity procedure locally failed */
+ rc = esm_proc_pdn_connectivity_failure(TRUE);
+ }
+ }
+ break;
+
+ case ESM_PDN_DISCONNECT_REQ:
+ {
+ unsigned int pti, ebi;
+ /* Get the procedure transaction identity and the EPS bearer
+ * identity of the default bearer assigned to the PDN to
+ * disconnect from */
+ rc = esm_proc_pdn_disconnect(msg->data.pdn_disconnect.cid,
+ &pti, &ebi);
+
+ if (rc != RETURNerror) {
+ /* Send PDN disconnect request */
+ rc = _esm_sap_send(PDN_DISCONNECT_REQUEST, TRUE, pti, ebi,
+ &msg->data, &msg->send);
+ }
+ }
+ break;
+
+ case ESM_PDN_DISCONNECT_REJ:
+ break;
+
+ case ESM_BEARER_RESOURCE_ALLOCATE_REQ:
+ break;
+
+ case ESM_BEARER_RESOURCE_ALLOCATE_REJ:
+ break;
+
+ case ESM_BEARER_RESOURCE_MODIFY_REQ:
+ break;
+
+ case ESM_BEARER_RESOURCE_MODIFY_REJ:
+ break;
+
+ case ESM_DEFAULT_EPS_BEARER_CONTEXT_ACTIVATE_REQ:
+ /* The UE received activate default ESP bearer context request */
+ rc = _esm_sap_recv(ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST,
+ msg->is_standalone,
+ msg->recv, &msg->send, &msg->err);
+ break;
+
+ case ESM_DEFAULT_EPS_BEARER_CONTEXT_ACTIVATE_CNF:
+ /*
+ * The activate default ESP bearer context accept message
+ * has been successfully delivered to the other side
+ */
+ rc = esm_proc_default_eps_bearer_context_complete();
+
+ if (rc != RETURNerror) {
+ rc = esm_proc_pdn_connectivity_complete();
+ }
+
+ break;
+
+ case ESM_DEFAULT_EPS_BEARER_CONTEXT_ACTIVATE_REJ:
+ /*
+ * Default ESP bearer context activation procedure locally failed
+ */
+ rc = esm_proc_default_eps_bearer_context_failure();
+
+ if (rc != RETURNerror) {
+ rc = esm_proc_pdn_connectivity_failure(FALSE);
+ }
+
+ break;
+
+ case ESM_DEDICATED_EPS_BEARER_CONTEXT_ACTIVATE_REQ:
+ break;
+
+ case ESM_DEDICATED_EPS_BEARER_CONTEXT_ACTIVATE_CNF:
+ break;
+
+ case ESM_DEDICATED_EPS_BEARER_CONTEXT_ACTIVATE_REJ:
+ break;
+
+ case ESM_EPS_BEARER_CONTEXT_MODIFY_REQ:
+ break;
+
+ case ESM_EPS_BEARER_CONTEXT_MODIFY_CNF:
+ break;
+
+ case ESM_EPS_BEARER_CONTEXT_MODIFY_REJ:
+ break;
+
+ case ESM_EPS_BEARER_CONTEXT_DEACTIVATE_REQ: {
+ int bid;
+ /*
+ * Locally deactivate EPS bearer context
+ */
+ rc = esm_proc_eps_bearer_context_deactivate(TRUE,
+ msg->data.eps_bearer_context_deactivate.ebi, &pid, &bid);
+ }
+ break;
+
+ case ESM_EPS_BEARER_CONTEXT_DEACTIVATE_CNF:
+ break;
+
+ case ESM_UNITDATA_IND:
+ rc = _esm_sap_recv(-1, msg->is_standalone, msg->recv,
+ &msg->send, &msg->err);
+ break;
+
+ default:
+ break;
+ }
+
+ LOG_FUNC_RETURN (rc);
+}
+
+/****************************************************************************/
+/********************* L O C A L F U N C T I O N S *********************/
+/****************************************************************************/
+
+/****************************************************************************
+ ** **
+ ** Name: _esm_sap_recv() **
+ ** **
+ ** Description: Processes ESM messages received from the network: Decodes **
+ ** the message and checks whether it is of the expected ty- **
+ ** pe, checks the validity of the procedure transaction iden-**
+ ** tity, checks the validity of the EPS bearer identity, and **
+ ** parses the message content. **
+ ** If no protocol error is found the ESM response message is **
+ ** returned in order to be sent back onto the network upon **
+ ** the relevant ESM procedure completion. **
+ ** If a protocol error is found the ESM status message is **
+ ** returned including the value of the ESM cause code. **
+ ** **
+ ** Inputs: msg_type: Expected type of the received ESM message **
+ ** is_standalone: Indicates whether the ESM message has been **
+ ** received standalone or together within EMM **
+ ** attach related message **
+ ** ueid: UE identifier within the MME **
+ ** req: The encoded ESM request message to process **
+ ** Others: None **
+ ** **
+ ** Outputs: rsp: The encoded ESM response message to be re- **
+ ** turned upon ESM procedure completion **
+ ** err: Error code of the ESM procedure **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: _esm_sap_buffer **
+ ** **
+ ***************************************************************************/
+static int _esm_sap_recv(int msg_type, int is_standalone,
+ const OctetString *req, OctetString *rsp,
+ esm_sap_error_t *err)
+{
+ esm_proc_procedure_t esm_procedure = NULL;
+ int esm_cause = ESM_CAUSE_SUCCESS;
+ int rc = RETURNerror;
+ int decoder_rc;
+
+ ESM_msg esm_msg;
+
+ LOG_FUNC_IN;
+
+ memset(&esm_msg, 0 , sizeof(ESM_msg));
+
+ /* Decode the received ESM message */
+ decoder_rc = esm_msg_decode(&esm_msg, req->value, req->length);
+
+ /* Process decoding errors */
+ if (decoder_rc < 0) {
+ /* 3GPP TS 24.301, section 7.2
+ * Ignore received message that is too short to contain a complete
+ * message type information element */
+ if (decoder_rc == TLV_DECODE_BUFFER_TOO_SHORT) {
+ LOG_TRACE(WARNING, "ESM-SAP - Discard message too short to "
+ "contain a complete message type IE");
+ /* Return indication that received message has been discarded */
+ *err = ESM_SAP_DISCARDED;
+ LOG_FUNC_RETURN (RETURNok);
+ }
+ /* 3GPP TS 24.301, section 7.2
+ * Unknown or unforeseen message type */
+ else if (decoder_rc == TLV_DECODE_WRONG_MESSAGE_TYPE) {
+ esm_cause = ESM_CAUSE_MESSAGE_TYPE_NOT_IMPLEMENTED;
+ }
+ /* 3GPP TS 24.301, section 7.7.2
+ * Conditional IE errors */
+ else if (decoder_rc == TLV_DECODE_UNEXPECTED_IEI) {
+ esm_cause = ESM_CAUSE_CONDITIONAL_IE_ERROR;
+ } else {
+ esm_cause = ESM_CAUSE_PROTOCOL_ERROR;
+ }
+ }
+ /* Check the type of the ESM message actually received */
+ else if ( (msg_type > 0) && (msg_type != esm_msg.header.message_type) ) {
+ if (esm_msg.header.message_type != ESM_STATUS) {
+ /* Semantically incorrect ESM message */
+ LOG_TRACE(ERROR, "ESM-SAP - Received ESM message 0x%x is not "
+ "of the expected type (0x%x)",
+ esm_msg.header.message_type, msg_type);
+ esm_cause = ESM_CAUSE_SEMANTICALLY_INCORRECT;
+ }
+ }
+
+ /* Get the procedure transaction identity */
+ unsigned int pti = esm_msg.header.procedure_transaction_identity;
+ /* Get the EPS bearer identity */
+ unsigned int ebi = esm_msg.header.eps_bearer_identity;
+ /* Indicate whether the ESM bearer context related procedure was triggered
+ * by the receipt of a transaction related request message from the UE or
+ * was triggered network-internally */
+ int triggered_by_ue = (pti != PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED);
+ /* Indicate whether the received message shall be ignored */
+ int is_discarded = FALSE;
+
+ if (esm_cause != ESM_CAUSE_SUCCESS) {
+ LOG_TRACE(ERROR, "ESM-SAP - Failed to decode expected ESM message "
+ "0x%x", msg_type);
+ }
+ /* Process the received ESM message */
+ else switch (esm_msg.header.message_type) {
+
+ case ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST:
+ /*
+ * Process activate default EPS bearer context request message
+ * received from the MME
+ */
+ esm_cause = esm_recv_activate_default_eps_bearer_context_request(
+ pti, ebi,
+ &esm_msg.activate_default_eps_bearer_context_request);
+
+ if ( (esm_cause == ESM_CAUSE_SUCCESS) ||
+ (esm_cause == ESM_CAUSE_PTI_ALREADY_IN_USE) ) {
+ /* Return accept message */
+ rc = esm_send_activate_default_eps_bearer_context_accept(ebi,
+ &esm_msg.activate_default_eps_bearer_context_accept);
+ /* Setup the callback function used to send activate default
+ * EPS bearer context accept message onto the network */
+ esm_procedure = esm_proc_default_eps_bearer_context_accept;
+
+ if (esm_cause == ESM_CAUSE_PTI_ALREADY_IN_USE) {
+ /* 3GPP TS 24.301, section 7.3.1, case g
+ * Return accept message, even to network retransmission
+ * of already accepted activate default EPS bearer context
+ * request message
+ */
+ is_discarded = TRUE;
+ }
+ } else {
+ /* Return reject message */
+ rc = esm_send_activate_default_eps_bearer_context_reject(ebi,
+ &esm_msg.activate_default_eps_bearer_context_reject,
+ esm_cause);
+ /* Setup the callback function used to send activate default
+ * EPS bearer context reject message onto the network */
+ esm_procedure = esm_proc_default_eps_bearer_context_reject;
+ }
+
+ break;
+
+ case ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST:
+ /*
+ * Process activate dedicated EPS bearer context request message
+ * received from the MME
+ */
+ esm_cause = esm_recv_activate_dedicated_eps_bearer_context_request(
+ pti, ebi,
+ &esm_msg.activate_dedicated_eps_bearer_context_request);
+
+ if ( (esm_cause == ESM_CAUSE_SUCCESS) ||
+ (esm_cause == ESM_CAUSE_PTI_ALREADY_IN_USE) ) {
+ /* Return accept message */
+ rc = esm_send_activate_dedicated_eps_bearer_context_accept(ebi,
+ &esm_msg.activate_dedicated_eps_bearer_context_accept);
+ /* Setup the callback function used to send activate dedicated
+ * EPS bearer context accept message onto the network */
+ esm_procedure = esm_proc_dedicated_eps_bearer_context_accept;
+
+ if (esm_cause == ESM_CAUSE_PTI_ALREADY_IN_USE) {
+ /* 3GPP TS 24.301, section 7.3.1, case i
+ * Return accept message, even to network retransmission
+ * of already accepted activate dedicated EPS bearer context
+ * request message
+ */
+ is_discarded = TRUE;
+ }
+ } else {
+ /* Return reject message */
+ rc = esm_send_activate_dedicated_eps_bearer_context_reject(ebi,
+ &esm_msg.activate_dedicated_eps_bearer_context_reject,
+ esm_cause);
+ /* Setup the callback function used to send activate dedicated
+ * EPS bearer context reject message onto the network */
+ esm_procedure = esm_proc_dedicated_eps_bearer_context_reject;
+ }
+
+ break;
+
+ case MODIFY_EPS_BEARER_CONTEXT_REQUEST:
+ break;
+
+ case DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST:
+ /*
+ * Process deactivate EPS bearer context request message
+ * received from the MME
+ */
+ esm_cause = esm_recv_deactivate_eps_bearer_context_request(pti, ebi,
+ &esm_msg.deactivate_eps_bearer_context_request);
+
+ if ( (esm_cause == ESM_CAUSE_INVALID_PTI_VALUE) ||
+ (esm_cause == ESM_CAUSE_PTI_MISMATCH) ) {
+ /* 3GPP TS 24.301, section 7.3.1, case m
+ * Ignore deactivate EPS bearer context request message
+ * received with PTI reserved value, or assigned value
+ * that does not match any PTI in use
+ */
+ is_discarded = TRUE;
+ } else if ( (esm_cause == ESM_CAUSE_SUCCESS) ||
+ (esm_cause == ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY) ) {
+ /* Return accept message */
+ rc = esm_send_deactivate_eps_bearer_context_accept(ebi,
+ &esm_msg.deactivate_eps_bearer_context_accept);
+ /* Setup the callback function used to send deactivate
+ * EPS bearer context accept message onto the network */
+ esm_procedure = esm_proc_eps_bearer_context_deactivate_accept;
+
+ if (esm_cause == ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY) {
+ /* 3GPP TS 24.301, section 7.3.2, case j
+ * Respond with a deactivate EPS bearer context accept
+ * message with the EPS bearer identity set to the received
+ * EPS bearer identity
+ */
+ is_discarded = TRUE;
+ }
+ }
+
+ break;
+
+ case PDN_CONNECTIVITY_REJECT:
+ /*
+ * Process PDN connectivity reject message received from the MME
+ */
+ esm_cause = esm_recv_pdn_connectivity_reject(pti, ebi,
+ &esm_msg.pdn_connectivity_reject);
+
+ if ( (esm_cause == ESM_CAUSE_INVALID_PTI_VALUE) ||
+ (esm_cause == ESM_CAUSE_PTI_MISMATCH) ||
+ (esm_cause == ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY) ) {
+ /* 3GPP TS 24.301, section 7.3.1, case a
+ * Ignore PDN connectivity reject message received with
+ * reserved or unassigned PTI value, or assigned value that
+ * does not match any PTI in use
+ * 3GPP TS 24.301, section 7.3.2, case a
+ * Ignore PDN connectivity reject message received with
+ * reserved or unassigned EPS bearer identity value
+ */
+ is_discarded = TRUE;
+ }
+
+ break;
+
+ case PDN_DISCONNECT_REJECT:
+ /*
+ * Process PDN disconnect reject message received from the MME
+ */
+ esm_cause = esm_recv_pdn_disconnect_reject(pti, ebi,
+ &esm_msg.pdn_disconnect_reject);
+
+ if ( (esm_cause == ESM_CAUSE_INVALID_PTI_VALUE) ||
+ (esm_cause == ESM_CAUSE_PTI_MISMATCH) ||
+ (esm_cause == ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY) ) {
+ /* 3GPP TS 24.301, section 7.3.1, case b
+ * Ignore PDN disconnect reject message received with
+ * reserved or unassigned PTI value, or assigned value that
+ * does not match any PTI in use
+ * 3GPP TS 24.301, section 7.3.2, case b
+ * Ignore PDN disconnect reject message received with
+ * reserved or unassigned EPS bearer identity value
+ */
+ is_discarded = TRUE;
+ }
+
+ break;
+
+ case BEARER_RESOURCE_ALLOCATION_REJECT:
+ break;
+
+ case BEARER_RESOURCE_MODIFICATION_REJECT:
+ break;
+
+ case ESM_INFORMATION_REQUEST:
+ break;
+
+ case ESM_STATUS:
+ /*
+ * Process received ESM status message
+ */
+ esm_cause = esm_recv_status(pti, ebi, &esm_msg.esm_status);
+ break;
+
+ default:
+ LOG_TRACE(WARNING, "ESM-SAP - Received unexpected ESM message "
+ "0x%x", esm_msg.header.message_type);
+ esm_cause = ESM_CAUSE_MESSAGE_TYPE_NOT_IMPLEMENTED;
+ break;
+ }
+
+ if ( (esm_cause != ESM_CAUSE_SUCCESS) && (esm_procedure == NULL) ) {
+ /* ESM message processing failed */
+ if (!is_discarded) {
+ /* 3GPP TS 24.301, section 7.1
+ * Handling of unknown, unforeseen, and erroneous protocol data */
+ LOG_TRACE(WARNING, "ESM-SAP - Received ESM message is not valid "
+ "(cause=%d)", esm_cause);
+ /* Return an ESM status message */
+ rc = esm_send_status(pti, ebi, &esm_msg.esm_status, esm_cause);
+ /* Setup the callback function used to send ESM status message
+ * onto the network */
+ esm_procedure = esm_proc_status;
+ /* Discard received ESM message */
+ is_discarded = TRUE;
+ }
+ } else {
+ /* ESM message processing succeed */
+ *err = ESM_SAP_SUCCESS;
+ rc = RETURNok;
+ }
+
+ if ( (rc != RETURNerror) && (esm_procedure != NULL) ) {
+ /* Encode the returned ESM response message */
+ int size = esm_msg_encode(&esm_msg, (uint8_t *)_esm_sap_buffer,
+ ESM_SAP_BUFFER_SIZE);
+
+ if (size > 0) {
+ rsp->length = size;
+ rsp->value = (uint8_t *)(_esm_sap_buffer);
+ }
+
+ /* Complete the relevant ESM procedure */
+ rc = (*esm_procedure)(is_standalone, ebi, rsp, triggered_by_ue);
+
+ if (is_discarded) {
+ /* Return indication that received message has been discarded */
+ *err = ESM_SAP_DISCARDED;
+ } else if (rc != RETURNok) {
+ /* Return indication that ESM procedure failed */
+ *err = ESM_SAP_FAILED;
+ }
+ } else if (is_discarded) {
+ LOG_TRACE(WARNING, "ESM-SAP - Silently discard message type 0x%x",
+ esm_msg.header.message_type);
+ /* Return indication that received message has been discarded */
+ *err = ESM_SAP_DISCARDED;
+ rc = RETURNok;
+ }
+
+ LOG_FUNC_RETURN(rc);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: _esm_sap_send() **
+ ** **
+ ** Description: Processes ESM messages to send onto the network: Encoded **
+ ** the message and execute the relevant ESM procedure. **
+ ** **
+ ** Inputs: msg_type: Type of the ESM message to be sent **
+ ** is_standalone: Indicates whether the ESM message has to **
+ ** be sent standalone or together within EMM **
+ ** attach related message **
+ ** ueid: UE identifier within the MME **
+ ** pti: Procedure transaction identity **
+ ** ebi: EPS bearer identity **
+ ** data: Data required to build the message **
+ ** Others: None **
+ ** **
+ ** Outputs: rsp: The encoded ESM response message to be re- **
+ ** turned upon ESM procedure completion **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: _esm_sap_buffer **
+ ** **
+ ***************************************************************************/
+static int _esm_sap_send(int msg_type, int is_standalone,
+ int pti, int ebi, const esm_sap_data_t *data,
+ OctetString *rsp)
+{
+ LOG_FUNC_IN;
+
+ esm_proc_procedure_t esm_procedure = NULL;
+ int rc = RETURNok;
+
+ /* Indicate whether the message is sent by the UE or the MME */
+ int sent_by_ue = TRUE;
+
+ ESM_msg esm_msg;
+ memset(&esm_msg, 0 , sizeof(ESM_msg));
+
+ /* Process the ESM message to send */
+ switch (msg_type) {
+
+ case ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT:
+ break;
+
+ case ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT:
+ break;
+
+ case ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT:
+ break;
+
+ case ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT:
+ break;
+
+ case MODIFY_EPS_BEARER_CONTEXT_ACCEPT:
+ break;
+
+ case MODIFY_EPS_BEARER_CONTEXT_REJECT:
+ break;
+
+ case DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT:
+ break;
+
+ case PDN_CONNECTIVITY_REQUEST: {
+ /*
+ * Process PDN connectivity request message to send to the MME
+ */
+ const esm_pdn_connectivity_t *msg = &data->pdn_connect;
+ rc = esm_send_pdn_connectivity_request(pti, msg->is_emergency,
+ msg->pdn_type, msg->apn,
+ &esm_msg.pdn_connectivity_request);
+ /* Setup callback function used to send PDN connectivity request
+ * message onto the network */
+ esm_procedure = esm_proc_pdn_connectivity_request;
+ break;
+ }
+
+ case PDN_DISCONNECT_REQUEST:
+ /*
+ * Process PDN disconnect request message to send to the MME
+ */
+ rc = esm_send_pdn_disconnect_request(pti, ebi,
+ &esm_msg.pdn_disconnect_request);
+ /* Setup callback function used to send PDN disconnect request
+ * message onto the network */
+ esm_procedure = esm_proc_pdn_disconnect_request;
+ break;
+
+ case BEARER_RESOURCE_ALLOCATION_REQUEST:
+ break;
+
+ case BEARER_RESOURCE_MODIFICATION_REQUEST:
+ break;
+
+ default:
+ LOG_TRACE(WARNING, "ESM-SAP - Send unexpected ESM message 0x%x",
+ msg_type);
+ break;
+ }
+
+ if (rc != RETURNerror) {
+ /* Encode the returned ESM response message */
+ int size = esm_msg_encode(&esm_msg, (uint8_t *)_esm_sap_buffer,
+ ESM_SAP_BUFFER_SIZE);
+
+ if (size > 0) {
+ rsp->length = size;
+ rsp->value = (uint8_t *)(_esm_sap_buffer);
+ }
+
+ /* Execute the relevant ESM procedure */
+ if (esm_procedure) {
+ rc = (*esm_procedure)(is_standalone, pti, rsp, sent_by_ue);
+ }
+ }
+
+ LOG_FUNC_RETURN(rc);
+}
+
diff --git a/openair-cn/NAS/UE/ESM/SAP/esm_sap.h b/openair-cn/NAS/UE/ESM/SAP/esm_sap.h
new file mode 100755
index 0000000000..c2d900a4ae
--- /dev/null
+++ b/openair-cn/NAS/UE/ESM/SAP/esm_sap.h
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+Source esm_sap.h
+
+Version 0.1
+
+Date 2012/11/22
+
+Product NAS stack
+
+Subsystem EPS Session Management
+
+Author Frederic Maurel
+
+Description Defines the ESM Service Access Points at which the EPS
+ Session Management sublayer provides procedures for the
+ EPS bearer context handling and resources allocation.
+
+*****************************************************************************/
+#ifndef __ESM_SAP_H__
+#define __ESM_SAP_H__
+
+#include "esm_sapDef.h"
+
+/****************************************************************************/
+/********************* G L O B A L C O N S T A N T S *******************/
+/****************************************************************************/
+
+/****************************************************************************/
+/************************ G L O B A L T Y P E S ************************/
+/****************************************************************************/
+
+/****************************************************************************/
+/******************** G L O B A L V A R I A B L E S ********************/
+/****************************************************************************/
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+void esm_sap_initialize(void);
+
+int esm_sap_send(esm_sap_t *msg);
+
+#endif /* __ESM_SAP_H__*/
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/sap/esm_sapDef.h b/openair-cn/NAS/UE/ESM/SAP/esm_sapDef.h
old mode 100644
new mode 100755
similarity index 91%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/sap/esm_sapDef.h
rename to openair-cn/NAS/UE/ESM/SAP/esm_sapDef.h
index e77cf15da7..e36d1faed5
--- a/openair-cn/NAS/EURECOM-NAS/src/esm/sap/esm_sapDef.h
+++ b/openair-cn/NAS/UE/ESM/SAP/esm_sapDef.h
@@ -59,7 +59,7 @@ Description Defines the ESM Service Access Point that provides EPS
* EPS Session Management primitives
* ---------------------------------
*/
-typedef enum {
+typedef enum esm_primitive_s {
ESM_START = 0,
/* Procedures related to EPS bearer contexts (initiated by the network) */
ESM_DEFAULT_EPS_BEARER_CONTEXT_ACTIVATE_REQ,
@@ -107,14 +107,14 @@ typedef enum {
* ESM primitive for activate EPS default bearer context procedure
* ---------------------------------------------------------------
*/
-typedef struct {
+typedef struct esm_activate_eps_default_bearer_context_s {
} esm_activate_eps_default_bearer_context_t;
/*
* ESM primitive for PDN connectivity procedure
* --------------------------------------------
*/
-typedef struct {
+typedef struct esm_pdn_connectivity_s {
int cid; /* PDN connection local identifier */
int is_defined; /* Indicates whether a PDN context has been defined
* for the specified APN */
@@ -129,7 +129,7 @@ typedef struct {
* ESM primitive for PDN disconnect procedure
* ------------------------------------------
*/
-typedef struct {
+typedef struct esm_pdn_disconnect_s {
int cid; /* PDN connection local identifier */
} esm_pdn_disconnect_t;
@@ -137,7 +137,7 @@ typedef struct {
* ESM primitive for deactivate EPS bearer context procedure
* ---------------------------------------------------------
*/
-typedef struct {
+typedef struct esm_eps_bearer_context_deactivate_s {
#define ESM_SAP_ALL_EBI 0xff
unsigned int ebi; /* EPS bearer identity of the EPS bearer context
* to be deactivated */
@@ -154,20 +154,17 @@ typedef union {
esm_eps_bearer_context_deactivate_t eps_bearer_context_deactivate;
} esm_sap_data_t;
-typedef struct {
+typedef struct esm_sap_s {
esm_primitive_t primitive; /* ESM-SAP primitive to process */
int is_standalone; /* Indicates whether the ESM message handled
* within this primitive has to be sent/received
* standalone or together within an EMM related
* message */
-#if defined(NAS_MME)
- emm_data_context_t *ctx; /* UE context */
-#endif
- unsigned int ueid; /* Local UE identifier */
- esm_sap_error_t err; /* ESM-SAP error code */
- const OctetString *recv; /* Encoded ESM message received */
- OctetString send; /* Encoded ESM message to be sent */
- esm_sap_data_t data; /* ESM message data parameters */
+ unsigned int ueid; /* Local UE identifier */
+ esm_sap_error_t err; /* ESM-SAP error code */
+ const OctetString *recv; /* Encoded ESM message received */
+ OctetString send; /* Encoded ESM message to be sent */
+ esm_sap_data_t data; /* ESM message data parameters */
} esm_sap_t;
/****************************************************************************/
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/sap/esm_send.c b/openair-cn/NAS/UE/ESM/SAP/esm_send.c
old mode 100644
new mode 100755
similarity index 59%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/sap/esm_send.c
rename to openair-cn/NAS/UE/ESM/SAP/esm_send.c
index c7f58eaf52..c5de9958ca
--- a/openair-cn/NAS/EURECOM-NAS/src/esm/sap/esm_send.c
+++ b/openair-cn/NAS/UE/ESM/SAP/esm_send.c
@@ -49,9 +49,7 @@ Description Defines functions executed at the ESM Service Access
#include "commonDef.h"
#include "nas_log.h"
-#ifdef NAS_UE
#include "networkDef.h"
-#endif
#include "esm_msgDef.h"
#include "esm_cause.h"
@@ -119,7 +117,6 @@ int esm_send_status(int pti, int ebi, esm_status_msg *msg, int esm_cause)
* Functions executed by the UE to send ESM message to the network
* --------------------------------------------------------------------------
*/
-#ifdef NAS_UE
/****************************************************************************
** **
** Name: esm_send_pdn_connectivity_request() **
@@ -436,311 +433,7 @@ int esm_send_deactivate_eps_bearer_context_accept(int ebi,
LOG_FUNC_RETURN(RETURNok);
}
-#endif // NAS_UE
-/*
- * --------------------------------------------------------------------------
- * Functions executed by the MME to send ESM message to the UE
- * --------------------------------------------------------------------------
- */
-#ifdef NAS_MME
-/****************************************************************************
- ** **
- ** Name: esm_send_pdn_connectivity_reject() **
- ** **
- ** Description: Builds PDN Connectivity Reject message **
- ** **
- ** The PDN connectivity reject message is sent by the net- **
- ** work to the UE to reject establishment of a PDN connec- **
- ** tion. **
- ** **
- ** Inputs: pti: Procedure transaction identity **
- ** esm_cause: ESM cause code **
- ** Others: None **
- ** **
- ** Outputs: msg: The ESM message to be sent **
- ** Return: RETURNok, RETURNerror **
- ** Others: None **
- ** **
- ***************************************************************************/
-int esm_send_pdn_connectivity_reject(int pti, pdn_connectivity_reject_msg *msg,
- int esm_cause)
-{
- LOG_FUNC_IN;
-
- /* Mandatory - ESM message header */
- msg->protocoldiscriminator = EPS_SESSION_MANAGEMENT_MESSAGE;
- msg->epsbeareridentity = EPS_BEARER_IDENTITY_UNASSIGNED;
- msg->messagetype = PDN_CONNECTIVITY_REJECT;
- msg->proceduretransactionidentity = pti;
-
- /* Mandatory - ESM cause code */
- msg->esmcause = esm_cause;
- /* Optional IEs */
- msg->presencemask = 0;
-
- LOG_TRACE(INFO, "ESM-SAP - Send PDN Connectivity Reject message "
- "(pti=%d, ebi=%d)",
- msg->proceduretransactionidentity, msg->epsbeareridentity);
-
- LOG_FUNC_RETURN(RETURNok);
-}
-
-/****************************************************************************
- ** **
- ** Name: esm_send_pdn_disconnect_reject() **
- ** **
- ** Description: Builds PDN Disconnect Reject message **
- ** **
- ** The PDN disconnect reject message is sent by the network **
- ** to the UE to reject release of a PDN connection. **
- ** **
- ** Inputs: pti: Procedure transaction identity **
- ** esm_cause: ESM cause code **
- ** Others: None **
- ** **
- ** Outputs: msg: The ESM message to be sent **
- ** Return: RETURNok, RETURNerror **
- ** Others: None **
- ** **
- ***************************************************************************/
-int esm_send_pdn_disconnect_reject(int pti, pdn_disconnect_reject_msg *msg,
- int esm_cause)
-{
- LOG_FUNC_IN;
-
- /* Mandatory - ESM message header */
- msg->protocoldiscriminator = EPS_SESSION_MANAGEMENT_MESSAGE;
- msg->epsbeareridentity = EPS_BEARER_IDENTITY_UNASSIGNED;
- msg->messagetype = PDN_DISCONNECT_REJECT;
- msg->proceduretransactionidentity = pti;
-
- /* Mandatory - ESM cause code */
- msg->esmcause = esm_cause;
- /* Optional IEs */
- msg->presencemask = 0;
-
- LOG_TRACE(INFO, "ESM-SAP - Send PDN Disconnect Reject message "
- "(pti=%d, ebi=%d)",
- msg->proceduretransactionidentity, msg->epsbeareridentity);
-
- LOG_FUNC_RETURN(RETURNok);
-}
-
-/****************************************************************************
- ** **
- ** Name: esm_send_activate_default_eps_bearer_context_request() **
- ** **
- ** Description: Builds Activate Default EPS Bearer Context Request **
- ** message **
- ** **
- ** The activate default EPS bearer context request message **
- ** is sent by the network to the UE to request activation of **
- ** a default EPS bearer context. **
- ** **
- ** Inputs: pti: Procedure transaction identity **
- ** ebi: EPS bearer identity **
- ** qos: Subscribed EPS quality of service **
- ** apn: Access Point Name in used **
- ** pdn_addr: PDN IPv4 address and/or IPv6 suffix **
- ** esm_cause: ESM cause code **
- ** Others: None **
- ** **
- ** Outputs: msg: The ESM message to be sent **
- ** Return: RETURNok, RETURNerror **
- ** Others: None **
- ** **
- ***************************************************************************/
-int esm_send_activate_default_eps_bearer_context_request(int pti,
- int ebi,
- activate_default_eps_bearer_context_request_msg *msg,
- const OctetString *apn,
- int pdn_type,
- const OctetString *pdn_addr,
- const EpsQualityOfService *qos,
- int esm_cause)
-{
- LOG_FUNC_IN;
-
- /* Mandatory - ESM message header */
- msg->protocoldiscriminator = EPS_SESSION_MANAGEMENT_MESSAGE;
- msg->epsbeareridentity = ebi;
- msg->messagetype = ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST;
- msg->proceduretransactionidentity = pti;
-
- /* Mandatory - EPS QoS */
- msg->epsqos = *qos;
- LOG_TRACE(INFO, "ESM-SAP - epsqos qci: %u", qos->qci);
-
- if (qos->bitRatesPresent) {
- LOG_TRACE(INFO, "ESM-SAP - epsqos maxBitRateForUL: %u", qos->bitRates.maxBitRateForUL);
- LOG_TRACE(INFO, "ESM-SAP - epsqos maxBitRateForDL: %u", qos->bitRates.maxBitRateForDL);
- LOG_TRACE(INFO, "ESM-SAP - epsqos guarBitRateForUL: %u", qos->bitRates.guarBitRateForUL);
- LOG_TRACE(INFO, "ESM-SAP - epsqos guarBitRateForDL: %u", qos->bitRates.guarBitRateForDL);
- } else {
- LOG_TRACE(INFO, "ESM-SAP - epsqos no bit rates defined");
- }
-
- if (qos->bitRatesExtPresent) {
- LOG_TRACE(INFO, "ESM-SAP - epsqos maxBitRateForUL Ext: %u", qos->bitRatesExt.maxBitRateForUL);
- LOG_TRACE(INFO, "ESM-SAP - epsqos maxBitRateForDL Ext: %u", qos->bitRatesExt.maxBitRateForDL);
- LOG_TRACE(INFO, "ESM-SAP - epsqos guarBitRateForUL Ext: %u", qos->bitRatesExt.guarBitRateForUL);
- LOG_TRACE(INFO, "ESM-SAP - epsqos guarBitRateForDL Ext: %u", qos->bitRatesExt.guarBitRateForDL);
- } else {
- LOG_TRACE(INFO, "ESM-SAP - epsqos no bit rates ext defined");
- }
-
-
- if ((apn == NULL) || ((apn != NULL) && (apn->value == NULL))) {
- LOG_TRACE(WARNING, "ESM-SAP - apn is NULL!");
- }
-
- LOG_TRACE(INFO, "ESM-SAP - apn is %s", apn->value);
-
- /* Mandatory - Access Point Name */
- msg->accesspointname.accesspointnamevalue = *apn;
-
- /* Mandatory - PDN address */
- LOG_TRACE(INFO, "ESM-SAP - pdn_type is %u", pdn_type);
- msg->pdnaddress.pdntypevalue = pdn_type;
- LOG_TRACE(INFO, "ESM-SAP - pdn_addr is %u", dump_octet_string(pdn_addr));
- msg->pdnaddress.pdnaddressinformation = *pdn_addr;
-
- /* Optional - ESM cause code */
- msg->presencemask = 0;
-
- if (esm_cause != ESM_CAUSE_SUCCESS) {
- msg->presencemask |=
- ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_ESM_CAUSE_PRESENT;
- msg->esmcause = esm_cause;
- }
-
-#warning "TEST LG FORCE APN-AMBR"
- LOG_TRACE(INFO, "ESM-SAP - FORCE APN-AMBR");
- msg->presencemask |=
- ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_APNAMBR_PRESENT;
- msg->apnambr.apnambrfordownlink = 0xfe; // (8640kbps)
- msg->apnambr.apnambrforuplink = 0xfe; // (8640kbps)
- msg->apnambr.apnambrfordownlink_extended = 0xde; // (200Mbps)
- msg->apnambr.apnambrforuplink_extended = 0x9e; // (100Mbps)
- msg->apnambr.apnambrfordownlink_extended2 = 0;
- msg->apnambr.apnambrforuplink_extended2 = 0;
- msg->apnambr.extensions = 0 | APN_AGGREGATE_MAXIMUM_BIT_RATE_MAXIMUM_EXTENSION_PRESENT;
-
- LOG_TRACE(INFO, "ESM-SAP - Send Activate Default EPS Bearer Context "
- "Request message (pti=%d, ebi=%d)",
- msg->proceduretransactionidentity, msg->epsbeareridentity);
-
- LOG_FUNC_RETURN(RETURNok);
-}
-
-/****************************************************************************
- ** **
- ** Name: esm_send_activate_dedicated_eps_bearer_context_request() **
- ** **
- ** Description: Builds Activate Dedicated EPS Bearer Context Request **
- ** message **
- ** **
- ** The activate dedicated EPS bearer context request message **
- ** is sent by the network to the UE to request activation of **
- ** a dedicated EPS bearer context associated with the same **
- ** PDN address(es) and APN as an already active default EPS **
- ** bearer context. **
- ** **
- ** Inputs: pti: Procedure transaction identity **
- ** ebi: EPS bearer identity **
- ** linked_ebi: EPS bearer identity of the default bearer **
- ** associated with the EPS dedicated bearer **
- ** to be activated **
- ** qos: EPS quality of service **
- ** tft: Traffic flow template **
- ** Others: None **
- ** **
- ** Outputs: msg: The ESM message to be sent **
- ** Return: RETURNok, RETURNerror **
- ** Others: None **
- ** **
- ***************************************************************************/
-int esm_send_activate_dedicated_eps_bearer_context_request(int pti, int ebi,
- activate_dedicated_eps_bearer_context_request_msg *msg,
- int linked_ebi, const EpsQualityOfService *qos,
- PacketFilters *pkfs, int n_pkfs)
-{
- int i;
- LOG_FUNC_IN;
-
- /* Mandatory - ESM message header */
- msg->protocoldiscriminator = EPS_SESSION_MANAGEMENT_MESSAGE;
- msg->epsbeareridentity = ebi;
- msg->messagetype = ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST;
- msg->proceduretransactionidentity = pti;
-
- /* Mandatory - EPS QoS */
- msg->epsqos = *qos;
-
- /* Mandatory - traffic flow template */
- msg->tft.tftoperationcode = TRAFFIC_FLOW_TEMPLATE_OPCODE_CREATE;
- msg->tft.ebit = TRAFFIC_FLOW_TEMPLATE_PARAMETER_LIST_IS_NOT_INCLUDED;
- msg->tft.numberofpacketfilters = n_pkfs;
-
- for (i = 0; i < msg->tft.numberofpacketfilters; i++) {
- msg->tft.packetfilterlist.createtft[i] = (*pkfs)[i];
- }
-
- /* Optional */
- msg->presencemask = 0;
-
- LOG_TRACE(INFO, "ESM-SAP - Send Activate Dedicated EPS Bearer Context "
- "Request message (pti=%d, ebi=%d)",
- msg->proceduretransactionidentity, msg->epsbeareridentity);
-
- LOG_FUNC_RETURN(RETURNok);
-}
-
-/****************************************************************************
- ** **
- ** Name: esm_send_deactivate_eps_bearer_context_request() **
- ** **
- ** Description: Builds Deactivate EPS Bearer Context Request message **
- ** **
- ** The deactivate EPS bearer context request message is sent **
- ** by the network to request deactivation of an active EPS **
- ** bearer context. **
- ** **
- ** Inputs: pti: Procedure transaction identity **
- ** ebi: EPS bearer identity **
- ** esm_cause: ESM cause code **
- ** Others: None **
- ** **
- ** Outputs: msg: The ESM message to be sent **
- ** Return: RETURNok, RETURNerror **
- ** Others: None **
- ** **
- ***************************************************************************/
-int esm_send_deactivate_eps_bearer_context_request(int pti, int ebi,
- deactivate_eps_bearer_context_request_msg *msg,
- int esm_cause)
-{
- LOG_FUNC_IN;
-
- /* Mandatory - ESM message header */
- msg->protocoldiscriminator = EPS_SESSION_MANAGEMENT_MESSAGE;
- msg->epsbeareridentity = ebi;
- msg->messagetype = DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST;
- msg->proceduretransactionidentity = pti;
-
- /* Mandatory - ESM cause code */
- msg->esmcause = esm_cause;
- /* Optional IEs */
- msg->presencemask = 0;
-
- LOG_TRACE(INFO, "ESM-SAP - Send Deactivate EPS Bearer Context Request "
- "message (pti=%d, ebi=%d)",
- msg->proceduretransactionidentity, msg->epsbeareridentity);
-
- LOG_FUNC_RETURN(RETURNok);
-}
-#endif // NAS_MME
/****************************************************************************/
/********************* L O C A L F U N C T I O N S *********************/
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/sap/esm_send.h b/openair-cn/NAS/UE/ESM/SAP/esm_send.h
old mode 100644
new mode 100755
similarity index 73%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/sap/esm_send.h
rename to openair-cn/NAS/UE/ESM/SAP/esm_send.h
index 87abe596d8..4e261300c5
--- a/openair-cn/NAS/EURECOM-NAS/src/esm/sap/esm_send.h
+++ b/openair-cn/NAS/UE/ESM/SAP/esm_send.h
@@ -49,21 +49,7 @@ Description Defines functions executed at the ESM Service Access
#include "EsmStatus.h"
-#ifdef NAS_MME
-#include "PdnConnectivityReject.h"
-#include "PdnDisconnectReject.h"
-#include "BearerResourceAllocationReject.h"
-#include "BearerResourceModificationReject.h"
-#include "ActivateDefaultEpsBearerContextRequest.h"
-#include "ActivateDedicatedEpsBearerContextRequest.h"
-#include "ModifyEpsBearerContextRequest.h"
-#include "DeactivateEpsBearerContextRequest.h"
-
-#include "EsmInformationRequest.h"
-#endif
-
-#ifdef NAS_UE
#include "PdnConnectivityRequest.h"
#include "PdnDisconnectRequest.h"
#include "BearerResourceAllocationRequest.h"
@@ -78,7 +64,6 @@ Description Defines functions executed at the ESM Service Access
#include "DeactivateEpsBearerContextAccept.h"
#include "EsmInformationResponse.h"
-#endif
/****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/
@@ -108,7 +93,6 @@ int esm_send_status(int pti, int ebi, esm_status_msg *msg, int esm_cause);
* Functions executed by the UE to send ESM message to the network
* --------------------------------------------------------------------------
*/
-#ifdef NAS_UE
/*
* Transaction related messages
* ----------------------------
@@ -135,40 +119,5 @@ int esm_send_activate_dedicated_eps_bearer_context_reject(int ebi,
int esm_send_deactivate_eps_bearer_context_accept(int ebi,
deactivate_eps_bearer_context_accept_msg *msg);
-#endif
-
-/*
- * --------------------------------------------------------------------------
- * Functions executed by the MME to send ESM message to the UE
- * --------------------------------------------------------------------------
- */
-#ifdef NAS_MME
-/*
- * Transaction related messages
- * ----------------------------
- */
-int esm_send_pdn_connectivity_reject(int pti, pdn_connectivity_reject_msg *msg,
- int esm_cause);
-
-int esm_send_pdn_disconnect_reject(int pti, pdn_disconnect_reject_msg *msg,
- int esm_cause);
-
-/*
- * Messages related to EPS bearer contexts
- * ---------------------------------------
- */
-int esm_send_activate_default_eps_bearer_context_request(int pti, int ebi,
- activate_default_eps_bearer_context_request_msg *msg, const OctetString *apn,
- int pdn_type, const OctetString *pdn_addr, const EpsQualityOfService *qos,
- int esm_cause);
-
-int esm_send_activate_dedicated_eps_bearer_context_request(int pti, int ebi,
- activate_dedicated_eps_bearer_context_request_msg *msg, int linked_ebi,
- const EpsQualityOfService *qos, PacketFilters *pkfs, int n_pkfs);
-
-int esm_send_deactivate_eps_bearer_context_request(int pti, int ebi,
- deactivate_eps_bearer_context_request_msg *msg, int esm_cause);
-
-#endif
#endif /* __ESM_SEND_H__*/
diff --git a/openair-cn/NAS/UE/ESM/esmData.h b/openair-cn/NAS/UE/ESM/esmData.h
new file mode 100755
index 0000000000..9726e83e8a
--- /dev/null
+++ b/openair-cn/NAS/UE/ESM/esmData.h
@@ -0,0 +1,218 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+Source esmData.h
+
+Version 0.1
+
+Date 2012/12/04
+
+Product NAS stack
+
+Subsystem EPS Session Management
+
+Author Frederic Maurel
+
+Description Defines internal private data handled by EPS Session
+ Management sublayer.
+
+*****************************************************************************/
+#include // sprintf
+
+#include "networkDef.h"
+#include "OctetString.h"
+#include "EpsBearerIdentity.h"
+
+
+#ifndef __ESMDATA_H__
+#define __ESMDATA_H__
+
+/****************************************************************************/
+/********************* G L O B A L C O N S T A N T S *******************/
+/****************************************************************************/
+
+/* Total number of active EPS bearers */
+#define ESM_DATA_EPS_BEARER_TOTAL 11
+
+/****************************************************************************/
+/************************ G L O B A L T Y P E S ************************/
+/****************************************************************************/
+
+/*
+ * Minimal and maximal value of an EPS bearer identity:
+ * The EPS Bearer Identity (EBI) identifies a message flow
+ */
+#define ESM_EBI_MIN (EPS_BEARER_IDENTITY_FIRST)
+#define ESM_EBI_MAX (EPS_BEARER_IDENTITY_LAST)
+
+/* EPS bearer context states */
+typedef enum {
+ ESM_EBR_INACTIVE, /* No EPS bearer context exists */
+ ESM_EBR_ACTIVE, /* The EPS bearer context is active,
+ * in the UE, in the network */
+ ESM_EBR_STATE_MAX
+} esm_ebr_state;
+
+
+
+/*
+ * -----------------------
+ * EPS bearer context data
+ * -----------------------
+ */
+typedef struct esm_ebr_context_s {
+ unsigned char ebi; /* EPS bearer identity */
+ esm_ebr_state status; /* EPS bearer context status */
+ int is_default_ebr; /* TRUE if the bearer context is associated
+ * to a default EPS bearer */
+ char cid; /* Identifier of the PDN context the EPS
+ * bearer context has been assigned to */
+} esm_ebr_context_t;
+
+typedef struct esm_ebr_data_s {
+ unsigned char index; /* Index of the next EPS bearer context
+ * identity to be used */
+#define ESM_EBR_DATA_SIZE (ESM_EBI_MAX - ESM_EBI_MIN + 1)
+ esm_ebr_context_t *context[ESM_EBR_DATA_SIZE + 1];
+} esm_ebr_data_t;
+
+/*
+ * --------------------------------------------------------------------------
+ * Structure of data handled by EPS Session Management sublayer in the UE
+ * and in the MME
+ * --------------------------------------------------------------------------
+ */
+
+/*
+ * Structure of an EPS bearer
+ * --------------------------
+ * An EPS bearer is a logical concept which applies to the connection
+ * between two endpoints (UE and PDN Gateway) with specific QoS attri-
+ * butes. An EPS bearer corresponds to one Quality of Service policy
+ * applied within the EPC and E-UTRAN.
+ */
+typedef struct esm_bearer_s {
+ int bid; /* Identifier of the EPS bearer */
+ unsigned int ebi; /* EPS bearer identity */
+ network_qos_t qos; /* EPS bearer level QoS parameters */
+ network_tft_t tft; /* Traffic Flow Template for packet filtering */
+} esm_bearer_t;
+
+/*
+ * Structure of a PDN connection
+ * -----------------------------
+ * A PDN connection is the association between a UE represented by
+ * one IPv4 address and/or one IPv6 prefix and a PDN represented by
+ * an Access Point Name (APN).
+ */
+typedef struct esm_pdn_s {
+ unsigned int pti; /* Identity of the procedure transaction executed
+ * to activate the PDN connection entry */
+ int is_emergency; /* Emergency bearer services indicator */
+ OctetString apn; /* Access Point Name currently in used */
+ int ambr; /* Aggregate Maximum Bit Rate of this APN */
+ int type; /* Address PDN type (IPv4, IPv6, IPv4v6) */
+#define ESM_DATA_IPV4_ADDRESS_SIZE 4
+#define ESM_DATA_IPV6_ADDRESS_SIZE 8
+#define ESM_DATA_IP_ADDRESS_SIZE (ESM_DATA_IPV4_ADDRESS_SIZE + \
+ ESM_DATA_IPV6_ADDRESS_SIZE)
+ /* IPv4 PDN address and/or IPv6 prefix */
+ char ip_addr[ESM_DATA_IP_ADDRESS_SIZE+1];
+ int addr_realloc; /* Indicates whether the UE is allowed to subsequently
+ * request another PDN connectivity to the same APN
+ * using an address PDN type (IPv4 or IPv6) other
+ * than the one already activated */
+ int n_bearers; /* Number of allocated EPS bearers;
+ * default EPS bearer is defined at index 0 */
+#define ESM_DATA_EPS_BEARER_MAX 4
+ esm_bearer_t *bearer[ESM_DATA_EPS_BEARER_MAX];
+} esm_pdn_t;
+
+/*
+ * Structure of the ESM data
+ * -------------------------
+ * The EPS Session Management sublayer handles data related to PDN
+ * connections and EPS bearers. Each active PDN connection has a de-
+ * fault EPS bearer. Several dedicated EPS bearers may exist within
+ * a PDN connection.
+ */
+typedef struct esm_data_context_s {
+ unsigned int ue_id;
+
+ int n_ebrs; /* Total number of active EPS bearer contexts */
+ int n_pdns; /* Number of active PDN connections */
+ int emergency; /* Indicates whether a PDN connection for emergency
+ * bearer services is established */
+#define ESM_DATA_PDN_MAX 4
+ struct {
+ int pid; /* Identifier of the PDN connection */
+ int is_active; /* TRUE/FALSE if the PDN connection is active/inactive
+ * or the process to activate/deactivate the PDN
+ * connection is in progress */
+ esm_pdn_t *data; /* Active PDN connection data */
+ } pdn[ESM_DATA_PDN_MAX+1];
+
+ esm_ebr_data_t ebr;
+} esm_data_context_t;
+
+/*
+ * --------------------------------------------------------------------------
+ * ESM internal data handled by EPS Session Management sublayer in the UE
+ * --------------------------------------------------------------------------
+ */
+/*
+ * Structure of the ESM data
+ * -------------------------
+ */
+typedef esm_data_context_t esm_data_t;
+
+
+/****************************************************************************/
+/******************** G L O B A L V A R I A B L E S ********************/
+/****************************************************************************/
+
+/*
+ * ESM internal data (used within ESM only)
+ * ----------------------------------------
+ */
+esm_data_t _esm_data;
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+extern char ip_addr_str[100];
+
+extern char *esm_data_get_ipv4_addr(const OctetString *ip_addr);
+
+extern char *esm_data_get_ipv6_addr(const OctetString *ip_addr);
+
+extern char *esm_data_get_ipv4v6_addr(const OctetString *ip_addr);
+
+#endif /* __ESMDATA_H__*/
diff --git a/openair-cn/NAS/UE/ESM/esm_ebr.c b/openair-cn/NAS/UE/ESM/esm_ebr.c
new file mode 100755
index 0000000000..d7a36cc6db
--- /dev/null
+++ b/openair-cn/NAS/UE/ESM/esm_ebr.c
@@ -0,0 +1,492 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+Source esm_ebr.c
+
+Version 0.1
+
+Date 2013/01/29
+
+Product NAS stack
+
+Subsystem EPS Session Management
+
+Author Frederic Maurel
+
+Description Defines functions used to handle state of EPS bearer contexts
+ and manage ESM messages re-transmission.
+
+*****************************************************************************/
+
+#include // malloc, free
+#include // memcpy
+
+#include "emmData.h"
+#include "esm_ebr.h"
+#include "commonDef.h"
+#include "nas_log.h"
+
+
+/****************************************************************************/
+/**************** E X T E R N A L D E F I N I T I O N S ****************/
+/****************************************************************************/
+
+#define ESM_EBR_NB_UE_MAX 1
+
+
+/****************************************************************************/
+/******************* L O C A L D E F I N I T I O N S *******************/
+/****************************************************************************/
+
+/* String representation of EPS bearer context status */
+static const char *_esm_ebr_state_str[ESM_EBR_STATE_MAX] = {
+ "BEARER CONTEXT INACTIVE",
+ "BEARER CONTEXT ACTIVE",
+};
+
+/*
+ * ----------------------------------
+ * List of EPS bearer contexts per UE
+ * ----------------------------------
+ */
+
+#if !defined(NAS_BUILT_IN_EPC)
+static esm_ebr_data_t _esm_ebr_data[ESM_EBR_NB_UE_MAX];
+#endif
+
+/*
+ * ----------------------
+ * User notification data
+ * ----------------------
+ */
+/* User notification callback executed whenever an EPS bearer context becomes
+ * active or inactive */
+static esm_indication_callback_t _esm_ebr_callback;
+/* PDN connection and EPS bearer status [NW/UE][Dedicated/Default][status] */
+static const network_pdn_state_t _esm_ebr_pdn_state[2][2][2] = {
+ /* Status modification triggerer by the network */
+ {
+ /* Dedicated EPS bearer */
+ {NET_PDN_NW_DEDICATED_DEACT, NET_PDN_NW_DEDICATED_ACT},
+ /* Default EPS bearer */
+ {NET_PDN_NW_DEFAULT_DEACT, 0}
+ },
+ /* Status modification triggered by the UE */
+ {
+ /* Dedicated EPS bearer */
+ {NET_PDN_MT_DEDICATED_DEACT, NET_PDN_MT_DEDICATED_ACT},
+ /* Default EPS bearer */
+ {NET_PDN_MT_DEFAULT_DEACT, NET_PDN_MT_DEFAULT_ACT}
+ }
+};
+
+/* Returns the index of the next available entry in the list of EPS bearer
+ * context data */
+
+static int _esm_ebr_get_available_entry(unsigned int ueid);
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+/****************************************************************************
+ ** **
+ ** Name: esm_ebr_initialize() **
+ ** **
+ ** Description: Initialize EPS bearer context data **
+ ** **
+ ** Inputs: cb: User notification callback **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: None **
+ ** Others: _esm_ebr_data **
+ ** **
+ ***************************************************************************/
+void esm_ebr_initialize(
+ esm_indication_callback_t cb
+)
+{
+#if !defined(NAS_BUILT_IN_EPC)
+ int ueid, i;
+
+ LOG_FUNC_IN;
+
+ for (ueid = 0; ueid < ESM_EBR_NB_UE_MAX; ueid++) {
+ _esm_ebr_data[ueid].index = 0;
+
+ /* Initialize EPS bearer context data */
+ for (i = 0; i < ESM_EBR_DATA_SIZE + 1; i++) {
+ _esm_ebr_data[ueid].context[i] = NULL;
+ }
+ }
+
+ /* Initialize the user notification callback */
+ _esm_ebr_callback = *cb;
+
+ LOG_FUNC_OUT;
+#endif
+}
+
+/****************************************************************************
+ ** **
+ ** Name: esm_ebr_assign() **
+ ** **
+ ** Description: Assigns a new EPS bearer context **
+ ** **
+ ** Inputs: ueid: Lower layers UE identifier **
+ ** ebi: Identity of the new EPS bearer context **
+ ** cid: Identifier of the PDN context the EPS bea- **
+ ** rer context is associated to **
+ ** default_ebr TRUE if the new bearer context is associa- **
+ ** ted to a default EPS bearer **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: The identity of the new EPS bearer context **
+ ** if successfully assigned; **
+ ** the not assigned EBI (0) otherwise. **
+ ** Others: _esm_ebr_data **
+ ** **
+ ***************************************************************************/
+int esm_ebr_assign(int ebi, int cid, int default_ebr)
+{
+ esm_ebr_context_t *ebr_ctx = NULL;
+ unsigned int ueid = 0;
+ int i;
+
+ LOG_FUNC_IN;
+
+ ebr_ctx = _esm_ebr_data[ueid].context[ebi - ESM_EBI_MIN];
+
+
+ if (ebi != ESM_EBI_UNASSIGNED) {
+ if ( (ebi < ESM_EBI_MIN) || (ebi > ESM_EBI_MAX) ) {
+ LOG_FUNC_RETURN (ESM_EBI_UNASSIGNED);
+ } else if (ebr_ctx != NULL) {
+ LOG_TRACE(WARNING, "ESM-FSM - EPS bearer context already "
+ "assigned (ebi=%d)", ebi);
+ LOG_FUNC_RETURN (ESM_EBI_UNASSIGNED);
+ }
+
+ /* The specified EPS bearer context is available */
+ i = ebi - ESM_EBI_MIN;
+ } else {
+ /* Search for an available EPS bearer identity */
+ i = _esm_ebr_get_available_entry(ueid);
+
+ if (i < 0) {
+ LOG_FUNC_RETURN(ESM_EBI_UNASSIGNED);
+ }
+
+ /* An available EPS bearer context is found */
+ ebi = i + ESM_EBI_MIN;
+ }
+
+ /* Assign new EPS bearer context */
+ ebr_ctx =
+ (esm_ebr_context_t *)malloc(sizeof(esm_ebr_context_t));
+
+ if (ebr_ctx == NULL) {
+ LOG_FUNC_RETURN(ESM_EBI_UNASSIGNED);
+ }
+
+
+ _esm_ebr_data[ueid].context[ebi - ESM_EBI_MIN] = ebr_ctx;
+
+ /* Store the index of the next available EPS bearer identity */
+ _esm_ebr_data[ueid].index = i + 1;
+
+ /* Set the EPS bearer identity */
+ ebr_ctx->ebi = ebi;
+ /* Set the EPS bearer context status to INACTIVE */
+ ebr_ctx->status = ESM_EBR_INACTIVE;
+ /* Set the default EPS bearer indicator */
+ ebr_ctx->is_default_ebr = default_ebr;
+ /* Set the identifier of the PDN context the EPS bearer is assigned to */
+ ebr_ctx->cid = cid;
+
+ LOG_TRACE(INFO, "ESM-FSM - EPS bearer context %d assigned", ebi);
+ LOG_FUNC_RETURN(ebr_ctx->ebi);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: esm_ebr_release() **
+ ** **
+ ** Description: Release the given EPS bearer identity **
+ ** **
+ ** Inputs: ueid: Lower layers UE identifier **
+ ** ebi: The identity of the EPS bearer context to **
+ ** be released **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok if the EPS bearer context has **
+ ** been successfully released; **
+ ** RETURNerror otherwise. **
+ ** Others: _esm_ebr_data **
+ ** **
+ ***************************************************************************/
+int esm_ebr_release(
+ int ebi)
+{
+ unsigned int ueid = 0;
+ esm_ebr_context_t *ebr_ctx;
+
+ LOG_FUNC_IN;
+
+ if ( (ebi < ESM_EBI_MIN) || (ebi > ESM_EBI_MAX) ) {
+ LOG_FUNC_RETURN (RETURNerror);
+ }
+
+ /* Get EPS bearer context data */
+ ebr_ctx = _esm_ebr_data[ueid].context[ebi - ESM_EBI_MIN];
+
+ if ( (ebr_ctx == NULL) || (ebr_ctx->ebi != ebi) ) {
+ /* EPS bearer context not assigned */
+ LOG_FUNC_RETURN (RETURNerror);
+ }
+
+ /* Do not release active EPS bearer context */
+ if (ebr_ctx->status != ESM_EBR_INACTIVE) {
+ LOG_TRACE(ERROR, "ESM-FSM - EPS bearer context is not INACTIVE");
+ LOG_FUNC_RETURN (RETURNerror);
+ }
+
+ /* Release EPS bearer context data */
+ free(ebr_ctx);
+ ebr_ctx = NULL;
+
+ LOG_TRACE(INFO, "ESM-FSM - EPS bearer context %d released", ebi);
+ LOG_FUNC_RETURN (RETURNok);
+}
+
+
+
+/****************************************************************************
+ ** **
+ ** Name: esm_ebr_set_status() **
+ ** **
+ ** Description: Set the status of the specified EPS bearer context to the **
+ ** given state **
+ ** **
+ ** Inputs: ueid: Lower layers UE identifier **
+ ** ebi: The identity of the EPS bearer **
+ ** status: The new EPS bearer context status **
+ ** ue_requested: TRUE/FALSE if the modification of the EPS **
+ ** bearer context status was requested by the **
+ ** UE/network **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: RETURNok, RETURNerror **
+ ** Others: _esm_ebr_data **
+ ** **
+ ***************************************************************************/
+int esm_ebr_set_status(
+ int ebi, esm_ebr_state status, int ue_requested)
+{
+ esm_ebr_context_t *ebr_ctx;
+ esm_ebr_state old_status;
+
+ LOG_FUNC_IN;
+
+ unsigned int ueid = 0;
+
+ if (ueid >= ESM_EBR_NB_UE_MAX) {
+ LOG_FUNC_RETURN (RETURNerror);
+ }
+
+
+ if ( (ebi < ESM_EBI_MIN) || (ebi > ESM_EBI_MAX) ) {
+ LOG_FUNC_RETURN (RETURNerror);
+ }
+
+ /* Get EPS bearer context data */
+ ebr_ctx = _esm_ebr_data[ueid].context[ebi - ESM_EBI_MIN];
+
+ if ( (ebr_ctx == NULL) || (ebr_ctx->ebi != ebi) ) {
+ /* EPS bearer context not assigned */
+ LOG_TRACE(ERROR, "ESM-FSM - EPS bearer context not assigned "
+ "(ebi=%d)", ebi);
+ LOG_FUNC_RETURN (RETURNerror);
+ }
+
+ old_status = ebr_ctx->status;
+
+ if (status < ESM_EBR_STATE_MAX) {
+ LOG_TRACE(INFO, "ESM-FSM - Status of EPS bearer context %d changed:"
+ " %s ===> %s", ebi,
+ _esm_ebr_state_str[old_status], _esm_ebr_state_str[status]);
+
+ if (status != old_status) {
+ ebr_ctx->status = status;
+ /*
+ * Notify the user that the state of the EPS bearer has changed
+ */
+ (*_esm_ebr_callback)(ebr_ctx->cid,
+ _esm_ebr_pdn_state[ue_requested][ebr_ctx->is_default_ebr][status]);
+ LOG_FUNC_RETURN (RETURNok);
+ }
+ }
+
+ LOG_FUNC_RETURN (RETURNerror);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: esm_ebr_get_status() **
+ ** **
+ ** Description: Get the current status value of the specified EPS bearer **
+ ** context **
+ ** **
+ ** Inputs: ueid: Lower layers UE identifier **
+ ** ebi: The identity of the EPS bearer **
+ ** Others: _esm_ebr_data **
+ ** **
+ ** Outputs: None **
+ ** Return: The current value of the EPS bearer con- **
+ ** text status **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+
+esm_ebr_state esm_ebr_get_status(
+ int ebi)
+{
+ unsigned int ueid = 0;
+
+ if ( (ebi < ESM_EBI_MIN) || (ebi > ESM_EBI_MAX) ) {
+ return (ESM_EBR_INACTIVE);
+ }
+
+ if (_esm_ebr_data[ueid].context[ebi - ESM_EBI_MIN] == NULL) {
+ /* EPS bearer context not allocated */
+ return (ESM_EBR_INACTIVE);
+ }
+
+ if (_esm_ebr_data[ueid].context[ebi - ESM_EBI_MIN]->ebi != ebi) {
+ /* EPS bearer context not assigned */
+ return (ESM_EBR_INACTIVE);
+ }
+
+ return (_esm_ebr_data[ueid].context[ebi - ESM_EBI_MIN]->status);
+}
+
+/****************************************************************************
+ ** **
+ ** Name: esm_ebr_is_reserved() **
+ ** **
+ ** Description: Check whether the given EPS bearer identity is a reserved **
+ ** value **
+ ** **
+ ** Inputs: ebi: The identity of the EPS bearer **
+ ** Others: None **
+ ** **
+ ** Outputs: None **
+ ** Return: TRUE, FALSE **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int esm_ebr_is_reserved(int ebi)
+{
+ return ( (ebi != ESM_EBI_UNASSIGNED) && (ebi < ESM_EBI_MIN) );
+}
+
+/****************************************************************************
+ ** **
+ ** Name: esm_ebr_is_not_in_use() **
+ ** **
+ ** Description: Check whether the given EPS bearer identity does not **
+ ** match an assigned EBI value currently in use **
+ ** **
+ ** Inputs: ueid: Lower layers UE identifier **
+ ** ebi: The identity of the EPS bearer **
+ ** Others: _esm_ebr_data **
+ ** **
+ ** Outputs: None **
+ ** Return: TRUE, FALSE **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+int esm_ebr_is_not_in_use(
+ int ebi)
+{
+ unsigned int ueid = 0;
+
+ return ( (ebi == ESM_EBI_UNASSIGNED) ||
+ (_esm_ebr_data[ueid].context[ebi - ESM_EBI_MIN] == NULL) ||
+ (_esm_ebr_data[ueid].context[ebi - ESM_EBI_MIN]->ebi) != ebi);
+}
+
+/****************************************************************************/
+/********************* L O C A L F U N C T I O N S *********************/
+/****************************************************************************/
+
+/****************************************************************************
+ ** **
+ ** Name: _esm_ebr_get_available_entry() **
+ ** **
+ ** Description: Returns the index of the next available entry in the list **
+ ** of EPS bearer context data **
+ ** **
+ ** Inputs: ueid: Lower layers UE identifier **
+ ** Others: _esm_ebr_data **
+ ** **
+ ** Outputs: None **
+ ** Return: The index of the next available EPS bearer **
+ ** context data entry; -1 if no any entry is **
+ ** available. **
+ ** Others: None **
+ ** **
+ ***************************************************************************/
+static int _esm_ebr_get_available_entry(unsigned int ueid)
+{
+ int i;
+
+ for (i = _esm_ebr_data[ueid].index; i < ESM_EBR_DATA_SIZE; i++) {
+ if (_esm_ebr_data[ueid].context[i] != NULL) {
+ continue;
+ }
+
+ return i;
+ }
+
+ for (i = 0; i < _esm_ebr_data[ueid].index; i++) {
+ if (_esm_ebr_data[ueid].context[i] != NULL) {
+ continue;
+ }
+
+ return i;
+ }
+
+ /* No available EBI entry found */
+ return (-1);
+}
diff --git a/openair-cn/NAS/UE/ESM/esm_ebr.h b/openair-cn/NAS/UE/ESM/esm_ebr.h
new file mode 100755
index 0000000000..163983f8c0
--- /dev/null
+++ b/openair-cn/NAS/UE/ESM/esm_ebr.h
@@ -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.
+
+ *******************************************************************************/
+/*****************************************************************************
+Source esm_ebr.h
+
+Version 0.1
+
+Date 2013/01/29
+
+Product NAS stack
+
+Subsystem EPS Session Management
+
+Author Frederic Maurel
+
+Description Defines functions used to handle state of EPS bearer contexts
+ and manage ESM messages re-transmission.
+
+*****************************************************************************/
+#ifndef __ESM_EBR_H__
+#define __ESM_EBR_H__
+
+#include "OctetString.h"
+
+#include "networkDef.h"
+
+#include "nas_timer.h"
+
+/****************************************************************************/
+/********************* G L O B A L C O N S T A N T S *******************/
+/****************************************************************************/
+
+/* Unassigned EPS bearer identity value */
+#define ESM_EBI_UNASSIGNED (EPS_BEARER_IDENTITY_UNASSIGNED)
+
+/****************************************************************************/
+/************************ G L O B A L T Y P E S ************************/
+/****************************************************************************/
+
+/****************************************************************************/
+/******************** G L O B A L V A R I A B L E S ********************/
+/****************************************************************************/
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+int esm_ebr_is_reserved(int ebi);
+
+void esm_ebr_initialize(esm_indication_callback_t cb);
+int esm_ebr_assign(int ebi, int cid, int default_ebr);
+int esm_ebr_release(int ebi);
+
+int esm_ebr_set_status(int ebi, esm_ebr_state status, int ue_requested);
+esm_ebr_state esm_ebr_get_status(int ebi);
+
+int esm_ebr_is_not_in_use(int ebi);
+
+#endif /* __ESM_EBR_H__*/
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/esm_ebr_context.c b/openair-cn/NAS/UE/ESM/esm_ebr_context.c
old mode 100644
new mode 100755
similarity index 95%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/esm_ebr_context.c
rename to openair-cn/NAS/UE/ESM/esm_ebr_context.c
index 05a2ae473a..cbc46a9461
--- a/openair-cn/NAS/EURECOM-NAS/src/esm/esm_ebr_context.c
+++ b/openair-cn/NAS/UE/ESM/esm_ebr_context.c
@@ -60,11 +60,9 @@ Description Defines functions used to handle EPS bearer contexts.
#endif
-#ifdef NAS_UE
#include
#include
#include
-#endif
/****************************************************************************/
@@ -75,12 +73,10 @@ Description Defines functions used to handle EPS bearer contexts.
/******************* L O C A L D E F I N I T I O N S *******************/
/****************************************************************************/
-#ifdef NAS_UE
static int _esm_ebr_context_check_identifiers(const network_tft_t *,
const network_tft_t *);
static int _esm_ebr_context_check_precedence(const network_tft_t *,
const network_tft_t *);
-#endif
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
@@ -111,9 +107,7 @@ static int _esm_ebr_context_check_precedence(const network_tft_t *,
** **
***************************************************************************/
int esm_ebr_context_create(
-#ifdef NAS_MME
- emm_data_context_t *ctx,
-#endif
+
int pid, int ebi, int is_default,
const network_qos_t *qos, const network_tft_t *tft)
{
@@ -124,22 +118,7 @@ int esm_ebr_context_create(
LOG_FUNC_IN;
-#ifdef NAS_UE
esm_ctx = &_esm_data;
-#endif
-#ifdef NAS_MME
-# if defined(NAS_BUILT_IN_EPC)
- esm_ctx = &ctx->esm_data_ctx;
-# else
-
- if (ueid < ESM_DATA_NB_UE_MAX) {
- ctx = _esm_data.ctx[ueid];
- } else {
- LOG_FUNC_RETURN (ESM_EBI_UNASSIGNED);
- }
-
-# endif
-#endif
bid = ESM_DATA_EPS_BEARER_MAX;
@@ -229,7 +208,6 @@ int esm_ebr_context_create(
esm_ctx->emergency = TRUE;
}
-#ifdef NAS_UE
// LG ADD TEMP
{
char *tmp = NULL;
@@ -320,7 +298,6 @@ int esm_ebr_context_create(
}
}
// AssertFatal(0, "Forced stop in NAS UE");
-#endif
}
/* Return the EPS bearer identity of the default EPS bearer
@@ -357,9 +334,7 @@ int esm_ebr_context_create(
** **
***************************************************************************/
int esm_ebr_context_release(
-#ifdef NAS_MME
- emm_data_context_t *ctx,
-#endif
+
int ebi, int *pid, int *bid)
{
int found = FALSE;
@@ -370,23 +345,7 @@ int esm_ebr_context_release(
LOG_FUNC_IN;
-#ifdef NAS_UE
esm_ctx = &_esm_data;
-#endif
-
-#ifdef NAS_MME
-# if defined(NAS_BUILT_IN_EPC)
- esm_ctx = &ctx->esm_data_ctx;
-# else
-
- if (ueid < ESM_DATA_NB_UE_MAX) {
- ctx = &_esm_data.ctx[ueid];
- } else {
- LOG_FUNC_RETURN (ESM_EBI_UNASSIGNED);
- }
-
-# endif
-#endif
if (ebi != ESM_EBI_UNASSIGNED) {
/*
@@ -500,21 +459,12 @@ int esm_ebr_context_release(
}
/* Set the EPS bearer context state to INACTIVE */
-#ifdef NAS_UE
(void) esm_ebr_set_status(pdn->bearer[i]->ebi,
ESM_EBR_INACTIVE, TRUE);
-#endif
-#ifdef NAS_MME
- (void) esm_ebr_set_status(ctx, pdn->bearer[i]->ebi,
- ESM_EBR_INACTIVE, TRUE);
-#endif
+
/* Release EPS bearer data */
-#ifdef NAS_UE
(void) esm_ebr_release(pdn->bearer[i]->ebi);
-#endif
-#ifdef NAS_MME
- (void) esm_ebr_release(ctx, pdn->bearer[i]->ebi);
-#endif
+
// esm_ebr_release()
/* Release dedicated EPS bearer data */
free(pdn->bearer[i]);
@@ -536,7 +486,6 @@ int esm_ebr_context_release(
}
}
-#ifdef NAS_UE
/* 3GPP TS 24.301, section 6.4.4.6
* If the UE locally deactivated all EPS bearer contexts, the UE
@@ -562,23 +511,12 @@ int esm_ebr_context_release(
(void) emm_sap_send(&emm_sap);
}
-#endif // NAS_UE
-#ifdef NAS_MME
-
- if (esm_ctx->n_ebrs == 0) {
- /* TODO: Release the PDN connection and marked the UE as inactive
- * in the network for EPS services (is_attached = FALSE) */
- }
-
-#endif
-
LOG_FUNC_RETURN (ebi);
}
LOG_FUNC_RETURN (ESM_EBI_UNASSIGNED);
}
-#ifdef NAS_UE
/****************************************************************************
** **
** Name: esm_ebr_context_get_pid() **
@@ -694,13 +632,11 @@ int esm_ebr_context_check_tft(int pid, int ebi,
LOG_FUNC_RETURN (rc);
}
-#endif // NAS_UE
/****************************************************************************/
/********************* L O C A L F U N C T I O N S *********************/
/****************************************************************************/
-#ifdef NAS_UE
/****************************************************************************
** **
** Name: _esm_ebr_context_check_identifiers() **
@@ -788,4 +724,3 @@ static int _esm_ebr_context_check_precedence(const network_tft_t *tft1,
return (RETURNok);
}
-#endif // NAS_UE
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/esm_ebr_context.h b/openair-cn/NAS/UE/ESM/esm_ebr_context.h
old mode 100644
new mode 100755
similarity index 91%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/esm_ebr_context.h
rename to openair-cn/NAS/UE/ESM/esm_ebr_context.h
index 8ec48a52c1..2a9d55a197
--- a/openair-cn/NAS/EURECOM-NAS/src/esm/esm_ebr_context.h
+++ b/openair-cn/NAS/UE/ESM/esm_ebr_context.h
@@ -55,7 +55,6 @@ Description Defines functions used to handle EPS bearer contexts.
/************************ G L O B A L T Y P E S ************************/
/****************************************************************************/
-#ifdef NAS_UE
/* Traffic flow template operation */
typedef enum {
ESM_EBR_CONTEXT_TFT_CREATE,
@@ -64,7 +63,6 @@ typedef enum {
ESM_EBR_CONTEXT_TFT_REPLACE_PACKET,
ESM_EBR_CONTEXT_TFT_DELETE_PACKET,
} esm_ebr_context_tft_t;
-#endif
/****************************************************************************/
/******************** G L O B A L V A R I A B L E S ********************/
@@ -74,7 +72,6 @@ typedef enum {
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
-#ifdef NAS_UE
int esm_ebr_context_create(int pid, int ebi, int is_default,
const network_qos_t *qos, const network_tft_t *tft);
@@ -84,13 +81,6 @@ int esm_ebr_context_get_pid(int ebi);
int esm_ebr_context_check_tft(int pid, int ebi, const network_tft_t *tft,
esm_ebr_context_tft_t operation);
-#endif
-#ifdef NAS_MME
-int esm_ebr_context_create(emm_data_context_t *ctx, int pid, int ebi, int is_default,
- const network_qos_t *qos, const network_tft_t *tft);
-
-int esm_ebr_context_release(emm_data_context_t *ctx, int ebi, int *pid, int *bid);
-#endif
#endif /* __ESM_EBR_CONTEXT_H__ */
diff --git a/openair-cn/NAS/UE/ESM/esm_ip.c b/openair-cn/NAS/UE/ESM/esm_ip.c
new file mode 100755
index 0000000000..b2fb84b970
--- /dev/null
+++ b/openair-cn/NAS/UE/ESM/esm_ip.c
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ 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 "emmData.h"
+#include "esmData.h"
+
+char ip_addr_str[100];
+
+inline char *esm_data_get_ipv4_addr(const OctetString *ip_addr)
+{
+ if (ip_addr->length > 0) {
+ sprintf(ip_addr_str, "%u.%u.%u.%u",
+ ip_addr->value[0], ip_addr->value[1],
+ ip_addr->value[2], ip_addr->value[3]);
+ return ip_addr_str;
+ }
+
+ return (NULL);
+}
+
+inline char *esm_data_get_ipv6_addr(const OctetString *ip_addr)
+{
+ if (ip_addr->length > 0) {
+ sprintf(ip_addr_str, "%x%.2x:%x%.2x:%x%.2x:%x%.2x",
+ ip_addr->value[0], ip_addr->value[1],
+ ip_addr->value[2], ip_addr->value[3],
+ ip_addr->value[4], ip_addr->value[5],
+ ip_addr->value[6], ip_addr->value[7]);
+ return ip_addr_str;
+ }
+
+ return (NULL);
+}
+
+inline char *esm_data_get_ipv4v6_addr(const OctetString *ip_addr)
+{
+ if (ip_addr->length > 0) {
+ sprintf(ip_addr_str, "%u.%u.%u.%u / %x%.2x:%x%.2x:%x%.2x:%x%.2x",
+ ip_addr->value[0], ip_addr->value[1],
+ ip_addr->value[2], ip_addr->value[3],
+ ip_addr->value[4], ip_addr->value[5],
+ ip_addr->value[6], ip_addr->value[7],
+ ip_addr->value[8], ip_addr->value[9],
+ ip_addr->value[10], ip_addr->value[11]);
+ return ip_addr_str;
+ }
+
+ return (NULL);
+}
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/esm_main.c b/openair-cn/NAS/UE/ESM/esm_main.c
old mode 100644
new mode 100755
similarity index 91%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/esm_main.c
rename to openair-cn/NAS/UE/ESM/esm_main.c
index a87b0830bb..2d2124e495
--- a/openair-cn/NAS/EURECOM-NAS/src/esm/esm_main.c
+++ b/openair-cn/NAS/UE/ESM/esm_main.c
@@ -65,7 +65,6 @@ Description Defines the EPS Session Management procedure call manager,
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
-#ifdef NAS_UE
/****************************************************************************
** **
** Name: esm_main_initialize() **
@@ -108,48 +107,7 @@ void esm_main_initialize(esm_indication_callback_t cb)
LOG_FUNC_OUT;
}
-#endif
-#ifdef NAS_MME
-/****************************************************************************
- ** **
- ** Name: esm_main_initialize() **
- ** **
- ** Description: Initializes ESM internal data **
- ** **
- ** Inputs: None **
- ** Others: None **
- ** **
- ** Outputs: None **
- ** Return: None **
- ** Others: None **
- ** **
- ***************************************************************************/
-void esm_main_initialize(void)
-{
- int i;
- LOG_FUNC_IN;
-
- /* Retreive MME supported configuration data */
- if (mme_api_get_esm_config(&_esm_data.conf) != RETURNok) {
- LOG_TRACE(ERROR, "ESM-MAIN - Failed to get MME configuration data");
- }
-
-# if !defined(NAS_BUILT_IN_EPC)
-
- /* Initialize ESM contexts */
- for (i = 0; i < ESM_DATA_NB_UE_MAX; i++) {
- _esm_data.ctx[i] = NULL;
- }
-
-# endif
-
- /* Initialize the EPS bearer context manager */
- esm_ebr_initialize();
-
- LOG_FUNC_OUT;
-}
-#endif
/****************************************************************************
** **
@@ -169,7 +127,6 @@ void esm_main_cleanup(void)
{
LOG_FUNC_IN;
-#ifdef NAS_UE
{
int i;
int pid;
@@ -206,12 +163,10 @@ void esm_main_cleanup(void)
}
}
}
-#endif
LOG_FUNC_OUT;
}
-#ifdef NAS_UE
/****************************************************************************
** **
** Name: esm_main_get_nb_pdn_max() **
@@ -429,7 +384,6 @@ int esm_main_get_pdn_addr(int cid, const char **ipv4addr, const char **ipv6addr)
LOG_FUNC_RETURN (RETURNok);
}
-#endif // NAS_UE
/****************************************************************************/
/********************* L O C A L F U N C T I O N S *********************/
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/esm_main.h b/openair-cn/NAS/UE/ESM/esm_main.h
old mode 100644
new mode 100755
similarity index 96%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/esm_main.h
rename to openair-cn/NAS/UE/ESM/esm_main.h
index d7a5a3696c..2fd2e58939
--- a/openair-cn/NAS/EURECOM-NAS/src/esm/esm_main.h
+++ b/openair-cn/NAS/UE/ESM/esm_main.h
@@ -65,15 +65,10 @@ Description Defines the EPS Session Management procedure call manager,
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
-#ifdef NAS_UE
void esm_main_initialize(esm_indication_callback_t cb);
-#endif
-#ifdef NAS_MME
-void esm_main_initialize(void);
-#endif
+
void esm_main_cleanup(void);
-#ifdef NAS_UE
/* User's getter for PDN connections and EPS bearer contexts */
int esm_main_get_nb_pdns_max(void);
@@ -84,6 +79,5 @@ int esm_main_get_pdn(int cid, int *type, const char **apn, int *is_emergency,
int *is_active);
int esm_main_get_pdn_addr(int cid, const char **ipv4addr, const char **ipv6addr);
-#endif // NAS_UE
#endif /* __ESM_MAIN_H__*/
diff --git a/openair-cn/NAS/UE/ESM/esm_proc.h b/openair-cn/NAS/UE/ESM/esm_proc.h
new file mode 100755
index 0000000000..f4721aa00c
--- /dev/null
+++ b/openair-cn/NAS/UE/ESM/esm_proc.h
@@ -0,0 +1,198 @@
+/*******************************************************************************
+ 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.
+
+ *******************************************************************************/
+/*****************************************************************************
+Source esm_proc.h
+
+Version 0.1
+
+Date 2013/01/02
+
+Product NAS stack
+
+Subsystem EPS Session Management
+
+Author Frederic Maurel
+
+Description Defines the EPS Session Management procedures executed at
+ the ESM Service Access Points.
+
+*****************************************************************************/
+#ifndef __ESM_PROC_H__
+#define __ESM_PROC_H__
+
+#include "networkDef.h"
+#include "OctetString.h"
+#include "emmData.h"
+#include "ProtocolConfigurationOptions.h"
+
+/****************************************************************************/
+/********************* G L O B A L C O N S T A N T S *******************/
+/****************************************************************************/
+
+/*
+ * ESM retransmission timers
+ * -------------------------
+ */
+#define T3482_DEFAULT_VALUE 8 /* PDN connectivity request */
+#define T3492_DEFAULT_VALUE 6 /* PDN disconnect request */
+
+
+/* Type of PDN address */
+typedef enum {
+ ESM_PDN_TYPE_IPV4 = NET_PDN_TYPE_IPV4,
+ ESM_PDN_TYPE_IPV6 = NET_PDN_TYPE_IPV6,
+ ESM_PDN_TYPE_IPV4V6 = NET_PDN_TYPE_IPV4V6
+} esm_proc_pdn_type_t;
+
+/* Type of PDN request */
+typedef enum {
+ ESM_PDN_REQUEST_INITIAL = 1,
+ ESM_PDN_REQUEST_HANDOVER,
+ ESM_PDN_REQUEST_EMERGENCY
+} esm_proc_pdn_request_t;
+
+/****************************************************************************/
+/************************ G L O B A L T Y P E S ************************/
+/****************************************************************************/
+
+/*
+ * Type of the ESM procedure callback executed when requested by the UE
+ * or initiated by the network
+ */
+typedef int (*esm_proc_procedure_t) (int, int, OctetString *, int);
+
+/* EPS bearer level QoS parameters */
+typedef network_qos_t esm_proc_qos_t;
+
+/* Traffic Flow Template for packet filtering */
+typedef network_tft_t esm_proc_tft_t;
+
+typedef ProtocolConfigurationOptions esm_proc_pco_t;
+
+/* PDN connection and EPS bearer context data */
+typedef struct {
+ OctetString apn;
+ esm_proc_pdn_type_t pdn_type;
+ OctetString pdn_addr;
+ esm_proc_qos_t qos;
+ esm_proc_tft_t tft;
+ esm_proc_pco_t pco;
+} esm_proc_data_t;
+
+/****************************************************************************/
+/******************** G L O B A L V A R I A B L E S ********************/
+/****************************************************************************/
+
+/****************************************************************************/
+/****************** E X P O R T E D F U N C T I O N S ******************/
+/****************************************************************************/
+
+/*
+ * --------------------------------------------------------------------------
+ * ESM status procedure
+ * --------------------------------------------------------------------------
+ */
+int esm_proc_status_ind(int pti, int ebi, int *esm_cause);
+int esm_proc_status(int is_standalone, int pti, OctetString *msg,
+ int sent_by_ue);
+
+
+/*
+ * --------------------------------------------------------------------------
+ * PDN connectivity procedure
+ * --------------------------------------------------------------------------
+ */
+int esm_proc_pdn_connectivity(int cid, int to_define,
+ esm_proc_pdn_type_t pdn_type, const OctetString *apn, int is_emergency,
+ unsigned int *pti);
+int esm_proc_pdn_connectivity_request(int is_standalone, int pti,
+ OctetString *msg, int sent_by_ue);
+int esm_proc_pdn_connectivity_accept(int pti, esm_proc_pdn_type_t pdn_type,
+ const OctetString *pdn_address, const OctetString *apn, int *esm_cause);
+int esm_proc_pdn_connectivity_reject(int pti, int *esm_cause);
+int esm_proc_pdn_connectivity_complete(void);
+int esm_proc_pdn_connectivity_failure(int is_pending);
+
+
+/*
+ * --------------------------------------------------------------------------
+ * PDN disconnect procedure
+ * --------------------------------------------------------------------------
+ */
+int esm_proc_pdn_disconnect(int cid, unsigned int *pti, unsigned int *ebi);
+int esm_proc_pdn_disconnect_request(int is_standalone, int pti,
+ OctetString *msg, int sent_by_ue);
+
+int esm_proc_pdn_disconnect_accept(int pti, int *esm_cause);
+int esm_proc_pdn_disconnect_reject(int pti, int *esm_cause);
+
+/*
+ * --------------------------------------------------------------------------
+ * Default EPS bearer context activation procedure
+ * --------------------------------------------------------------------------
+ */
+
+int esm_proc_default_eps_bearer_context_request(int pid, int ebi,
+ const esm_proc_qos_t *esm_qos, int *esm_cause);
+int esm_proc_default_eps_bearer_context_complete(void);
+int esm_proc_default_eps_bearer_context_failure(void);
+
+int esm_proc_default_eps_bearer_context_accept(int is_standalone, int ebi,
+ OctetString *msg, int ue_triggered);
+int esm_proc_default_eps_bearer_context_reject(int is_standalone, int ebi,
+ OctetString *msg, int ue_triggered);
+
+/*
+ * --------------------------------------------------------------------------
+ * Dedicated EPS bearer context activation procedure
+ * --------------------------------------------------------------------------
+ */
+
+int esm_proc_dedicated_eps_bearer_context_request(int ebi, int default_ebi,
+ const esm_proc_qos_t *qos, const esm_proc_tft_t *tft, int *esm_cause);
+
+int esm_proc_dedicated_eps_bearer_context_accept(int is_standalone, int ebi,
+ OctetString *msg, int ue_triggered);
+int esm_proc_dedicated_eps_bearer_context_reject(int is_standalone, int ebi,
+ OctetString *msg, int ue_triggered);
+
+/*
+ * --------------------------------------------------------------------------
+ * EPS bearer context deactivation procedure
+ * --------------------------------------------------------------------------
+ */
+
+int esm_proc_eps_bearer_context_deactivate(int is_local, int ebi, int *pid,
+ int *bid);
+int esm_proc_eps_bearer_context_deactivate_request(int ebi, int *esm_cause);
+
+int esm_proc_eps_bearer_context_deactivate_accept(int is_standalone, int ebi,
+ OctetString *msg, int ue_triggered);
+
+#endif /* __ESM_PROC_H__*/
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/esm_pt.c b/openair-cn/NAS/UE/ESM/esm_pt.c
old mode 100644
new mode 100755
similarity index 99%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/esm_pt.c
rename to openair-cn/NAS/UE/ESM/esm_pt.c
index 96b18625ff..954049203c
--- a/openair-cn/NAS/EURECOM-NAS/src/esm/esm_pt.c
+++ b/openair-cn/NAS/UE/ESM/esm_pt.c
@@ -45,13 +45,11 @@ Description Defines functions used to handle ESM procedure transactions.
#include "esm_pt.h"
-#ifdef NAS_UE
#include "commonDef.h"
#include "nas_log.h"
#include // malloc, free
#include // memcpy
-#endif // NAS_UE
/****************************************************************************/
/**************** E X T E R N A L D E F I N I T I O N S ****************/
@@ -69,7 +67,6 @@ Description Defines functions used to handle ESM procedure transactions.
/******************* L O C A L D E F I N I T I O N S *******************/
/****************************************************************************/
-#ifdef NAS_UE
/* String representation of ESM procedure transaction status */
static const char *_esm_pt_state_str[ESM_PT_STATE_MAX] = {
"PROCEDURE TRANSACTION INACTIVE",
@@ -103,13 +100,11 @@ static struct {
/* Return the index of the next available entry in the list of procedure
* transaction data */
static int _esm_pt_get_available_entry(void);
-#endif // NAS_UE
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
-#ifdef NAS_UE
/****************************************************************************
** **
** Name: esm_pt_initialize() **
@@ -536,7 +531,6 @@ int esm_pt_is_not_in_use(int pti)
(_esm_pt_data.context[pti - ESM_PTI_MIN] == NULL) ||
(_esm_pt_data.context[pti - ESM_PTI_MIN]->pti) != pti);
}
-#endif // NAS_UE
/****************************************************************************
** **
@@ -562,7 +556,6 @@ int esm_pt_is_reserved(int pti)
/********************* L O C A L F U N C T I O N S *********************/
/****************************************************************************/
-#ifdef NAS_UE
/****************************************************************************
** **
** Name: _esm_pt_get_available_entry() **
@@ -603,4 +596,3 @@ static int _esm_pt_get_available_entry(void)
/* No available PTI entry found */
return (-1);
}
-#endif // NAS_UE
diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/esm_pt.h b/openair-cn/NAS/UE/ESM/esm_pt.h
old mode 100644
new mode 100755
similarity index 97%
rename from openair-cn/NAS/EURECOM-NAS/src/esm/esm_pt.h
rename to openair-cn/NAS/UE/ESM/esm_pt.h
index a2aa313c9a..0abe6ea558
--- a/openair-cn/NAS/EURECOM-NAS/src/esm/esm_pt.h
+++ b/openair-cn/NAS/UE/ESM/esm_pt.h
@@ -45,10 +45,8 @@ Description Defines functions used to handle ESM procedure transactions.
#ifndef __ESM_PT_H__
#define __ESM_PT_H__
-#ifdef NAS_UE
#include "OctetString.h"
#include "nas_timer.h"
-#endif
#include "ProcedureTransactionIdentity.h"
@@ -63,7 +61,6 @@ Description Defines functions used to handle ESM procedure transactions.
/************************ G L O B A L T Y P E S ************************/
/****************************************************************************/
-#ifdef NAS_UE
/* Procedure transaction states */
typedef enum {
ESM_PT_INACTIVE, /* No procedure transaction exists */
@@ -78,7 +75,6 @@ typedef struct {
unsigned int count; /* Retransmission counter */
OctetString msg; /* Encoded ESM message to re-transmit */
} esm_pt_timer_data_t;
-#endif // NAS_UE
/****************************************************************************/
/******************** G L O B A L V A R I A B L E S ********************/
@@ -90,7 +86,6 @@ typedef struct {
int esm_pt_is_reserved(int pti);
-#ifdef NAS_UE
void esm_pt_initialize(void);
int esm_pt_assign(void);
@@ -105,6 +100,5 @@ esm_pt_state esm_pt_get_status(int pti);
int esm_pt_get_pending_pti(esm_pt_state status);
int esm_pt_is_not_in_use(int pti);
-#endif // NAS_UE
#endif /* __ESM_PT_H__*/
diff --git a/openair-cn/NAS/EURECOM-NAS/src/UEprocess.c b/openair-cn/NAS/UE/UEprocess.c
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/UEprocess.c
rename to openair-cn/NAS/UE/UEprocess.c
diff --git a/openair-cn/NAS/nas_itti_messaging.c b/openair-cn/NAS/UE/nas_itti_messaging.c
old mode 100644
new mode 100755
similarity index 87%
rename from openair-cn/NAS/nas_itti_messaging.c
rename to openair-cn/NAS/UE/nas_itti_messaging.c
index 8f7dac6531..d832585ebd
--- a/openair-cn/NAS/nas_itti_messaging.c
+++ b/openair-cn/NAS/UE/nas_itti_messaging.c
@@ -32,16 +32,10 @@
#include "nas_itti_messaging.h"
#include "msc.h"
-#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(NAS_BUILT_IN_UE) && defined(NAS_UE)))
-# if (defined(NAS_BUILT_IN_EPC) && defined(NAS_MME))
-# define TASK_ORIGIN TASK_NAS_MME
-# else
# define TASK_ORIGIN TASK_NAS_UE
-# endif
-#endif
-#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE)))
-static const UInt8_t emm_message_ids[] = {
+#if (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) )
+static const uint8_t emm_message_ids[] = {
ATTACH_REQUEST,
ATTACH_ACCEPT,
ATTACH_COMPLETE,
@@ -73,7 +67,7 @@ static const UInt8_t emm_message_ids[] = {
CS_SERVICE_NOTIFICATION,
};
-static const UInt8_t esm_message_ids[] = {
+static const uint8_t esm_message_ids[] = {
ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST,
ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT,
ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT,
@@ -98,7 +92,7 @@ static const UInt8_t esm_message_ids[] = {
ESM_STATUS,
};
-static int _nas_find_message_index(const UInt8_t message_id, const UInt8_t *message_ids, const int ids_number)
+static int _nas_find_message_index(const uint8_t message_id, const uint8_t *message_ids, const int ids_number)
{
int i;
@@ -189,30 +183,8 @@ int nas_itti_protected_msg(const char *buffer, const nas_message_t *msg, const i
}
#endif
-#if defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)
-int nas_itti_dl_data_req(const uint32_t ue_id, void *const data,
- const uint32_t length)
-{
- MessageDef *message_p;
- message_p = itti_alloc_new_message(TASK_NAS_MME, NAS_DOWNLINK_DATA_REQ);
- NAS_DL_DATA_REQ(message_p).UEid = ue_id;
- NAS_DL_DATA_REQ(message_p).nasMsg.data = data;
- NAS_DL_DATA_REQ(message_p).nasMsg.length = length;
-
- MSC_LOG_TX_MESSAGE(
- MSC_NAS_MME,
- MSC_S1AP_MME,
- NULL,0,
- "0 NAS_DOWNLINK_DATA_REQ ue id %06"PRIX32" len %u", ue_id, length);
-
- return itti_send_msg_to_task(TASK_S1AP, INSTANCE_DEFAULT, message_p);
-}
-
-#endif
-
-#if defined(NAS_BUILT_IN_UE) && defined(NAS_UE)
extern unsigned char NB_eNB_INST;
int nas_itti_cell_info_req(const plmn_t plmnID, const Byte_t rat)
@@ -235,7 +207,7 @@ int nas_itti_cell_info_req(const plmn_t plmnID, const Byte_t rat)
return itti_send_msg_to_task(TASK_RRC_UE, NB_eNB_INST + 0 /* TODO to be virtualized */, message_p);
}
-int nas_itti_nas_establish_req(as_cause_t cause, as_call_type_t type, as_stmsi_t s_tmsi, plmn_t plmnID, Byte_t *data, UInt32_t length)
+int nas_itti_nas_establish_req(as_cause_t cause, as_call_type_t type, as_stmsi_t s_tmsi, plmn_t plmnID, Byte_t *data, uint32_t length)
{
MessageDef *message_p;
@@ -291,4 +263,3 @@ int nas_itti_rab_establish_rsp(const as_stmsi_t s_tmsi, const as_rab_id_t rabID,
s_tmsi.MMEcode, s_tmsi.m_tmsi,rabID, errCode );
return itti_send_msg_to_task(TASK_RRC_UE, NB_eNB_INST + 0 /* TODO to be virtualized */, message_p);
}
-#endif
diff --git a/openair3/RAL-LTE/LTE_RAL_UE/INCLUDE/nas_ue_ioctl.h b/openair-cn/NAS/UE/nas_itti_messaging.h
similarity index 52%
rename from openair3/RAL-LTE/LTE_RAL_UE/INCLUDE/nas_ue_ioctl.h
rename to openair-cn/NAS/UE/nas_itti_messaging.h
index 01bdf75fc9..4165119570 100755
--- a/openair3/RAL-LTE/LTE_RAL_UE/INCLUDE/nas_ue_ioctl.h
+++ b/openair-cn/NAS/UE/nas_itti_messaging.h
@@ -23,43 +23,43 @@
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@eurecom.fr
- Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
+ Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
*******************************************************************************/
-/*! \file nas_ue_ioctl.h
- * \brief This file defines the constants for triggering the ioctl interface
- * \author WETTERWALD Michelle, GAUTHIER Lionel, MAUREL Frederic
- * \date 2013
- * \company EURECOM
- * \email: michelle.wetterwald@eurecom.fr, lionel.gauthier@eurecom.fr, frederic.maurel@eurecom.fr
- */
-/*******************************************************************************/
-#ifndef _IAL_IOCTL_H
-#define _IAL_IOCTL_H
-
-#include
#include
-#include
-#include
-#include
+#include
+#include
-#include
+#include "assertions.h"
+#include "intertask_interface.h"
+#include "esm_proc.h"
+#include "msc.h"
-// Temp constants = arguments gioctl
-//arg[0]
-#define IO_OBJ_STATS 0
-#define IO_OBJ_CNX 1
-#define IO_OBJ_RB 2
-#define IO_OBJ_MEAS 3
-#define IO_OBJ_IMEI 4
-//arg[1]
-#define IO_CMD_ADD 0
-#define IO_CMD_DEL 1
-#define IO_CMD_LIST 2
+#ifndef NAS_ITTI_MESSAGING_H_
+#define NAS_ITTI_MESSAGING_H_
+
+# if (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE))
+int nas_itti_plain_msg(
+ const char *buffer,
+ const nas_message_t *msg,
+ const int lengthP,
+ const int instance);
+
+int nas_itti_protected_msg(
+ const char *buffer,
+ const nas_message_t *msg,
+ const int lengthP,
+ const int instance);
+# endif
+# if defined(NAS_BUILT_IN_UE)
+int nas_itti_cell_info_req(const plmn_t plmnID, const Byte_t rat);
-//LGextern int inet_pton(int af, const char *src, void *dst);
-//LGextern char *inet_ntop(int af, const void *src, char *dst, size_t sise);
+int nas_itti_nas_establish_req(as_cause_t cause, as_call_type_t type, as_stmsi_t s_tmsi, plmn_t plmnID, Byte_t *data_pP, uint32_t lengthP);
-#endif
+int nas_itti_ul_data_req(const uint32_t ue_idP, void *const data_pP, const uint32_t lengthP);
+
+int nas_itti_rab_establish_rsp(const as_stmsi_t s_tmsi, const as_rab_id_t rabID, const nas_error_code_t errCode);
+# endif
+#endif /* NAS_ITTI_MESSAGING_H_ */
diff --git a/openair-cn/NAS/EURECOM-NAS/src/nas_network.c b/openair-cn/NAS/UE/nas_network.c
old mode 100644
new mode 100755
similarity index 84%
rename from openair-cn/NAS/EURECOM-NAS/src/nas_network.c
rename to openair-cn/NAS/UE/nas_network.c
index 9c5a0c38fe..5c63d56067
--- a/openair-cn/NAS/EURECOM-NAS/src/nas_network.c
+++ b/openair-cn/NAS/UE/nas_network.c
@@ -77,24 +77,10 @@ Description NAS procedure functions triggered by the network
** Others: None **
** **
***************************************************************************/
-#if defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)
-void nas_network_initialize(mme_config_t *mme_config_p)
-#else
void nas_network_initialize(void)
-#endif
{
LOG_FUNC_IN;
-#ifdef NAS_MME
- /* Initialize the internal NAS processing data */
-# if defined(NAS_BUILT_IN_EPC)
- nas_timer_init();
- nas_proc_initialize(mme_config_p);
-# else
- nas_proc_initialize();
-# endif
-#endif
-
LOG_FUNC_OUT;
}
@@ -155,7 +141,6 @@ int nas_network_process_data(int msg_id, const void *data)
}
switch (msg_id) {
-#ifdef NAS_UE
case AS_BROADCAST_INFO_IND:
break;
@@ -224,46 +209,6 @@ int nas_network_process_data(int msg_id, const void *data)
case AS_RAB_RELEASE_IND:
break;
-#endif
-#ifdef NAS_MME
-
- case AS_NAS_ESTABLISH_IND: {
- /* Received NAS signalling connection establishment indication */
- const nas_establish_ind_t *indication = &msg->msg.nas_establish_ind;
- rc = nas_proc_establish_ind(indication->UEid,
- indication->tac,
- indication->initialNasMsg.data,
- indication->initialNasMsg.length);
- break;
- }
-
- case AS_DL_INFO_TRANSFER_CNF: {
- const dl_info_transfer_cnf_t *info = &msg->msg.dl_info_transfer_cnf;
-
- /* Received downlink data transfer confirm */
- if (info->errCode != AS_SUCCESS) {
- LOG_TRACE(WARNING, "NET-MAIN - "
- "Downlink NAS message not delivered");
- rc = nas_proc_dl_transfer_rej(info->UEid);
- } else {
- rc = nas_proc_dl_transfer_cnf(info->UEid);
- }
-
- break;
- }
-
- case AS_UL_INFO_TRANSFER_IND: {
- const ul_info_transfer_ind_t *info = &msg->msg.ul_info_transfer_ind;
- /* Received uplink data transfer indication */
- rc = nas_proc_ul_transfer_ind(info->UEid,
- info->nasMsg.data,
- info->nasMsg.length);
- break;
- }
-
- case AS_RAB_ESTABLISH_CNF:
- break;
-#endif
default:
LOG_TRACE(ERROR, "NET-MAIN - Unexpected AS message type: 0x%x",
diff --git a/openair3/RAL-LTE/RAL-DUMMY/INCLUDE/eRALlte_thresholds.h b/openair-cn/NAS/UE/nas_network.h
old mode 100644
new mode 100755
similarity index 74%
rename from openair3/RAL-LTE/RAL-DUMMY/INCLUDE/eRALlte_thresholds.h
rename to openair-cn/NAS/UE/nas_network.h
index fbd0a4039c..25a8729eac
--- a/openair3/RAL-LTE/RAL-DUMMY/INCLUDE/eRALlte_thresholds.h
+++ b/openair-cn/NAS/UE/nas_network.h
@@ -23,23 +23,29 @@
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@eurecom.fr
- Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
+ Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
*******************************************************************************/
-/*! \file eRALlte_thresholds.h
- * \brief
- * \author BRIZZOLA Davide, GAUTHIER Lionel, MAUREL Frederic, WETTERWALD Michelle
- * \date 2012
- * \version
- * \note
- * \bug
- * \warning
- */
+/*****************************************************************************
+Source nas_network.h
-#ifndef __RAL_LTE_THRESHOLDS_H__
-#define __RAL_LTE_THRESHOLDS_H__
+Version 0.1
-#include "MIH_C.h"
+Date 2012/09/20
+
+Product NAS stack
+
+Subsystem NAS main process
+
+Author Frederic Maurel
+
+Description NAS procedure functions triggered by the network
+
+*****************************************************************************/
+
+
+#ifndef __NAS_NETWORK_H__
+#define __NAS_NETWORK_H__
/****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/
@@ -53,12 +59,17 @@
/******************** G L O B A L V A R I A B L E S ********************/
/****************************************************************************/
-//LIST(MIH_C_LINK_CFG_PARAM, g_link_cfg_param_thresholds);
-
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
-void eRALlte_configure_thresholds_request(MIH_C_Message_Link_Configure_Thresholds_request_t* messageP);
-#endif
+void nas_network_initialize(void);
+
+void nas_network_cleanup(void);
+
+int nas_network_process_data(int command_id, const void *data);
+
+const void *nas_network_get_data(void);
+
+#endif /* __NAS_NETWORK_H__*/
diff --git a/openair-cn/NAS/EURECOM-NAS/src/nas_parser.c b/openair-cn/NAS/UE/nas_parser.c
old mode 100644
new mode 100755
similarity index 98%
rename from openair-cn/NAS/EURECOM-NAS/src/nas_parser.c
rename to openair-cn/NAS/UE/nas_parser.c
index 8c7c7c5fcf..aae894b783
--- a/openair-cn/NAS/EURECOM-NAS/src/nas_parser.c
+++ b/openair-cn/NAS/UE/nas_parser.c
@@ -61,22 +61,14 @@ Description NAS command line parser
* Identifiers of the NAS command line options
*/
enum {
-#ifdef NAS_UE
NAS_PARSER_UE_ID, /* User Equipement Identifier */
-#endif // NAS_UE
NAS_PARSER_TRACE_LEVEL, /* Logging trace level */
-#ifdef NAS_UE
NAS_PARSER_USER_HOST, /* User app layer's hostname */
-#endif // NAS_UE
NAS_PARSER_NETWORK_HOST, /* Network layer's hostname */
-#ifdef NAS_UE
NAS_PARSER_USER_PORT, /* User app layer's port number */
-#endif // NAS_UE
NAS_PARSER_NETWORK_PORT, /* Network layer's port number */
-#ifdef NAS_UE
NAS_PARSER_DEVICE_PATH, /* Device pathname */
NAS_PARSER_DEVICE_ATTR, /* Device attribute parameters */
-#endif // NAS_UE
NAS_PARSER_NB_OPTIONS
};
@@ -93,40 +85,32 @@ static parser_command_line_t nasParserCommandLine = {
"NASprocess", /* Command name */
NAS_PARSER_NB_OPTIONS, /* Number of options */
{ /* Command line options */
-#ifdef NAS_UE
{
"-ueid", "", "UE identifier\t\t\t",
NAS_PARSER_DEFAULT_UE_ID
},
-#endif // NAS_UE
{
"-trace", "", "Logging trace level\t\t",
NAS_PARSER_DEFAULT_TRACE_LEVEL
},
-#ifdef NAS_UE
{
"-uhost", "", "User app layer's hostname\t",
NAS_PARSER_DEFAULT_USER_HOSTNAME
},
-#endif // NAS_UE
{
"-nhost", "", "Network layer's hostname\t",
NAS_PARSER_DEFAULT_NETWORK_HOSTNAME
},
-#ifdef NAS_UE
{
"-uport", "", "User app layer's port number\t",
NAS_PARSER_DEFAULT_USER_PORT_NUMBER
},
-#endif // NAS_UE
{
"-nport", "", "Network layer's port number\t",
NAS_PARSER_DEFAULT_NETWORK_PORT_NUMBER
},
-#ifdef NAS_UE
{"-dev", "", "Device pathname\t\t", "NULL"},
{"-params", "", "Device attribute parameters", "NULL"},
-#endif // NAS_UE
}
};
@@ -252,7 +236,6 @@ const char *nas_parser_get_network_port(void)
return nasParserCommandLine.options[NAS_PARSER_NETWORK_PORT].pvalue;
}
-#ifdef NAS_UE
/****************************************************************************
** **
** Name: nas_parser_get_ueid() **
@@ -343,7 +326,6 @@ const char *nas_parser_get_device_params(void)
{
return nasParserCommandLine.options[NAS_PARSER_DEVICE_ATTR].pvalue;
}
-#endif // NAS_UE
/****************************************************************************/
/********************* L O C A L F U N C T I O N S *********************/
diff --git a/openair-cn/NAS/EURECOM-NAS/src/nas_parser.h b/openair-cn/NAS/UE/nas_parser.h
old mode 100644
new mode 100755
similarity index 98%
rename from openair-cn/NAS/EURECOM-NAS/src/nas_parser.h
rename to openair-cn/NAS/UE/nas_parser.h
index e8d18ae212..4e9be0aa28
--- a/openair-cn/NAS/EURECOM-NAS/src/nas_parser.h
+++ b/openair-cn/NAS/UE/nas_parser.h
@@ -58,7 +58,6 @@ Description NAS command line parser
/* Network layer default port number */
#define NAS_PARSER_DEFAULT_NETWORK_PORT_NUMBER "12000"
-#ifdef NAS_UE
/* User Identifier default value */
#define NAS_PARSER_DEFAULT_UE_ID "1"
@@ -67,7 +66,6 @@ Description NAS command line parser
/* User application layer default port number */
#define NAS_PARSER_DEFAULT_USER_PORT_NUMBER "10000"
-#endif // NAS_UE
/****************************************************************************/
/************************ G L O B A L T Y P E S ************************/
@@ -89,12 +87,10 @@ int nas_parser_get_trace_level(void);
const char *nas_parser_get_network_host(void);
const char *nas_parser_get_network_port(void);
-#ifdef NAS_UE
int nas_parser_get_ueid(void);
const char *nas_parser_get_user_host(void);
const char *nas_parser_get_user_port(void);
const char *nas_parser_get_device_path(void);
const char *nas_parser_get_device_params(void);
-#endif // NAS_UE
#endif /* __NAS_PARSER_H__*/
diff --git a/openair-cn/NAS/EURECOM-NAS/src/nas_proc.c b/openair-cn/NAS/UE/nas_proc.c
old mode 100644
new mode 100755
similarity index 84%
rename from openair-cn/NAS/EURECOM-NAS/src/nas_proc.c
rename to openair-cn/NAS/UE/nas_proc.c
index 662dd6dfaa..f6327fd627
--- a/openair-cn/NAS/EURECOM-NAS/src/nas_proc.c
+++ b/openair-cn/NAS/UE/nas_proc.c
@@ -63,7 +63,6 @@ Description NAS procedure call manager
/******************* L O C A L D E F I N I T I O N S *******************/
/****************************************************************************/
-#ifdef NAS_UE
/*
* Signal strength/quality value not known or not detectable
*/
@@ -84,12 +83,10 @@ static struct {
static int _nas_proc_activate(int cid, int apply_to_all);
static int _nas_proc_deactivate(int cid, int apply_to_all);
-#endif
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
-#ifdef NAS_UE
/****************************************************************************
** **
** Name: nas_proc_initialize() **
@@ -125,50 +122,7 @@ void nas_proc_initialize(emm_indication_callback_t emm_cb,
LOG_FUNC_OUT;
}
-#endif
-#ifdef NAS_MME
-/****************************************************************************
- ** **
- ** Name: nas_proc_initialize() **
- ** **
- ** Description: **
- ** **
- ** Inputs: None **
- ** Others: None **
- ** **
- ** Outputs: None **
- ** Return: None **
- ** Others: None **
- ** **
- ***************************************************************************/
-# if defined(NAS_BUILT_IN_EPC)
-void nas_proc_initialize(mme_config_t *mme_config_p)
-{
- LOG_FUNC_IN;
- /* Initialize the EMM procedure manager */
- emm_main_initialize(mme_config_p);
-
- /* Initialize the ESM procedure manager */
- esm_main_initialize();
-
- LOG_FUNC_OUT;
-}
-# else
-void nas_proc_initialize(void)
-{
- LOG_FUNC_IN;
-
- /* Initialize the EMM procedure manager */
- emm_main_initialize();
-
- /* Initialize the ESM procedure manager */
- esm_main_initialize();
-
- LOG_FUNC_OUT;
-}
-# endif
-#endif
/****************************************************************************
** **
@@ -188,7 +142,6 @@ void nas_proc_cleanup(void)
{
LOG_FUNC_IN;
-#ifdef NAS_UE
/* Detach the UE from the EPS network */
int rc = nas_proc_detach(TRUE);
@@ -196,7 +149,6 @@ void nas_proc_cleanup(void)
LOG_TRACE(ERROR, "NAS-PROC - Failed to detach from the network");
}
-#endif
/* Perform the EPS Mobility Manager's clean up procedure */
emm_main_cleanup();
@@ -212,7 +164,6 @@ void nas_proc_cleanup(void)
* NAS procedures triggered by the user
* --------------------------------------------------------------------------
*/
-#ifdef NAS_UE
/****************************************************************************
** **
** Name: nas_proc_enable_s1_mode() **
@@ -1078,7 +1029,7 @@ int nas_proc_activate_pdn(int cid)
** **
***************************************************************************/
int nas_proc_cell_info(int found, tac_t tac, ci_t ci, AcT_t AcT,
- UInt8_t rsrq, UInt8_t rsrp)
+ uint8_t rsrq, uint8_t rsrp)
{
LOG_FUNC_IN;
@@ -1122,7 +1073,7 @@ int nas_proc_cell_info(int found, tac_t tac, ci_t ci, AcT_t AcT,
** Others: None **
** **
***************************************************************************/
-int nas_proc_establish_cnf(const Byte_t *data, UInt32_t len)
+int nas_proc_establish_cnf(const Byte_t *data, uint32_t len)
{
LOG_FUNC_IN;
@@ -1300,7 +1251,7 @@ int nas_proc_ul_transfer_rej(void)
** Others: None **
** **
***************************************************************************/
-int nas_proc_dl_transfer_ind(const Byte_t *data, UInt32_t len)
+int nas_proc_dl_transfer_ind(const Byte_t *data, uint32_t len)
{
LOG_FUNC_IN;
@@ -1322,307 +1273,13 @@ int nas_proc_dl_transfer_ind(const Byte_t *data, UInt32_t len)
LOG_FUNC_RETURN (rc);
}
-#endif // NAS_UE
-
-#ifdef NAS_MME
-/****************************************************************************
- ** **
- ** Name: nas_proc_establish_ind() **
- ** **
- ** Description: Processes the NAS signalling connection establishment **
- ** indication message received from the network **
- ** **
- ** Inputs: ueid: UE identifier **
- ** tac: The code of the tracking area the initia- **
- ** ting UE belongs to **
- ** data: The initial NAS message transfered within **
- ** the message **
- ** len: The length of the initial NAS message **
- ** Others: None **
- ** **
- ** Outputs: None **
- ** Return: RETURNok, RETURNerror **
- ** Others: None **
- ** **
- ***************************************************************************/
-int nas_proc_establish_ind(UInt32_t ueid, tac_t tac,
- const Byte_t *data, UInt32_t len)
-{
- LOG_FUNC_IN;
-
- int rc = RETURNerror;
-
- if (len > 0) {
- emm_sap_t emm_sap;
-
- MSC_LOG_TX_MESSAGE(
- MSC_NAS_MME,
- MSC_NAS_EMM_MME,
- NULL,0,
- "0 EMMAS_ESTABLISH_REQ ue id %06"PRIX32" tac %u", ueid, tac);
- /*
- * Notify the EMM procedure call manager that NAS signalling
- * connection establishment indication message has been received
- * from the Access-Stratum sublayer
- */
- emm_sap.primitive = EMMAS_ESTABLISH_REQ;
- emm_sap.u.emm_as.u.establish.ueid = ueid;
- emm_sap.u.emm_as.u.establish.NASmsg.length = len;
- emm_sap.u.emm_as.u.establish.NASmsg.value = (uint8_t *)data;
- rc = emm_sap_send(&emm_sap);
- }
-
- LOG_FUNC_RETURN (rc);
-}
-
-/****************************************************************************
- ** **
- ** Name: nas_proc_dl_transfer_cnf() **
- ** **
- ** Description: Processes the downlink data transfer confirm message re- **
- ** ceived from the network while NAS message has been succes-**
- ** sfully delivered to the NAS sublayer on the receiver side.**
- ** **
- ** Inputs: ueid: UE identifier **
- ** Others: None **
- ** **
- ** Outputs: None **
- ** Return: RETURNok, RETURNerror **
- ** Others: None **
- ** **
- ***************************************************************************/
-int nas_proc_dl_transfer_cnf(UInt32_t ueid)
-{
- LOG_FUNC_IN;
-
- emm_sap_t emm_sap;
- int rc;
-
- MSC_LOG_TX_MESSAGE(
- MSC_NAS_MME,
- MSC_NAS_EMM_MME,
- NULL,0,
- "0 EMMAS_DATA_IND dl_transfer_conf ue id %06"PRIX32"", ueid);
-
- /*
- * Notify the EMM procedure call manager that downlink NAS message
- * has been successfully delivered to the NAS sublayer on the
- * receiver side
- */
- emm_sap.primitive = EMMAS_DATA_IND;
- emm_sap.u.emm_as.u.data.ueid = ueid;
- emm_sap.u.emm_as.u.data.delivered = TRUE;
- emm_sap.u.emm_as.u.data.NASmsg.length = 0;
- rc = emm_sap_send(&emm_sap);
-
- LOG_FUNC_RETURN (rc);
-}
-
-/****************************************************************************
- ** **
- ** Name: nas_proc_dl_transfer_rej() **
- ** **
- ** Description: Processes the downlink data transfer confirm message re- **
- ** ceived from the network while NAS message has not been **
- ** delivered to the NAS sublayer on the receiver side. **
- ** **
- ** Inputs: ueid: UE identifier **
- ** Others: None **
- ** **
- ** Outputs: None **
- ** Return: RETURNok, RETURNerror **
- ** Others: None **
- ** **
- ***************************************************************************/
-int nas_proc_dl_transfer_rej(UInt32_t ueid)
-{
- LOG_FUNC_IN;
-
- emm_sap_t emm_sap;
- int rc;
-
- MSC_LOG_TX_MESSAGE(
- MSC_NAS_MME,
- MSC_NAS_EMM_MME,
- NULL,0,
- "0 EMMAS_DATA_IND dl_transfer_reject ue id %06"PRIX32"", ueid);
-
- /*
- * Notify the EMM procedure call manager that transmission
- * failure of downlink NAS message indication has been received
- * from lower layers
- */
- emm_sap.primitive = EMMAS_DATA_IND;
- emm_sap.u.emm_as.u.data.ueid = ueid;
- emm_sap.u.emm_as.u.data.delivered = FALSE;
- emm_sap.u.emm_as.u.data.NASmsg.length = 0;
- rc = emm_sap_send(&emm_sap);
-
- LOG_FUNC_RETURN (rc);
-}
-
-/****************************************************************************
- ** **
- ** Name: nas_proc_ul_transfer_ind() **
- ** **
- ** Description: Processes uplink data transfer indication message recei- **
- ** ved from the network **
- ** **
- ** Inputs: ueid: UE identifier **
- ** data: The transfered NAS message **
- ** len: The length of the NAS message **
- ** Others: None **
- ** **
- ** Outputs: None **
- ** Return: RETURNok, RETURNerror **
- ** Others: None **
- ** **
- ***************************************************************************/
-int nas_proc_ul_transfer_ind(UInt32_t ueid, const Byte_t *data, UInt32_t len)
-{
- int rc = RETURNerror;
-
- LOG_FUNC_IN;
-
- if (len > 0) {
- emm_sap_t emm_sap;
- /*
- * Notify the EMM procedure call manager that data transfer
- * indication has been received from the Access-Stratum sublayer
- */
- MSC_LOG_TX_MESSAGE(
- MSC_NAS_MME,
- MSC_NAS_EMM_MME,
- NULL,0,
- "0 EMMAS_DATA_IND ue id %06"PRIX32" len %u", ueid, len);
-
- emm_sap.primitive = EMMAS_DATA_IND;
- emm_sap.u.emm_as.u.data.ueid = ueid;
- emm_sap.u.emm_as.u.data.delivered = TRUE;
- emm_sap.u.emm_as.u.data.NASmsg.length = len;
- emm_sap.u.emm_as.u.data.NASmsg.value = (uint8_t *)data;
- rc = emm_sap_send(&emm_sap);
- }
-
- LOG_FUNC_RETURN (rc);
-}
-
-# if defined(NAS_BUILT_IN_EPC)
-int nas_proc_auth_param_res(emm_cn_auth_res_t *emm_cn_auth_res)
-{
- int rc = RETURNerror;
- emm_sap_t emm_sap;
-
- LOG_FUNC_IN;
-
- MSC_LOG_TX_MESSAGE(
- MSC_NAS_MME,
- MSC_NAS_EMM_MME,
- NULL,0,
- "0 EMMCN_AUTHENTICATION_PARAM_RES");
-
- emm_sap.primitive = EMMCN_AUTHENTICATION_PARAM_RES;
- emm_sap.u.emm_cn.u.auth_res = emm_cn_auth_res;
-
- rc = emm_sap_send(&emm_sap);
-
- LOG_FUNC_RETURN (rc);
-}
-
-int nas_proc_auth_param_fail(emm_cn_auth_fail_t *emm_cn_auth_fail)
-{
- int rc = RETURNerror;
- emm_sap_t emm_sap;
-
- LOG_FUNC_IN;
-
- MSC_LOG_TX_MESSAGE(
- MSC_NAS_MME,
- MSC_NAS_EMM_MME,
- NULL,0,
- "0 EMMCN_AUTHENTICATION_PARAM_FAIL");
-
- emm_sap.primitive = EMMCN_AUTHENTICATION_PARAM_FAIL;
- emm_sap.u.emm_cn.u.auth_fail = emm_cn_auth_fail;
-
- rc = emm_sap_send(&emm_sap);
-
- LOG_FUNC_RETURN (rc);
-}
-
-int nas_proc_deregister_ue(UInt32_t ue_id)
-{
- int rc = RETURNerror;
- emm_sap_t emm_sap;
-
- LOG_FUNC_IN;
-
- MSC_LOG_TX_MESSAGE(
- MSC_NAS_MME,
- MSC_NAS_EMM_MME,
- NULL,0,
- "0 EMMCN_DEREGISTER_UE ue_id %06"PRIX32"",ue_id);
-
- emm_sap.primitive = EMMCN_DEREGISTER_UE;
- emm_sap.u.emm_cn.u.deregister.UEid = ue_id;
-
- rc = emm_sap_send(&emm_sap);
-
- LOG_FUNC_RETURN (rc);
-}
-
-int nas_proc_pdn_connectivity_res(emm_cn_pdn_res_t *emm_cn_pdn_res)
-{
- int rc = RETURNerror;
- emm_sap_t emm_sap;
-
- LOG_FUNC_IN;
-
- MSC_LOG_TX_MESSAGE(
- MSC_NAS_MME,
- MSC_NAS_EMM_MME,
- NULL,0,
- "0 EMMCN_PDN_CONNECTIVITY_RES");
-
- emm_sap.primitive = EMMCN_PDN_CONNECTIVITY_RES;
- emm_sap.u.emm_cn.u.emm_cn_pdn_res = emm_cn_pdn_res;
-
- rc = emm_sap_send(&emm_sap);
-
- LOG_FUNC_RETURN (rc);
-}
-
-int nas_proc_pdn_connectivity_fail(emm_cn_pdn_fail_t *emm_cn_pdn_fail)
-{
- int rc = RETURNerror;
- emm_sap_t emm_sap;
-
- LOG_FUNC_IN;
-
- MSC_LOG_TX_MESSAGE(
- MSC_NAS_MME,
- MSC_NAS_EMM_MME,
- NULL,0,
- "0 EMMCN_PDN_CONNECTIVITY_FAIL");
-
- emm_sap.primitive = EMMCN_PDN_CONNECTIVITY_FAIL;
- emm_sap.u.emm_cn.u.emm_cn_pdn_fail = emm_cn_pdn_fail;
-
- rc = emm_sap_send(&emm_sap);
-
- LOG_FUNC_RETURN (rc);
-}
-# endif
-#endif // NAS_MME
-
/****************************************************************************/
/********************* L O C A L F U N C T I O N S *********************/
/****************************************************************************/
-#ifdef NAS_UE
/****************************************************************************
** **
** Name: _nas_proc_activate() **
@@ -1763,5 +1420,4 @@ static int _nas_proc_deactivate(int cid, int apply_to_all)
LOG_FUNC_RETURN (rc);
}
-#endif // NAS_UE
diff --git a/openair-cn/NAS/EURECOM-NAS/src/nas_proc.h b/openair-cn/NAS/UE/nas_proc.h
old mode 100644
new mode 100755
similarity index 77%
rename from openair-cn/NAS/EURECOM-NAS/src/nas_proc.h
rename to openair-cn/NAS/UE/nas_proc.h
index 11573a1764..8d4897eddb
--- a/openair-cn/NAS/EURECOM-NAS/src/nas_proc.h
+++ b/openair-cn/NAS/UE/nas_proc.h
@@ -45,11 +45,6 @@ Description NAS procedure call manager
#ifndef __NAS_PROC_H__
#define __NAS_PROC_H__
-#if defined(NAS_BUILT_IN_EPC)
-# include "mme_config.h"
-# include "emm_cnDef.h"
-#endif
-
#include "commonDef.h"
#include "networkDef.h"
@@ -69,17 +64,8 @@ Description NAS procedure call manager
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
-#ifdef NAS_UE
void nas_proc_initialize(emm_indication_callback_t emm_cb,
esm_indication_callback_t esm_cb, const char *imei);
-#endif
-#ifdef NAS_MME
-# if defined(NAS_BUILT_IN_EPC)
-void nas_proc_initialize(mme_config_t *mme_config_p);
-# else
-void nas_proc_initialize(void);
-# endif
-#endif
void nas_proc_cleanup(void);
@@ -89,7 +75,6 @@ void nas_proc_cleanup(void);
* --------------------------------------------------------------------------
*/
-#ifdef NAS_UE
int nas_proc_enable_s1_mode(void);
int nas_proc_disable_s1_mode(void);
int nas_proc_get_eps(int *stat);
@@ -123,7 +108,6 @@ int nas_proc_get_pdn_addr(int cid, int *cids, const char **addr1,
const char **addr2, int n_addr_max);
int nas_proc_deactivate_pdn(int cid);
int nas_proc_activate_pdn(int cid);
-#endif
/*
* --------------------------------------------------------------------------
@@ -131,40 +115,18 @@ int nas_proc_activate_pdn(int cid);
* --------------------------------------------------------------------------
*/
-#ifdef NAS_UE
-int nas_proc_cell_info(int found, tac_t tac, ci_t ci, AcT_t rat, UInt8_t rsrp,
- UInt8_t rsrq);
+int nas_proc_cell_info(int found, tac_t tac, ci_t ci, AcT_t rat, uint8_t rsrp,
+ uint8_t rsrq);
-int nas_proc_establish_cnf(const Byte_t *data, UInt32_t len);
+int nas_proc_establish_cnf(const Byte_t *data, uint32_t len);
int nas_proc_establish_rej(void);
int nas_proc_release_ind(int cause);
int nas_proc_ul_transfer_cnf(void);
int nas_proc_ul_transfer_rej(void);
-int nas_proc_dl_transfer_ind(const Byte_t *data, UInt32_t len);
-#endif
+int nas_proc_dl_transfer_ind(const Byte_t *data, uint32_t len);
-#ifdef NAS_MME
-int nas_proc_establish_ind(UInt32_t ueid, tac_t tac, const Byte_t *data,
- UInt32_t len);
-int nas_proc_dl_transfer_cnf(UInt32_t ueid);
-int nas_proc_dl_transfer_rej(UInt32_t ueid);
-int nas_proc_ul_transfer_ind(UInt32_t ueid, const Byte_t *data, UInt32_t len);
-#endif
-
-/*
- * --------------------------------------------------------------------------
- * NAS procedures triggered by the mme applicative layer
- * --------------------------------------------------------------------------
- */
-#if defined(NAS_MME) && defined(NAS_BUILT_IN_EPC)
-int nas_proc_auth_param_res(emm_cn_auth_res_t *emm_cn_auth_res);
-int nas_proc_auth_param_fail(emm_cn_auth_fail_t *emm_cn_auth_fail);
-int nas_proc_deregister_ue(UInt32_t ue_id);
-int nas_proc_pdn_connectivity_res(nas_pdn_connectivity_rsp_t *nas_pdn_connectivity_rsp);
-int nas_proc_pdn_connectivity_fail(nas_pdn_connectivity_fail_t *nas_pdn_connectivity_fail);
-#endif
#endif /* __NAS_PROC_H__*/
diff --git a/openair-cn/NAS/nas_ue_task.c b/openair-cn/NAS/UE/nas_ue_task.c
similarity index 99%
rename from openair-cn/NAS/nas_ue_task.c
rename to openair-cn/NAS/UE/nas_ue_task.c
index ef9b7af02a..48c15a4835 100644
--- a/openair-cn/NAS/nas_ue_task.c
+++ b/openair-cn/NAS/UE/nas_ue_task.c
@@ -36,6 +36,7 @@
# include "user_api.h"
# include "nas_parser.h"
# include "nas_proc.h"
+# include "msc.h"
# define NAS_UE_AUTOSTART 1
@@ -76,7 +77,7 @@ void *nas_ue_task(void *args_p)
int result;
itti_mark_task_ready (TASK_NAS_UE);
-
+ MSC_START_USE();
/* Initialize UE NAS (EURECOM-NAS) */
{
/* Initialize user interface (to exchange AT commands with user process) */
diff --git a/openair-cn/NAS/EURECOM-NAS/src/nas_user.c b/openair-cn/NAS/UE/nas_user.c
similarity index 99%
rename from openair-cn/NAS/EURECOM-NAS/src/nas_user.c
rename to openair-cn/NAS/UE/nas_user.c
index 37e55c7e7f..4abb2f4040 100644
--- a/openair-cn/NAS/EURECOM-NAS/src/nas_user.c
+++ b/openair-cn/NAS/UE/nas_user.c
@@ -43,7 +43,6 @@ Description NAS procedure functions triggered by the user
*****************************************************************************/
-#ifdef NAS_UE
#include "nas_user.h"
#include "userDef.h"
@@ -2676,4 +2675,3 @@ static int _nas_user_proc_clac(const at_command_t *data)
LOG_FUNC_RETURN (ret_code);
}
-#endif // NAS_UE
diff --git a/openair-cn/NAS/EURECOM-NAS/src/nas_user.h b/openair-cn/NAS/UE/nas_user.h
similarity index 100%
rename from openair-cn/NAS/EURECOM-NAS/src/nas_user.h
rename to openair-cn/NAS/UE/nas_user.h
diff --git a/openair-cn/OAISIM_MME/oaisim_mme.c b/openair-cn/OAISIM_MME/oaisim_mme.c
index c2fd062598..14a9871e58 100644
--- a/openair-cn/OAISIM_MME/oaisim_mme.c
+++ b/openair-cn/OAISIM_MME/oaisim_mme.c
@@ -48,7 +48,6 @@
#include "log.h"
#include "timer.h"
#include "sgw_lite_defs.h"
-#include "sgi.h"
#include "mme_app_extern.h"
#include "nas_defs.h"
#include "s11_mme.h"
@@ -74,12 +73,10 @@ int main(int argc, char *argv[])
CHECK_INIT_RETURN(udp_init(&mme_config));
CHECK_INIT_RETURN(s11_mme_init(&mme_config));
CHECK_INIT_RETURN(s1ap_mme_init(&mme_config));
- // if (sgi_init(&mme_config) < 0) return -1;
// if (gtpv1u_init(&mme_config) < 0) return -1;
CHECK_INIT_RETURN(mme_app_init(&mme_config));
CHECK_INIT_RETURN(s6a_init(&mme_config));
- // if (sgw_lite_init(&mme_config) < 0) return -1;
/* Handle signals here */
itti_wait_tasks_end();
diff --git a/openair-cn/OAI_EPC/oai_epc.c b/openair-cn/OAI_EPC/oai_epc.c
index 66eadb9d8c..f2fe6776be 100644
--- a/openair-cn/OAI_EPC/oai_epc.c
+++ b/openair-cn/OAI_EPC/oai_epc.c
@@ -55,7 +55,6 @@
#include "log.h"
#include "timer.h"
#include "sgw_lite_defs.h"
-#include "sgi.h"
#include "mme_app_extern.h"
#include "nas_defs.h"
@@ -65,18 +64,20 @@
#include "s6a_defs.h"
#include "oai_epc.h"
+#include "msc.h"
int main(int argc, char *argv[])
{
- /* Parse the command line for options and set the mme_config accordingly. */
- CHECK_INIT_RETURN(config_parse_opt_line(argc, argv, &mme_config) < 0);
- /* Calling each layer init function */
- CHECK_INIT_RETURN(log_init(&mme_config, oai_epc_log_specific));
CHECK_INIT_RETURN(itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX,
tasks_info, messages_info, messages_definition_xml,
mme_config.itti_config.log_file));
+ /* Parse the command line for options and set the mme_config accordingly. */
+ CHECK_INIT_RETURN(config_parse_opt_line(argc, argv, &mme_config) < 0);
+ MSC_INIT(MSC_MME_GW, THREAD_MAX+TASK_MAX);
+ /* Calling each layer init function */
+ CHECK_INIT_RETURN(log_init(&mme_config, oai_epc_log_specific));
CHECK_INIT_RETURN(nas_init(&mme_config));
CHECK_INIT_RETURN(sctp_init(&mme_config));
CHECK_INIT_RETURN(udp_init(&mme_config));
@@ -85,9 +86,6 @@ int main(int argc, char *argv[])
CHECK_INIT_RETURN(mme_app_init(&mme_config));
CHECK_INIT_RETURN(s6a_init(&mme_config));
CHECK_INIT_RETURN(sgw_lite_init(mme_config.config_file));
-#if ! defined(ENABLE_USE_GTPU_IN_KERNEL)
- CHECK_INIT_RETURN(sgi_init(&spgw_config.pgw_config));
-#endif
/* Handle signals here */
itti_wait_tasks_end();
diff --git a/openair-cn/OAI_SGW/oai_sgw.c b/openair-cn/OAI_SGW/oai_sgw.c
index a70f839a1c..902c4c24c1 100644
--- a/openair-cn/OAI_SGW/oai_sgw.c
+++ b/openair-cn/OAI_SGW/oai_sgw.c
@@ -54,7 +54,6 @@
#include "s11_sgw.h"
#include "sgw_lite_defs.h"
#include "gtpv1u_sgw_defs.h"
-#include "sgi.h"
#include "oai_sgw.h"
@@ -70,7 +69,6 @@ int main(int argc, char *argv[])
CHECK_INIT_RETURN(udp_init(&mme_config));
CHECK_INIT_RETURN(s11_sgw_init(&mme_config));
CHECK_INIT_RETURN(gtpv1u_init(&mme_config));
- CHECK_INIT_RETURN(sgi_init(&pgw_config));
CHECK_INIT_RETURN(sgw_lite_init(mme_config.config_file));
diff --git a/openair-cn/OPENAIRHSS/db/db_connector.c b/openair-cn/OPENAIRHSS/db/db_connector.c
index 6585036b04..f96032896a 100644
--- a/openair-cn/OPENAIRHSS/db/db_connector.c
+++ b/openair-cn/OPENAIRHSS/db/db_connector.c
@@ -394,7 +394,8 @@ int hss_mysql_push_rand_sqn(const char *imsi, uint8_t *rand_p, uint8_t *sqn)
}
sqn_decimal = ((uint64_t)sqn[0] << 40) | ((uint64_t)sqn[1] << 32) |
- (sqn[2] << 24) | (sqn[3] << 16) | (sqn[4] << 8) | sqn[5];
+ ((uint64_t)sqn[2] << 24) | (sqn[3] << 16) |
+ (sqn[4] << 8) | sqn[5];
query_length = sprintf(query, "UPDATE `users` SET `rand`=UNHEX('");
diff --git a/openair-cn/S11/s11_common.c b/openair-cn/S11/s11_common.c
index 58d80e1bd2..b24e82b586 100644
--- a/openair-cn/S11/s11_common.c
+++ b/openair-cn/S11/s11_common.c
@@ -34,10 +34,10 @@
#include "s11_common.h"
-NwRcT s11_ie_indication_generic(NwU8T ieType,
- NwU8T ieLength,
- NwU8T ieInstance,
- NwU8T *ieValue,
+NwRcT s11_ie_indication_generic(uint8_t ieType,
+ uint8_t ieLength,
+ uint8_t ieInstance,
+ uint8_t *ieValue,
void *arg)
{
S11_DEBUG("Received IE Parse Indication for of type %u, length %u, "
diff --git a/openair-cn/S11/s11_common.h b/openair-cn/S11/s11_common.h
index 0712a4a4d2..a1f59006b2 100644
--- a/openair-cn/S11/s11_common.h
+++ b/openair-cn/S11/s11_common.h
@@ -34,10 +34,10 @@
#define S11_WARN(x, args...) fprintf(stdout, "[S11] [W]"x, ##args)
#define S11_ERROR(x, args...) fprintf(stderr, "[S11] [E]"x, ##args)
-NwRcT s11_ie_indication_generic(NwU8T ieType,
- NwU8T ieLength,
- NwU8T ieInstance,
- NwU8T *ieValue,
+NwRcT s11_ie_indication_generic(uint8_t ieType,
+ uint8_t ieLength,
+ uint8_t ieInstance,
+ uint8_t *ieValue,
void *arg);
#endif /* S11_COMMON_H_ */
diff --git a/openair-cn/S11/s11_ie_formatter.c b/openair-cn/S11/s11_ie_formatter.c
index 9381efa5a9..1b3f85acf4 100644
--- a/openair-cn/S11/s11_ie_formatter.c
+++ b/openair-cn/S11/s11_ie_formatter.c
@@ -45,7 +45,7 @@
#include "s11_ie_formatter.h"
NwRcT s11_imsi_ie_get(
- NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T *ieValue, void *arg)
+ uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t *ieValue, void *arg)
{
Imsi_t *imsi;
uint8_t i;
@@ -108,7 +108,7 @@ int s11_imsi_ie_set(NwGtpv2cMsgHandleT *msg, const Imsi_t *imsi)
}
NwRcT s11_msisdn_ie_get(
- NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T *ieValue, void *arg)
+ uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t *ieValue, void *arg)
{
Msisdn_t *msisdn;
uint8_t i;
@@ -143,7 +143,7 @@ NwRcT s11_msisdn_ie_get(
}
NwRcT s11_mei_ie_get(
- NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T *ieValue, void *arg)
+ uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t *ieValue, void *arg)
{
Mei_t *mei = (Mei_t *)arg;
@@ -155,7 +155,7 @@ NwRcT s11_mei_ie_get(
}
NwRcT s11_pdn_type_ie_get(
- NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T *ieValue, void *arg)
+ uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t *ieValue, void *arg)
{
pdn_type_t *pdn_type = (pdn_type_t *)arg;
@@ -207,14 +207,14 @@ int s11_pdn_type_ie_set(NwGtpv2cMsgHandleT *msg, const pdn_type_t *pdn_type)
return -1;
}
- rc = nwGtpv2cMsgAddIe(*msg, NW_GTPV2C_IE_PDN_TYPE, 1, 0, (NwU8T*)&value);
+ rc = nwGtpv2cMsgAddIe(*msg, NW_GTPV2C_IE_PDN_TYPE, 1, 0, (uint8_t*)&value);
DevAssert(NW_OK == rc);
return 0;
}
NwRcT s11_rat_type_ie_get(
- NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T *ieValue, void *arg)
+ uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t *ieValue, void *arg)
{
rat_type_t *rat_type = (rat_type_t *)arg;
@@ -295,7 +295,7 @@ int s11_rat_type_ie_set(NwGtpv2cMsgHandleT *msg, const rat_type_t *rat_type)
return -1;
}
- rc = nwGtpv2cMsgAddIe(*msg, NW_GTPV2C_IE_RAT_TYPE, 1, 0, (NwU8T*)&value);
+ rc = nwGtpv2cMsgAddIe(*msg, NW_GTPV2C_IE_RAT_TYPE, 1, 0, (uint8_t*)&value);
DevAssert(NW_OK == rc);
return 0;
@@ -316,7 +316,7 @@ int s11_ebi_ie_set(NwGtpv2cMsgHandleT *msg, const unsigned ebi)
}
NwRcT s11_ebi_ie_get(
- NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T *ieValue, void *arg)
+ uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t *ieValue, void *arg)
{
uint8_t *ebi = (uint8_t *)arg;
@@ -330,7 +330,7 @@ NwRcT s11_ebi_ie_get(
}
NwRcT s11_cause_ie_get(
- NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T *ieValue, void *arg)
+ uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t *ieValue, void *arg)
{
SGWCause_t *cause = (SGWCause_t *)arg;
@@ -371,7 +371,7 @@ int s11_cause_ie_set(NwGtpv2cMsgHandleT *msg,
}
NwRcT s11_bearer_context_ie_get(
- NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T *ieValue, void *arg)
+ uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t *ieValue, void *arg)
{
bearer_to_create_t *bearer_to_create = (bearer_to_create_t *)arg;
uint8_t read = 0;
@@ -428,7 +428,7 @@ int s11_bearer_context_to_create_ie_set(
}
NwRcT s11_bearer_context_to_modifiy_ie_get(
- NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T *ieValue, void *arg)
+ uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t *ieValue, void *arg)
{
bearer_context_to_modify_t *bearer_to_modify = (bearer_context_to_modify_t *)arg;
uint8_t read = 0;
@@ -467,7 +467,7 @@ NwRcT s11_bearer_context_to_modifiy_ie_get(
}
NwRcT s11_bearer_context_created_ie_get(
- NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T *ieValue, void *arg)
+ uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t *ieValue, void *arg)
{
bearer_context_created_t *bearer_created = (bearer_context_created_t *)arg;
uint8_t read = 0;
@@ -534,7 +534,7 @@ int s11_bearer_context_created_ie_set(
bearer->s1u_sgw_fteid.interface_type,
bearer->s1u_sgw_fteid.teid,
bearer->s1u_sgw_fteid.ipv4 ? htonl(bearer->s1u_sgw_fteid.ipv4_address) : 0,
- bearer->s1u_sgw_fteid.ipv6 ? (NwU8T*)bearer->s1u_sgw_fteid.ipv6_address : NULL);
+ bearer->s1u_sgw_fteid.ipv6 ? (uint8_t*)bearer->s1u_sgw_fteid.ipv6_address : NULL);
DevAssert(NW_OK == rc);
/* End section for grouped IE: bearer context created */
@@ -558,14 +558,14 @@ int s11_apn_restriction_ie_set(
DevAssert(msg != NULL);
rc = nwGtpv2cMsgAddIe(*msg, NW_GTPV2C_IE_APN_RESTRICTION, 1, 0,
- (NwU8T *)&apn_restriction);
+ (uint8_t *)&apn_restriction);
DevAssert(NW_OK == rc);
return 0;
}
NwRcT s11_serving_network_ie_get(
- NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T *ieValue, void *arg)
+ uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t *ieValue, void *arg)
{
ServingNetwork_t *serving_net = (ServingNetwork_t *)arg;
@@ -628,7 +628,7 @@ int s11_serving_network_ie_set(
}
NwRcT s11_fteid_ie_get(
- NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T *ieValue, void *arg)
+ uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t *ieValue, void *arg)
{
uint8_t offset = 0;
FTeid_t *fteid = (FTeid_t *)arg;
@@ -670,7 +670,7 @@ NwRcT s11_fteid_ie_get(
}
NwRcT s11_paa_ie_get(
- NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T *ieValue, void *arg)
+ uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t *ieValue, void *arg)
{
uint8_t offset = 0;
PAA_t *paa = (PAA_t *)arg;
@@ -756,7 +756,7 @@ int s11_paa_ie_set(NwGtpv2cMsgHandleT *msg, const PAA_t *paa)
* and the hyphen (-).
*/
NwRcT s11_apn_ie_get(
- NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T *ieValue, void *arg)
+ uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t *ieValue, void *arg)
{
uint8_t read = 1;
uint8_t word_length;
@@ -831,7 +831,7 @@ int s11_apn_ie_set(NwGtpv2cMsgHandleT *msg, const char *apn)
}
NwRcT s11_ambr_ie_get(
- NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T *ieValue, void *arg)
+ uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t *ieValue, void *arg)
{
ambr_t *ambr = (ambr_t *)arg;
@@ -847,7 +847,7 @@ NwRcT s11_ambr_ie_get(
}
NwRcT s11_uli_ie_get(
- NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T *ieValue, void *arg)
+ uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t *ieValue, void *arg)
{
Uli_t *uli = (Uli_t *)arg;
@@ -886,7 +886,7 @@ int s11_bearer_qos_ie_set(NwGtpv2cMsgHandleT *msg, const BearerQOS_t *bearer_qos
}
NwRcT s11_ip_address_ie_get(
- NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T *ieValue, void *arg)
+ uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t *ieValue, void *arg)
{
gtp_ip_address_t *ip_address = (gtp_ip_address_t *)arg;
@@ -915,7 +915,7 @@ int s11_ip_address_ie_set(NwGtpv2cMsgHandleT *msg,
}
NwRcT s11_delay_value_ie_get(
- NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T *ieValue, void *arg)
+ uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t *ieValue, void *arg)
{
DelayValue_t *delay_value = (DelayValue_t *)arg;
@@ -943,14 +943,14 @@ int s11_delay_value_ie_set(NwGtpv2cMsgHandleT *msg,
value = *delay_value;
- rc = nwGtpv2cMsgAddIe(*msg, NW_GTPV2C_IE_DELAY_VALUE, 1, 0, (NwU8T*)&value);
+ rc = nwGtpv2cMsgAddIe(*msg, NW_GTPV2C_IE_DELAY_VALUE, 1, 0, (uint8_t*)&value);
DevAssert(NW_OK == rc);
return 0;
}
NwRcT s11_ue_time_zone_ie_get(
- NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T *ieValue, void *arg)
+ uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t *ieValue, void *arg)
{
UETimeZone_t *ue_time_zone = (UETimeZone_t *)arg;
@@ -988,7 +988,7 @@ int s11_ue_time_zone_ie_set(NwGtpv2cMsgHandleT *msg,
}
NwRcT s11_target_identification_ie_get(
- NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T *ieValue, void *arg)
+ uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t *ieValue, void *arg)
{
target_identification_t *target_identification = (target_identification_t *)arg;
@@ -1055,7 +1055,7 @@ NwRcT s11_target_identification_ie_get(
}
NwRcT s11_bearer_flags_ie_get(
- NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T *ieValue, void *arg)
+ uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t *ieValue, void *arg)
{
bearer_flags_t *bearer_flags = (bearer_flags_t *)arg;
@@ -1082,14 +1082,14 @@ int s11_bearer_flags_ie_set(NwGtpv2cMsgHandleT *msg,
value = (bearer_flags->vb << 1) | bearer_flags->ppc;
- rc = nwGtpv2cMsgAddIe(*msg, NW_GTPV2C_IE_BEARER_FLAGS, 1, 0, (NwU8T*)&value);
+ rc = nwGtpv2cMsgAddIe(*msg, NW_GTPV2C_IE_BEARER_FLAGS, 1, 0, (uint8_t*)&value);
DevAssert(NW_OK == rc);
return 0;
}
NwRcT s11_indication_flags_ie_get(
- NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T *ieValue, void *arg)
+ uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t *ieValue, void *arg)
{
indication_flags_t *indication_flags = (indication_flags_t*)arg;
@@ -1107,7 +1107,7 @@ NwRcT s11_indication_flags_ie_get(
}
NwRcT s11_fqcsid_ie_get(
- NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T *ieValue, void *arg)
+ uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t *ieValue, void *arg)
{
FQ_CSID_t *fq_csid = (FQ_CSID_t *)arg;
diff --git a/openair-cn/S11/s11_ie_formatter.h b/openair-cn/S11/s11_ie_formatter.h
index 2b2ecb4732..0d820b3462 100644
--- a/openair-cn/S11/s11_ie_formatter.h
+++ b/openair-cn/S11/s11_ie_formatter.h
@@ -37,12 +37,12 @@
* octet n+4 | Number digit m | Number digit m-1 |
*/
NwRcT s11_imsi_ie_get(
- NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T *ieValue, void *arg);
+ uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t *ieValue, void *arg);
int s11_imsi_ie_set(NwGtpv2cMsgHandleT *msg, const Imsi_t *imsi);
NwRcT s11_msisdn_ie_get(
- NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T *ieValue, void *arg);
+ uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t *ieValue, void *arg);
/* PDN Type Information Element
* 3GPP TS 29.274 #8.34
@@ -52,7 +52,7 @@ NwRcT s11_msisdn_ie_get(
* * 3 = IPv4v6
*/
NwRcT s11_pdn_type_ie_get(
- NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T *ieValue, void *arg);
+ uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t *ieValue, void *arg);
int s11_pdn_type_ie_set(NwGtpv2cMsgHandleT *msg, const pdn_type_t *pdn_type);
@@ -61,7 +61,7 @@ int s11_pdn_type_ie_set(NwGtpv2cMsgHandleT *msg, const pdn_type_t *pdn_type);
* for S11 interface defined in 3GPP TS 29.274 #8.17.
*/
NwRcT s11_rat_type_ie_get(
- NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T *ieValue, void *arg);
+ uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t *ieValue, void *arg);
int s11_rat_type_ie_set(NwGtpv2cMsgHandleT *msg, const rat_type_t *rat_type);
@@ -69,7 +69,7 @@ int s11_rat_type_ie_set(NwGtpv2cMsgHandleT *msg, const rat_type_t *rat_type);
* 3GPP TS 29.274 #8.8
*/
NwRcT s11_ebi_ie_get(
- NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T *ieValue, void *arg);
+ uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t *ieValue, void *arg);
int s11_ebi_ie_set(NwGtpv2cMsgHandleT *msg, const unsigned ebi);
@@ -77,13 +77,13 @@ int s11_ebi_ie_set(NwGtpv2cMsgHandleT *msg, const unsigned ebi);
* 3GPP TS 29.274 Table 7.2.1-2.
*/
NwRcT s11_bearer_context_ie_get(
- NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T *ieValue, void *arg);
+ uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t *ieValue, void *arg);
int s11_bearer_context_to_create_ie_set(
NwGtpv2cMsgHandleT *msg, const bearer_to_create_t *bearer_to_create);
NwRcT s11_bearer_context_to_modifiy_ie_get(
- NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T *ieValue, void *arg);
+ uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t *ieValue, void *arg);
/* EPS Bearer Id Information Element
* 3GPP TS 29.274 #8.8
@@ -93,14 +93,14 @@ int s11_ebi_ie_set(NwGtpv2cMsgHandleT *msg, const unsigned ebi);
/* Cause Information Element */
NwRcT s11_cause_ie_get(
- NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T *ieValue, void *arg);
+ uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t *ieValue, void *arg);
int s11_cause_ie_set(NwGtpv2cMsgHandleT *msg,
const gtp_cause_t *cause);
/* Bearer Context Created grouped Information Element */
NwRcT s11_bearer_context_created_ie_get(
- NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T *ieValue, void *arg);
+ uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t *ieValue, void *arg);
int s11_bearer_context_created_ie_set(
NwGtpv2cMsgHandleT *msg, const bearer_context_created_t *bearer);
@@ -109,18 +109,18 @@ int s11_bearer_context_created_ie_set(
* 3GPP TS 29.274 #8.18
*/
NwRcT s11_serving_network_ie_get(
- NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T *ieValue, void *arg);
+ uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t *ieValue, void *arg);
int s11_serving_network_ie_set(
NwGtpv2cMsgHandleT *msg,
const ServingNetwork_t *serving_network);
NwRcT s11_fteid_ie_get(
- NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T *ieValue, void *arg);
+ uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t *ieValue, void *arg);
/* PDN Address Allocation Information Element */
NwRcT s11_paa_ie_get(
- NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T *ieValue, void *arg);
+ uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t *ieValue, void *arg);
int s11_paa_ie_set(NwGtpv2cMsgHandleT *msg, const PAA_t *paa);
@@ -131,18 +131,18 @@ int s11_paa_ie_set(NwGtpv2cMsgHandleT *msg, const PAA_t *paa);
* The encoding of the APN field follows 3GPP TS 23.003 subclause 9.1
*/
NwRcT s11_apn_ie_get(
- NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T *ieValue, void *arg);
+ uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t *ieValue, void *arg);
int s11_apn_ie_set(NwGtpv2cMsgHandleT *msg, const char *apn);
NwRcT s11_ambr_ie_get(
- NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T *ieValue, void *arg);
+ uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t *ieValue, void *arg);
NwRcT s11_mei_ie_get(
- NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T *ieValue, void *arg);
+ uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t *ieValue, void *arg);
NwRcT s11_uli_ie_get(
- NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T *ieValue, void *arg);
+ uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t *ieValue, void *arg);
/* APN restrtiction Information Element */
int s11_apn_restriction_ie_set(
@@ -157,7 +157,7 @@ int s11_bearer_qos_ie_set(NwGtpv2cMsgHandleT *msg, const BearerQOS_t *bearer_qos
* 3GPP TS 29.274 #8.9
*/
NwRcT s11_ip_address_ie_get(
- NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T *ieValue, void *arg);
+ uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t *ieValue, void *arg);
int s11_ip_address_ie_set(NwGtpv2cMsgHandleT *msg,
const gtp_ip_address_t *ip_address);
@@ -166,7 +166,7 @@ int s11_ip_address_ie_set(NwGtpv2cMsgHandleT *msg,
* 3GPP TS 29.274 #8.27
*/
NwRcT s11_delay_value_ie_get(
- NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T *ieValue, void *arg);
+ uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t *ieValue, void *arg);
int s11_delay_value_ie_set(NwGtpv2cMsgHandleT *msg,
const DelayValue_t *delay_value);
@@ -175,7 +175,7 @@ int s11_delay_value_ie_set(NwGtpv2cMsgHandleT *msg,
* 3GPP TS 29.274 #8.44
*/
NwRcT s11_ue_time_zone_ie_get(
- NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T *ieValue, void *arg);
+ uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t *ieValue, void *arg);
int s11_ue_time_zone_ie_set(NwGtpv2cMsgHandleT *msg,
const UETimeZone_t *ue_time_zone);
@@ -184,25 +184,25 @@ int s11_ue_time_zone_ie_set(NwGtpv2cMsgHandleT *msg,
* 3GPP TS 29.274 #8.51
*/
NwRcT s11_target_identification_ie_get(
- NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T *ieValue, void *arg);
+ uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t *ieValue, void *arg);
/* Bearer Flags Information Element
* 3GPP TS 29.274 #8.32
*/
NwRcT s11_bearer_flags_ie_get(
- NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T *ieValue, void *arg);
+ uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t *ieValue, void *arg);
int s11_bearer_flags_ie_set(NwGtpv2cMsgHandleT *msg,
const bearer_flags_t *bearer_flags);
NwRcT s11_indication_flags_ie_get(
- NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T *ieValue, void *arg);
+ uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t *ieValue, void *arg);
/* FQ-CSID Information Element
* 3GPP TS 29.274 #8.62
*/
NwRcT s11_fqcsid_ie_get(
- NwU8T ieType, NwU8T ieLength, NwU8T ieInstance, NwU8T *ieValue, void *arg);
+ uint8_t ieType, uint8_t ieLength, uint8_t ieInstance, uint8_t *ieValue, void *arg);
#endif /* S11_IE_FORMATTER_H_ */
diff --git a/openair-cn/S11/s11_mme_session_manager.c b/openair-cn/S11/s11_mme_session_manager.c
index d0fe543a8c..5adf2c492b 100644
--- a/openair-cn/S11/s11_mme_session_manager.c
+++ b/openair-cn/S11/s11_mme_session_manager.c
@@ -70,7 +70,7 @@ int s11_mme_create_session_request(NwGtpv2cStackHandleT *stack_p,
/* Add recovery if contacting the peer for the first time */
rc = nwGtpv2cMsgAddIe((ulp_req.hMsg), NW_GTPV2C_IE_RECOVERY, 1, 0,
- (NwU8T*)&restart_counter);
+ (uint8_t*)&restart_counter);
DevAssert(NW_OK == rc);
/* Putting the information Elements */
@@ -114,8 +114,8 @@ int s11_mme_handle_create_session_response(NwGtpv2cStackHandleT *stack_p,
NwGtpv2cUlpApiT *pUlpApi)
{
NwRcT rc = NW_OK;
- NwU8T offendingIeType, offendingIeInstance;
- NwU16T offendingIeLength;
+ uint8_t offendingIeType, offendingIeInstance;
+ uint16_t offendingIeLength;
SgwCreateSessionResponse *create_session_resp_p;
MessageDef *message_p;
diff --git a/openair-cn/S11/s11_mme_task.c b/openair-cn/S11/s11_mme_task.c
index fad5aecda7..d2a52aff96 100644
--- a/openair-cn/S11/s11_mme_task.c
+++ b/openair-cn/S11/s11_mme_task.c
@@ -55,9 +55,9 @@ static NwGtpv2cStackHandleT s11_mme_stack_handle;
static
NwRcT s11_mme_log_wrapper(NwGtpv2cLogMgrHandleT hLogMgr,
- NwU32T logLevel,
+ uint32_t logLevel,
NwCharT* file,
- NwU32T line,
+ uint32_t line,
NwCharT* logStr)
{
S11_DEBUG("%s\n", logStr);
@@ -101,10 +101,10 @@ NwRcT s11_mme_ulp_process_stack_req_cb(
static
NwRcT s11_mme_send_udp_msg(
NwGtpv2cUdpHandleT udpHandle,
- NwU8T *buffer,
- NwU32T buffer_len,
- NwU32T peerIpAddr,
- NwU32T peerPort)
+ uint8_t *buffer,
+ uint32_t buffer_len,
+ uint32_t peerIpAddr,
+ uint32_t peerPort)
{
// Create and alloc new message
MessageDef *message_p;
@@ -128,9 +128,9 @@ NwRcT s11_mme_send_udp_msg(
static
NwRcT s11_mme_start_timer_wrapper(
NwGtpv2cTimerMgrHandleT tmrMgrHandle,
- NwU32T timeoutSec,
- NwU32T timeoutUsec,
- NwU32T tmrType,
+ uint32_t timeoutSec,
+ uint32_t timeoutUsec,
+ uint32_t tmrType,
void *timeoutArg,
NwGtpv2cTimerHandleT *hTmr)
{
diff --git a/openair-cn/S11/s11_sgw.c b/openair-cn/S11/s11_sgw.c
index a2f86ddabb..ae62a1334a 100644
--- a/openair-cn/S11/s11_sgw.c
+++ b/openair-cn/S11/s11_sgw.c
@@ -104,10 +104,10 @@ NwRcT s11_sgw_ulp_process_stack_req_cb(
static
NwRcT s11_sgw_send_udp_msg(
NwGtpv2cUdpHandleT udpHandle,
- NwU8T *buffer,
- NwU32T buffer_len,
- NwU32T peerIpAddr,
- NwU32T peerPort)
+ uint8_t *buffer,
+ uint32_t buffer_len,
+ uint32_t peerIpAddr,
+ uint32_t peerPort)
{
// Create and alloc new message
MessageDef *message_p;
@@ -130,9 +130,9 @@ NwRcT s11_sgw_send_udp_msg(
static
NwRcT s11_sgw_log_wrapper(NwGtpv2cLogMgrHandleT hLogMgr,
- NwU32T logLevel,
+ uint32_t logLevel,
NwCharT* file,
- NwU32T line,
+ uint32_t line,
NwCharT* logStr)
{
S11_DEBUG("%s\n", logStr);
@@ -142,9 +142,9 @@ NwRcT s11_sgw_log_wrapper(NwGtpv2cLogMgrHandleT hLogMgr,
static
NwRcT s11_sgw_start_timer_wrapper(
NwGtpv2cTimerMgrHandleT tmrMgrHandle,
- NwU32T timeoutSec,
- NwU32T timeoutUsec,
- NwU32T tmrType,
+ uint32_t timeoutSec,
+ uint32_t timeoutUsec,
+ uint32_t tmrType,
void *timeoutArg,
NwGtpv2cTimerHandleT *hTmr)
{
diff --git a/openair-cn/S11/s11_sgw_bearer_manager.c b/openair-cn/S11/s11_sgw_bearer_manager.c
index bf0be507cc..27337a25f3 100644
--- a/openair-cn/S11/s11_sgw_bearer_manager.c
+++ b/openair-cn/S11/s11_sgw_bearer_manager.c
@@ -50,8 +50,8 @@ int s11_sgw_handle_modify_bearer_request(NwGtpv2cStackHandleT *stack_p,
NwGtpv2cUlpApiT *pUlpApi)
{
NwRcT rc = NW_OK;
- NwU8T offendingIeType, offendingIeInstance;
- NwU16T offendingIeLength;
+ uint8_t offendingIeType, offendingIeInstance;
+ uint16_t offendingIeLength;
SgwModifyBearerRequest *modify_bearer_request_p;
MessageDef *message_p;
diff --git a/openair-cn/S11/s11_sgw_session_manager.c b/openair-cn/S11/s11_sgw_session_manager.c
index 13440645fd..dc313c7935 100644
--- a/openair-cn/S11/s11_sgw_session_manager.c
+++ b/openair-cn/S11/s11_sgw_session_manager.c
@@ -50,8 +50,8 @@ int s11_sgw_handle_create_session_request(NwGtpv2cStackHandleT *stack_p,
NwGtpv2cUlpApiT *pUlpApi)
{
NwRcT rc = NW_OK;
- NwU8T offendingIeType, offendingIeInstance;
- NwU16T offendingIeLength;
+ uint8_t offendingIeType, offendingIeInstance;
+ uint16_t offendingIeLength;
SgwCreateSessionRequest *create_session_request_p;
MessageDef *message_p;
@@ -352,8 +352,8 @@ int s11_sgw_handle_delete_session_request(NwGtpv2cStackHandleT *stack_p,
NwGtpv2cUlpApiT *pUlpApi)
{
NwRcT rc = NW_OK;
- NwU8T offendingIeType, offendingIeInstance;
- NwU16T offendingIeLength;
+ uint8_t offendingIeType, offendingIeInstance;
+ uint16_t offendingIeLength;
SgwDeleteSessionRequest *delete_session_request_p;
MessageDef *message_p;
diff --git a/openair-cn/S1AP/s1ap_eNB.c b/openair-cn/S1AP/s1ap_eNB.c
index 8841127929..da11f2893f 100644
--- a/openair-cn/S1AP/s1ap_eNB.c
+++ b/openair-cn/S1AP/s1ap_eNB.c
@@ -56,7 +56,7 @@
#include "s1ap_eNB_itti_messaging.h"
#include "s1ap_eNB_ue_context.h" // test, to be removed
-
+#include "msc.h"
#include "assertions.h"
#include "conversions.h"
@@ -98,7 +98,9 @@ uint32_t s1ap_generate_eNB_id(void)
static void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p,
net_ip_address_t *mme_ip_address,
- net_ip_address_t *local_ip_addr)
+ net_ip_address_t *local_ip_addr,
+ uint16_t in_streams,
+ uint16_t out_streams)
{
MessageDef *message_p = NULL;
sctp_new_association_req_t *sctp_new_association_req_p = NULL;
@@ -114,6 +116,9 @@ static void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p,
sctp_new_association_req_p->port = S1AP_PORT_NUMBER;
sctp_new_association_req_p->ppid = S1AP_SCTP_PPID;
+ sctp_new_association_req_p->in_streams = in_streams;
+ sctp_new_association_req_p->out_streams = out_streams;
+
memcpy(&sctp_new_association_req_p->remote_address,
mme_ip_address,
sizeof(*mme_ip_address));
@@ -197,8 +202,11 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *
/* Trying to connect to provided list of MME ip address */
for (index = 0; index < s1ap_register_eNB->nb_mme; index++) {
- s1ap_eNB_register_mme(new_instance, &s1ap_register_eNB->mme_ip_address[index],
- &s1ap_register_eNB->enb_ip_address);
+ s1ap_eNB_register_mme(new_instance,
+ &s1ap_register_eNB->mme_ip_address[index],
+ &s1ap_register_eNB->enb_ip_address,
+ s1ap_register_eNB->sctp_in_streams,
+ s1ap_register_eNB->sctp_out_streams);
}
}
@@ -264,6 +272,7 @@ void *s1ap_eNB_task(void *arg)
s1ap_eNB_prepare_internal_data();
itti_mark_task_ready(TASK_S1AP);
+ MSC_START_USE();
while (1) {
itti_receive_msg(TASK_S1AP, &received_msg);
diff --git a/openair-cn/S1AP/s1ap_eNB_context_management_procedures.c b/openair-cn/S1AP/s1ap_eNB_context_management_procedures.c
index 314dbd3c8f..0e6de0b0f2 100755
--- a/openair-cn/S1AP/s1ap_eNB_context_management_procedures.c
+++ b/openair-cn/S1AP/s1ap_eNB_context_management_procedures.c
@@ -117,7 +117,7 @@ int s1ap_ue_context_release_complete(instance_t instance,
/* UE associated signalling -> use the allocated stream */
s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance,
ue_context_p->mme_ref->assoc_id, buffer,
- length, ue_context_p->stream);
+ length, ue_context_p->tx_stream);
//LG s1ap_eNB_itti_send_sctp_close_association(s1ap_eNB_instance_p->instance,
@@ -234,7 +234,7 @@ int s1ap_ue_context_release_req(instance_t instance,
/* UE associated signalling -> use the allocated stream */
s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance,
ue_context_p->mme_ref->assoc_id, buffer,
- length, ue_context_p->stream);
+ length, ue_context_p->tx_stream);
return 0;
}
diff --git a/openair-cn/S1AP/s1ap_eNB_encoder.c b/openair-cn/S1AP/s1ap_eNB_encoder.c
index 90bcf5888a..5ec2f21613 100644
--- a/openair-cn/S1AP/s1ap_eNB_encoder.c
+++ b/openair-cn/S1AP/s1ap_eNB_encoder.c
@@ -38,7 +38,6 @@
#include
#include
-#include "assertions.h"
#include "conversions.h"
#include "intertask_interface.h"
diff --git a/openair-cn/S1AP/s1ap_eNB_handlers.c b/openair-cn/S1AP/s1ap_eNB_handlers.c
index 56528f13bb..7469e83ac2 100644
--- a/openair-cn/S1AP/s1ap_eNB_handlers.c
+++ b/openair-cn/S1AP/s1ap_eNB_handlers.c
@@ -67,6 +67,11 @@ int s1ap_eNB_handle_s1_setup_failure(uint32_t assoc_id,
uint32_t stream,
struct s1ap_message_s *message_p);
+static
+int s1ap_eNB_handle_error_indication(uint32_t assoc_id,
+ uint32_t stream,
+ struct s1ap_message_s *message_p);
+
static
int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id,
uint32_t stream,
@@ -94,7 +99,7 @@ s1ap_message_decoded_callback messages_callback[][3] = {
{ 0, 0, 0 }, /* initialUEMessage */
{ 0, 0, 0 }, /* uplinkNASTransport */
{ 0, 0, 0 }, /* Reset */
- { 0, 0, 0 }, /* ErrorIndication */
+ { s1ap_eNB_handle_error_indication, 0, 0 }, /* ErrorIndication */
{ 0, 0, 0 }, /* NASNonDeliveryIndication */
{ 0, s1ap_eNB_handle_s1_setup_response, s1ap_eNB_handle_s1_setup_failure }, /* S1Setup */
{ 0, 0, 0 }, /* UEContextReleaseRequest */
@@ -286,7 +291,10 @@ int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id,
/* The list of served gummei can contain at most 8 elements.
* LTE related gummei is the first element in the list, i.e with an id of 0.
*/
- DevAssert(s1SetupResponse_p->servedGUMMEIs.list.count == 1);
+ S1AP_DEBUG("servedGUMMEIs.list.count %d\n",s1SetupResponse_p->servedGUMMEIs.list.count);
+ DevAssert(s1SetupResponse_p->servedGUMMEIs.list.count > 0);
+ DevAssert(s1SetupResponse_p->servedGUMMEIs.list.count <= 8);
+
for (i = 0; i < s1SetupResponse_p->servedGUMMEIs.list.count; i++) {
struct S1ap_ServedGUMMEIsItem *gummei_item_p;
@@ -300,12 +308,13 @@ int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id,
STAILQ_INIT(&new_gummei_p->served_plmns);
STAILQ_INIT(&new_gummei_p->served_group_ids);
STAILQ_INIT(&new_gummei_p->mme_codes);
-
+
+ S1AP_DEBUG("servedPLMNs.list.count %d\n",gummei_item_p->servedPLMNs.list.count);
for (j = 0; j < gummei_item_p->servedPLMNs.list.count; j++) {
S1ap_PLMNidentity_t *plmn_identity_p;
struct plmn_identity_s *new_plmn_identity_p;
-
- plmn_identity_p = gummei_item_p->servedPLMNs.list.array[i];
+
+ plmn_identity_p = gummei_item_p->servedPLMNs.list.array[j];
new_plmn_identity_p = calloc(1, sizeof(struct plmn_identity_s));
TBCD_TO_MCC_MNC(plmn_identity_p, new_plmn_identity_p->mcc,
new_plmn_identity_p->mnc, new_plmn_identity_p->mnc_digit_length);
@@ -317,7 +326,7 @@ int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id,
S1ap_MME_Group_ID_t *mme_group_id_p;
struct served_group_id_s *new_group_id_p;
- mme_group_id_p = gummei_item_p->servedGroupIDs.list.array[i];
+ mme_group_id_p = gummei_item_p->servedGroupIDs.list.array[j];
new_group_id_p = calloc(1, sizeof(struct served_group_id_s));
OCTET_STRING_TO_INT16(mme_group_id_p, new_group_id_p->mme_group_id);
STAILQ_INSERT_TAIL(&new_gummei_p->served_group_ids, new_group_id_p, next);
@@ -328,7 +337,7 @@ int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id,
S1ap_MME_Code_t *mme_code_p;
struct mme_code_s *new_mme_code_p;
- mme_code_p = gummei_item_p->servedMMECs.list.array[i];
+ mme_code_p = gummei_item_p->servedMMECs.list.array[j];
new_mme_code_p = calloc(1, sizeof(struct mme_code_s));
OCTET_STRING_TO_INT8(mme_code_p, new_mme_code_p->mme_code);
@@ -418,6 +427,264 @@ int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id,
return 0;
}
+
+static
+int s1ap_eNB_handle_error_indication(uint32_t assoc_id,
+ uint32_t stream,
+ struct s1ap_message_s *message_p)
+{
+ S1ap_ErrorIndicationIEs_t *s1_error_indication_p;
+ s1ap_eNB_mme_data_t *mme_desc_p;
+
+ DevAssert(message_p != NULL);
+
+ s1_error_indication_p = &message_p->msg.s1ap_ErrorIndicationIEs;
+
+ /* S1 Setup Failure == Non UE-related procedure -> stream 0 */
+ if (stream != 0) {
+ S1AP_WARN("[SCTP %d] Received s1 Error indication on stream != 0 (%d)\n",
+ assoc_id, stream);
+ }
+
+ if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) {
+ S1AP_ERROR("[SCTP %d] Received S1 Error indication for non existing "
+ "MME context\n", assoc_id);
+ return -1;
+ }
+ if ( s1_error_indication_p->presenceMask & S1AP_ERRORINDICATIONIES_MME_UE_S1AP_ID_PRESENT) {
+ S1AP_WARN("Received S1 Error indication MME UE S1AP ID 0x%x\n", s1_error_indication_p->mme_ue_s1ap_id);
+ }
+ if ( s1_error_indication_p->presenceMask & S1AP_ERRORINDICATIONIES_ENB_UE_S1AP_ID_PRESENT) {
+ S1AP_WARN("Received S1 Error indication eNB UE S1AP ID 0x%x\n", s1_error_indication_p->eNB_UE_S1AP_ID);
+ }
+
+ if ( s1_error_indication_p->presenceMask & S1AP_ERRORINDICATIONIES_CAUSE_PRESENT) {
+ switch(s1_error_indication_p->cause.present) {
+ case S1ap_Cause_PR_NOTHING:
+ S1AP_WARN("Received S1 Error indication cause NOTHING\n");
+ break;
+ case S1ap_Cause_PR_radioNetwork:
+ switch (s1_error_indication_p->cause.choice.radioNetwork) {
+ case S1ap_CauseRadioNetwork_unspecified:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_unspecified\n");
+ break;
+ case S1ap_CauseRadioNetwork_tx2relocoverall_expiry:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_tx2relocoverall_expiry\n");
+ break;
+ case S1ap_CauseRadioNetwork_successful_handover:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_successful_handover\n");
+ break;
+ case S1ap_CauseRadioNetwork_release_due_to_eutran_generated_reason:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_release_due_to_eutran_generated_reason\n");
+ break;
+ case S1ap_CauseRadioNetwork_handover_cancelled:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_handover_cancelled\n");
+ break;
+ case S1ap_CauseRadioNetwork_partial_handover:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_partial_handover\n");
+ break;
+ case S1ap_CauseRadioNetwork_ho_failure_in_target_EPC_eNB_or_target_system:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_ho_failure_in_target_EPC_eNB_or_target_system\n");
+ break;
+ case S1ap_CauseRadioNetwork_ho_target_not_allowed:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_ho_target_not_allowed\n");
+ break;
+ case S1ap_CauseRadioNetwork_tS1relocoverall_expiry:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_tS1relocoverall_expiry\n");
+ break;
+ case S1ap_CauseRadioNetwork_tS1relocprep_expiry:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_tS1relocprep_expiry\n");
+ break;
+ case S1ap_CauseRadioNetwork_cell_not_available:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_cell_not_available\n");
+ break;
+ case S1ap_CauseRadioNetwork_unknown_targetID:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_unknown_targetID\n");
+ break;
+ case S1ap_CauseRadioNetwork_no_radio_resources_available_in_target_cell:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_no_radio_resources_available_in_target_cell\n");
+ break;
+ case S1ap_CauseRadioNetwork_unknown_mme_ue_s1ap_id:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_unknown_mme_ue_s1ap_id\n");
+ break;
+ case S1ap_CauseRadioNetwork_unknown_enb_ue_s1ap_id:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_unknown_enb_ue_s1ap_id\n");
+ break;
+ case S1ap_CauseRadioNetwork_unknown_pair_ue_s1ap_id:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_unknown_pair_ue_s1ap_id\n");
+ break;
+ case S1ap_CauseRadioNetwork_handover_desirable_for_radio_reason:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_handover_desirable_for_radio_reason\n");
+ break;
+ case S1ap_CauseRadioNetwork_time_critical_handover:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_time_critical_handover\n");
+ break;
+ case S1ap_CauseRadioNetwork_resource_optimisation_handover:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_resource_optimisation_handover\n");
+ break;
+ case S1ap_CauseRadioNetwork_reduce_load_in_serving_cell:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_reduce_load_in_serving_cell\n");
+ break;
+ case S1ap_CauseRadioNetwork_user_inactivity:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_user_inactivity\n");
+ break;
+ case S1ap_CauseRadioNetwork_radio_connection_with_ue_lost:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_radio_connection_with_ue_lost\n");
+ break;
+ case S1ap_CauseRadioNetwork_load_balancing_tau_required:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_load_balancing_tau_required\n");
+ break;
+ case S1ap_CauseRadioNetwork_cs_fallback_triggered:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_cs_fallback_triggered\n");
+ break;
+ case S1ap_CauseRadioNetwork_ue_not_available_for_ps_service:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_ue_not_available_for_ps_service\n");
+ break;
+ case S1ap_CauseRadioNetwork_radio_resources_not_available:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_radio_resources_not_available\n");
+ break;
+ case S1ap_CauseRadioNetwork_failure_in_radio_interface_procedure:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_failure_in_radio_interface_procedure\n");
+ break;
+ case S1ap_CauseRadioNetwork_invals1ap_id_qos_combination:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_invals1ap_id_qos_combination\n");
+ break;
+ case S1ap_CauseRadioNetwork_interrat_redirection:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_interrat_redirection\n");
+ break;
+ case S1ap_CauseRadioNetwork_interaction_with_other_procedure:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_interaction_with_other_procedure\n");
+ break;
+ case S1ap_CauseRadioNetwork_unknown_E_RAB_ID:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_unknown_E_RAB_ID\n");
+ break;
+ case S1ap_CauseRadioNetwork_multiple_E_RAB_ID_instances:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_multiple_E_RAB_ID_instances\n");
+ break;
+ case S1ap_CauseRadioNetwork_encryption_and_or_integrity_protection_algorithms_not_supported:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_encryption_and_or_integrity_protection_algorithms_not_supported\n");
+ break;
+ case S1ap_CauseRadioNetwork_s1_intra_system_handover_triggered:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_s1_intra_system_handover_triggered\n");
+ break;
+ case S1ap_CauseRadioNetwork_s1_inter_system_handover_triggered:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_s1_inter_system_handover_triggered\n");
+ break;
+ case S1ap_CauseRadioNetwork_x2_handover_triggered:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_x2_handover_triggered\n");
+ break;
+ case S1ap_CauseRadioNetwork_redirection_towards_1xRTT:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_redirection_towards_1xRTT\n");
+ break;
+ case S1ap_CauseRadioNetwork_not_supported_QCI_value:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_not_supported_QCI_value\n");
+ break;
+ case S1ap_CauseRadioNetwork_invals1ap_id_CSG_Id:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_invals1ap_id_CSG_Id\n");
+ break;
+ default:
+ S1AP_WARN("Received S1 Error indication cause radio network case not handled\n");
+ }
+ break;
+
+ case S1ap_Cause_PR_transport:
+ switch (s1_error_indication_p->cause.choice.transport) {
+ case S1ap_CauseTransport_transport_resource_unavailable:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseTransport_transport_resource_unavailable\n");
+ break;
+ case S1ap_CauseTransport_unspecified:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseTransport_unspecified\n");
+ break;
+ default:
+ S1AP_WARN("Received S1 Error indication cause transport case not handled\n");
+ }
+ break;
+
+ case S1ap_Cause_PR_nas:
+ switch (s1_error_indication_p->cause.choice.nas) {
+ case S1ap_CauseNas_normal_release:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseNas_normal_release\n");
+ break;
+ case S1ap_CauseNas_authentication_failure:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseNas_authentication_failure\n");
+ break;
+ case S1ap_CauseNas_detach:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseNas_detach\n");
+ break;
+ case S1ap_CauseNas_unspecified:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseNas_unspecified\n");
+ break;
+ case S1ap_CauseNas_csg_subscription_expiry:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseNas_csg_subscription_expiry\n");
+ break;
+ default:
+ S1AP_WARN("Received S1 Error indication cause nas case not handled\n");
+ }
+ break;
+
+ case S1ap_Cause_PR_protocol:
+ switch (s1_error_indication_p->cause.choice.protocol) {
+ case S1ap_CauseProtocol_transfer_syntax_error:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseProtocol_transfer_syntax_error\n");
+ break;
+ case S1ap_CauseProtocol_abstract_syntax_error_reject:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseProtocol_abstract_syntax_error_reject\n");
+ break;
+ case S1ap_CauseProtocol_abstract_syntax_error_ignore_and_notify:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseProtocol_abstract_syntax_error_ignore_and_notify\n");
+ break;
+ case S1ap_CauseProtocol_message_not_compatible_with_receiver_state:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseProtocol_message_not_compatible_with_receiver_state\n");
+ break;
+ case S1ap_CauseProtocol_semantic_error:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseProtocol_semantic_error\n");
+ break;
+ case S1ap_CauseProtocol_abstract_syntax_error_falsely_constructed_message:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseProtocol_abstract_syntax_error_falsely_constructed_message\n");
+ break;
+ case S1ap_CauseProtocol_unspecified:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseProtocol_unspecified\n");
+ break;
+ default:
+ S1AP_WARN("Received S1 Error indication cause protocol case not handled\n");
+ }
+ break;
+
+ case S1ap_Cause_PR_misc:
+ switch (s1_error_indication_p->cause.choice.protocol) {
+ case S1ap_CauseMisc_control_processing_overload:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseMisc_control_processing_overload\n");
+ break;
+ case S1ap_CauseMisc_not_enough_user_plane_processing_resources:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseMisc_not_enough_user_plane_processing_resources\n");
+ break;
+ case S1ap_CauseMisc_hardware_failure:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseMisc_hardware_failure\n");
+ break;
+ case S1ap_CauseMisc_om_intervention:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseMisc_om_intervention\n");
+ break;
+ case S1ap_CauseMisc_unspecified:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseMisc_unspecified\n");
+ break;
+ case S1ap_CauseMisc_unknown_PLMN:
+ S1AP_WARN("Received S1 Error indication S1ap_CauseMisc_unknown_PLMN\n");
+ break;
+ default:
+ S1AP_WARN("Received S1 Error indication cause misc case not handled\n");
+ }
+ break;
+ }
+ }
+ if ( s1_error_indication_p->presenceMask & S1AP_ERRORINDICATIONIES_CRITICALITYDIAGNOSTICS_PRESENT) {
+ // TODO continue
+ }
+ // TODO continue
+
+ return 0;
+}
+
+
static
int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id,
uint32_t stream,
@@ -449,12 +716,14 @@ int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id,
}
/* Initial context request = UE-related procedure -> stream != 0 */
- if (stream != ue_desc_p->stream) {
- S1AP_ERROR("[SCTP %d] Received UE-related procedure on stream (%d) whereas expecting (%d)\n",
- assoc_id, stream, ue_desc_p->stream);
+ if (stream == 0) {
+ S1AP_ERROR("[SCTP %d] Received UE-related procedure on stream (%d)\n",
+ assoc_id, stream);
return -1;
}
+ ue_desc_p->rx_stream = stream;
+
ue_desc_p->mme_ue_s1ap_id = initialContextSetupRequest_p->mme_ue_s1ap_id;
message_p = itti_alloc_new_message(TASK_S1AP, S1AP_INITIAL_CONTEXT_SETUP_REQ);
diff --git a/openair-cn/S1AP/s1ap_eNB_nas_procedures.c b/openair-cn/S1AP/s1ap_eNB_nas_procedures.c
index 4521148984..612d6dfc7e 100644
--- a/openair-cn/S1AP/s1ap_eNB_nas_procedures.c
+++ b/openair-cn/S1AP/s1ap_eNB_nas_procedures.c
@@ -155,7 +155,7 @@ int s1ap_eNB_handle_nas_first_req(
initial_ue_message_p->rrC_Establishment_Cause = s1ap_nas_first_req_p->establishment_cause;
if (s1ap_nas_first_req_p->ue_identity.presenceMask & UE_IDENTITIES_s_tmsi) {
- S1AP_DEBUG("S_TMSI_PRESENT");
+ S1AP_DEBUG("S_TMSI_PRESENT\n");
initial_ue_message_p->presenceMask |= S1AP_INITIALUEMESSAGEIES_S_TMSI_PRESENT;
MME_CODE_TO_OCTET_STRING(s1ap_nas_first_req_p->ue_identity.s_tmsi.mme_code,
@@ -165,7 +165,7 @@ int s1ap_eNB_handle_nas_first_req(
}
if (s1ap_nas_first_req_p->ue_identity.presenceMask & UE_IDENTITIES_gummei) {
- S1AP_DEBUG("GUMMEI_ID_PRESENT");
+ S1AP_DEBUG("GUMMEI_ID_PRESENT\n");
initial_ue_message_p->presenceMask |= S1AP_INITIALUEMESSAGEIES_GUMMEI_ID_PRESENT;
MCC_MNC_TO_PLMNID(
@@ -191,8 +191,10 @@ int s1ap_eNB_handle_nas_first_req(
* The cell identity is defined on 28 bits but as we use macro enb id,
* we have to pad.
*/
+#warning "TODO get cell id from RRC"
MACRO_ENB_ID_TO_CELL_IDENTITY(instance_p->eNB_id,
- &initial_ue_message_p->eutran_cgi.cell_ID);
+ 0, // Cell ID
+ &initial_ue_message_p->eutran_cgi.cell_ID);
MCC_MNC_TO_TBCD(instance_p->mcc,
instance_p->mnc,
instance_p->mnc_digit_length,
@@ -224,14 +226,7 @@ int s1ap_eNB_handle_nas_first_req(
mme_desc_p->nextstream += 1;
}
-#if defined(S1AP_LIMIT_STREAM_ID_TO_0)
- mme_desc_p->nextstream = 0;
-#else
-# if defined(S1AP_LIMIT_STREAM_ID_TO_1)
- mme_desc_p->nextstream = 1;
-# endif
-#endif
- ue_desc_p->stream = mme_desc_p->nextstream;
+ ue_desc_p->tx_stream = mme_desc_p->nextstream;
MSC_LOG_TX_MESSAGE(
MSC_S1AP_ENB,
@@ -244,7 +239,7 @@ int s1ap_eNB_handle_nas_first_req(
/* Send encoded message over sctp */
s1ap_eNB_itti_send_sctp_data_req(instance_p->instance, mme_desc_p->assoc_id,
- buffer, length, ue_desc_p->stream);
+ buffer, length, ue_desc_p->tx_stream);
return 0;
}
@@ -300,6 +295,14 @@ int s1ap_eNB_handle_nas_downlink(const uint32_t assoc_id,
return -1;
}
+ if (0 == ue_desc_p->rx_stream) {
+ ue_desc_p->rx_stream = stream;
+ } else if (stream != ue_desc_p->rx_stream) {
+ S1AP_ERROR("[SCTP %d] Received UE-related procedure on stream %u, expecting %u\n",
+ assoc_id, stream, ue_desc_p->rx_stream);
+ return -1;
+ }
+
/* Is it the first outcome of the MME for this UE ? If so store the mme
* UE s1ap id.
*/
@@ -313,6 +316,7 @@ int s1ap_eNB_handle_nas_downlink(const uint32_t assoc_id,
downlink_NAS_transport_p->mme_ue_s1ap_id,
ue_desc_p->mme_ue_s1ap_id
);
+ return -1;
}
}
@@ -396,8 +400,10 @@ int s1ap_eNB_nas_uplink(instance_t instance, s1ap_uplink_nas_t *s1ap_uplink_nas_
s1ap_eNB_instance_p->mnc_digit_length,
&uplink_NAS_transport_p->eutran_cgi.pLMNidentity);
+#warning "TODO get cell id from RRC"
MACRO_ENB_ID_TO_CELL_IDENTITY(s1ap_eNB_instance_p->eNB_id,
- &uplink_NAS_transport_p->eutran_cgi.cell_ID);
+ 0,
+ &uplink_NAS_transport_p->eutran_cgi.cell_ID);
/* MCC/MNC should be repeated in TAI and EUTRAN CGI */
MCC_MNC_TO_PLMNID(
@@ -428,7 +434,7 @@ int s1ap_eNB_nas_uplink(instance_t instance, s1ap_uplink_nas_t *s1ap_uplink_nas_
/* UE associated signalling -> use the allocated stream */
s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance,
ue_context_p->mme_ref->assoc_id, buffer,
- length, ue_context_p->stream);
+ length, ue_context_p->tx_stream);
return 0;
}
@@ -506,7 +512,7 @@ void s1ap_eNB_nas_non_delivery_ind(instance_t instance,
/* UE associated signalling -> use the allocated stream */
s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance,
ue_context_p->mme_ref->assoc_id, buffer,
- length, ue_context_p->stream);
+ length, ue_context_p->tx_stream);
}
//------------------------------------------------------------------------------
@@ -596,7 +602,7 @@ int s1ap_eNB_initial_ctxt_resp(
/* UE associated signalling -> use the allocated stream */
s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance,
ue_context_p->mme_ref->assoc_id, buffer,
- length, ue_context_p->stream);
+ length, ue_context_p->tx_stream);
return ret;
}
@@ -675,7 +681,7 @@ int s1ap_eNB_ue_capabilities(instance_t instance,
/* UE associated signalling -> use the allocated stream */
s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance,
ue_context_p->mme_ref->assoc_id, buffer,
- length, ue_context_p->stream);
+ length, ue_context_p->tx_stream);
return ret;
}
diff --git a/openair-cn/S1AP/s1ap_eNB_trace.c b/openair-cn/S1AP/s1ap_eNB_trace.c
index 5a523c1fd3..e792c81120 100644
--- a/openair-cn/S1AP/s1ap_eNB_trace.c
+++ b/openair-cn/S1AP/s1ap_eNB_trace.c
@@ -76,7 +76,7 @@ void s1ap_eNB_generate_trace_failure(struct s1ap_eNB_ue_context_s *ue_desc_p,
s1ap_eNB_itti_send_sctp_data_req(ue_desc_p->mme_ref->s1ap_eNB_instance->instance,
ue_desc_p->mme_ref->assoc_id, buffer,
- length, ue_desc_p->stream);
+ length, ue_desc_p->tx_stream);
}
int s1ap_eNB_handle_trace_start(uint32_t assoc_id,
diff --git a/openair-cn/S1AP/s1ap_eNB_ue_context.h b/openair-cn/S1AP/s1ap_eNB_ue_context.h
index 911f6e3671..a153fa1952 100644
--- a/openair-cn/S1AP/s1ap_eNB_ue_context.h
+++ b/openair-cn/S1AP/s1ap_eNB_ue_context.h
@@ -66,7 +66,8 @@ typedef struct s1ap_eNB_ue_context_s {
uint32_t mme_ue_s1ap_id;
/* Stream used for this particular UE */
- int32_t stream;
+ int32_t tx_stream;
+ int32_t rx_stream;
/* Current UE state. */
s1ap_ue_state ue_state;
diff --git a/openair-cn/S1AP/s1ap_mme.c b/openair-cn/S1AP/s1ap_mme.c
index 5112ec30ce..a599d32c68 100644
--- a/openair-cn/S1AP/s1ap_mme.c
+++ b/openair-cn/S1AP/s1ap_mme.c
@@ -48,6 +48,7 @@
#include "s1ap_mme_nas_procedures.h"
#include "s1ap_mme_retransmission.h"
+#include "msc.h"
#define S1AP_DEBUG_LIST
#ifdef S1AP_DEBUG_LIST
@@ -95,6 +96,7 @@ void *s1ap_mme_thread(void *args)
MessageDef *received_message_p;
itti_mark_task_ready(TASK_S1AP);
+ MSC_START_USE();
while(1) {
/* Trying to fetch a message from the message queue.
diff --git a/openair-cn/S6A/s6a_peer.c b/openair-cn/S6A/s6a_peer.c
index 176807cff6..c611cb6981 100644
--- a/openair-cn/S6A/s6a_peer.c
+++ b/openair-cn/S6A/s6a_peer.c
@@ -59,12 +59,6 @@ void s6a_peer_connected_cb(struct peer_info *info, void *arg)
itti_send_msg_to_task(TASK_S1AP, INSTANCE_DEFAULT, message_p);
-#if ! defined(ENABLE_USE_GTPU_IN_KERNEL)
- /* Inform SGI that connection to HSS is established */
- message_p = itti_alloc_new_message(TASK_S6A, ACTIVATE_MESSAGE);
-
- itti_send_msg_to_task(TASK_FW_IP, INSTANCE_DEFAULT, message_p);
-#endif
}
/* For test */
diff --git a/openair-cn/S6A/s6a_task.c b/openair-cn/S6A/s6a_task.c
index 9849b6caba..2ee79ac3ab 100644
--- a/openair-cn/S6A/s6a_task.c
+++ b/openair-cn/S6A/s6a_task.c
@@ -45,6 +45,7 @@
#include "s6a_messages.h"
#include "assertions.h"
+#include "msc.h"
#if defined(DISABLE_USE_HSS)
# error "Disabling HSS support is currently not supported \
@@ -67,6 +68,7 @@ static void fd_gnutls_debug(int level, const char *str)
void *s6a_thread(void *args)
{
itti_mark_task_ready(TASK_S6A);
+ MSC_START_USE();
while(1) {
MessageDef *received_message_p = NULL;
diff --git a/openair-cn/SCTP/sctp_default_values.h b/openair-cn/SCTP/sctp_default_values.h
index 5985dd907c..28b6cc1fbf 100644
--- a/openair-cn/SCTP/sctp_default_values.h
+++ b/openair-cn/SCTP/sctp_default_values.h
@@ -29,8 +29,8 @@
#ifndef SCTP_DEFAULT_VALUES_H_
#define SCTP_DEFAULT_VALUES_H_
-#define SCTP_OUT_STREAMS (64)
-#define SCTP_IN_STREAMS (64)
+#define SCTP_OUT_STREAMS (16)
+#define SCTP_IN_STREAMS (16)
#define SCTP_MAX_ATTEMPTS (2)
#define SCTP_TIMEOUT (5)
#define SCTP_RECV_BUFFER_SIZE (1024)
diff --git a/openair-cn/SCTP/sctp_eNB_task.c b/openair-cn/SCTP/sctp_eNB_task.c
index 8a7e50ee5f..c9039f714d 100644
--- a/openair-cn/SCTP/sctp_eNB_task.c
+++ b/openair-cn/SCTP/sctp_eNB_task.c
@@ -55,6 +55,7 @@
#include "sctp_default_values.h"
#include "sctp_common.h"
#include "sctp_eNB_itti_messaging.h"
+#include "msc.h"
/* Used to format an uint32_t containing an ipv4 address */
#define IPV4_ADDR "%u.%u.%u.%u"
@@ -124,7 +125,7 @@ sctp_handle_new_association_req(
const task_id_t requestor,
const sctp_new_association_req_t * const sctp_new_association_req_p)
{
- int sd;
+ int sd = 0;
int32_t assoc_id = 0;
struct sctp_event_subscribe events;
@@ -133,8 +134,10 @@ sctp_handle_new_association_req(
enum sctp_connection_type_e connection_type = SCTP_TYPE_CLIENT;
struct ifreq ifr;
- struct ifaddrs *ifaddr, *ifa;
- int family, s;
+ struct ifaddrs *ifaddr = NULL;
+ struct ifaddrs *ifa = NULL;
+ int family = 0;
+ int s = 0;
struct in_addr in;
struct in6_addr in6;
/* Prepare a new SCTP association as requested by upper layer and try to connect
@@ -143,6 +146,7 @@ sctp_handle_new_association_req(
DevAssert(sctp_new_association_req_p != NULL);
/* Create new socket with IPv6 affinity */
+#warning "SCTP may Force IPv4 only, here"
#ifdef NO_VIRTUAL_MACHINE
// in init chunk appears a list of host addresses, IPv4 and IPv4 in an arbitrary (unsorted) order
@@ -161,8 +165,10 @@ sctp_handle_new_association_req(
/* Add the socket to list of fd monitored by ITTI */
itti_subscribe_event_fd(TASK_SCTP, sd);
- if (sctp_set_init_opt(sd, SCTP_IN_STREAMS, SCTP_OUT_STREAMS,
- SCTP_MAX_ATTEMPTS, SCTP_TIMEOUT) != 0) {
+ if (sctp_set_init_opt(sd,
+ sctp_new_association_req_p->in_streams,
+ sctp_new_association_req_p->out_streams,
+ SCTP_MAX_ATTEMPTS, SCTP_TIMEOUT) != 0) {
SCTP_ERROR("Setsockopt IPPROTO_SCTP_INITMSG failed: %s\n",
strerror(errno));
itti_unsubscribe_event_fd(TASK_SCTP, sd);
@@ -805,6 +811,7 @@ void *sctp_eNB_task(void *arg)
STAILQ_INIT(&sctp_cnx_list);
itti_mark_task_ready(TASK_SCTP);
+ MSC_START_USE();
while (1) {
itti_receive_msg(TASK_SCTP, &received_msg);
diff --git a/openair-cn/SCTP/sctp_primitives_server.c b/openair-cn/SCTP/sctp_primitives_server.c
index 59f7f53aa6..654d0b6f4d 100644
--- a/openair-cn/SCTP/sctp_primitives_server.c
+++ b/openair-cn/SCTP/sctp_primitives_server.c
@@ -60,6 +60,7 @@
#include "sctp_common.h"
#include "sctp_itti_messaging.h"
+#include "msc.h"
#define SCTP_DUMP_LIST
@@ -553,6 +554,7 @@ void *sctp_receiver_thread(void *args_p)
FD_SET(sctp_arg_p->sd, &master);
fdmax = sctp_arg_p->sd; /* so far, it's this one*/
+ MSC_START_USE();
while(1) {
@@ -616,6 +618,7 @@ void *sctp_receiver_thread(void *args_p)
static void *sctp_intertask_interface(void *args_p)
{
itti_mark_task_ready(TASK_SCTP);
+ MSC_START_USE();
while(1) {
MessageDef *received_message_p;
diff --git a/openair-cn/SGI/COPYING b/openair-cn/SGI/COPYING
deleted file mode 100644
index 94a9ed024d..0000000000
--- a/openair-cn/SGI/COPYING
+++ /dev/null
@@ -1,674 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users. We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors. You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
- To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights. Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received. You must make sure that they, too, receive
-or can get the source code. And you must show them these terms so they
-know their rights.
-
- Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
- For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software. For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
- Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so. This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software. The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable. Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products. If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
- Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary. To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
- 0. Definitions.
-
- "This License" refers to version 3 of the GNU General Public License.
-
- "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
- To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
- A "covered work" means either the unmodified Program or a work based
-on the Program.
-
- To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
- An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
- 1. Source Code.
-
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
- A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
- The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
- The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
- The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
- The Corresponding Source for a work in source code form is that
-same work.
-
- 2. Basic Permissions.
-
- All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
- You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
- No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
- When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
- 4. Conveying Verbatim Copies.
-
- You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
- You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
- 5. Conveying Modified Source Versions.
-
- You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
- A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
- 6. Conveying Non-Source Forms.
-
- You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
- A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
- A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
- "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
- If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
- The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
- Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
- 7. Additional Terms.
-
- "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
- When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
- Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
- If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
- Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
- 8. Termination.
-
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
- However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
- Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
- 9. Acceptance Not Required for Having Copies.
-
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
- 10. Automatic Licensing of Downstream Recipients.
-
- Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
- An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
- 11. Patents.
-
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
- A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
- Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
- In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
- If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
- If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
- A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
- Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
- 12. No Surrender of Others' Freedom.
-
- If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
- 13. Use with the GNU Affero General Public License.
-
- Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
- 14. Revised Versions of this License.
-
- The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
- If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
- 15. Disclaimer of Warranty.
-
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. Limitation of Liability.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
- 17. Interpretation of Sections 15 and 16.
-
- If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-
- Copyright (C)
-
- This program 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.
-
- This program 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 this program. If not, see .
-
-Also add information on how to contact you by electronic and paper mail.
-
- If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
- Copyright (C)
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
- You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-.
-
- The GNU General Public License does not permit incorporating your program
-into proprietary programs. If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License. But first, please read
-.
diff --git a/openair-cn/SGI/Makefile.am b/openair-cn/SGI/Makefile.am
deleted file mode 100644
index 9a386ed1d5..0000000000
--- a/openair-cn/SGI/Makefile.am
+++ /dev/null
@@ -1,64 +0,0 @@
-################################################################################
-# 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.
-#
-################################################################################
-AM_CFLAGS = @ADD_CFLAGS@ \
- -I$(top_srcdir)/COMMON \
- -I$(top_srcdir)/SGW-LITE \
- -I$(top_srcdir)/UTILS \
- -I$(top_srcdir)/UTILS/HASHTABLE \
- -I$(top_srcdir)/NAS/EURECOM-NAS/src/api/network \
- -I$(top_srcdir)/NAS/EURECOM-NAS/src/include \
- -I$(top_srcdir)/NAS/EURECOM-NAS/src/ies \
- -I$(top_srcdir)/NAS/EURECOM-NAS/src/emm/msg \
- -I$(top_srcdir)/NAS/EURECOM-NAS/src/esm/msg \
- -I$(top_srcdir)/NAS/EURECOM-NAS/src/util \
- -I$(top_srcdir)/GTPV1-U \
- -I$(top_srcdir)/INTERTASK_INTERFACE
-
-noinst_LTLIBRARIES = libsgi.la
-libsgi_la_LDFLAGS = -all-static
-libsgi_la_SOURCES = \
- sgi_task.c sgi.h \
- sgi_socket.c \
- sgi_egress.c \
- sgi_util.c
-
-if ENABLE_USE_PCAP_FOR_SGI
- libsgi_la_SOURCES += sgi_pcap.c \
- /usr/lib/libpcap.a
-
-endif
-
-
-if ENABLE_USE_NETFILTER_FOR_SGI
- libsgi_la_SOURCES += sgi_nf.c \
- /usr/lib/libnetfilter_queue.a \
- /usr/lib/libnfnetlink.la
-endif
-
-
diff --git a/openair-cn/SGI/sgi.h b/openair-cn/SGI/sgi.h
deleted file mode 100755
index c0e4ebda49..0000000000
--- a/openair-cn/SGI/sgi.h
+++ /dev/null
@@ -1,301 +0,0 @@
-/*******************************************************************************
- 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.
-
- *******************************************************************************/
-/*! \file sgi.h
-* \brief
-* \author Lionel Gauthier
-* \company Eurecom
-* \email: lionel.gauthier@eurecom.fr
-*/
-#ifndef SGI_H_
-#define SGI_H_
-
-#include
-#include
-#include
-#include
-
-#ifdef ENABLE_USE_NETFILTER_FOR_SGI
-#warning "ENABLE_USE_NETFILTER_FOR_SGI"
-#define SGI_SOCKET_RAW 1
-#define SGI_SOCKET_BIND_TO_IF 1
-#undef SGI_MARKING
-#undef SGI_PACKET_RX_RING
-#undef SGI_SOCKET_UDP
-#else
-#warning "DISABLE_USE_NETFILTER_FOR_SGI"
-//#define SGI_SOCKET_RAW 1
-#undef SGI_SOCKET_RAW
-#define SGI_SOCKET_DGRAM 1
-#define SGI_SOCKET_BIND_TO_IF 1
-#undef SGI_PACKET_RX_RING
-#undef SGI_MARKING
-#undef SGI_SOCKET_UDP
-#endif
-
-#ifdef ENABLE_USE_PCAP_FOR_SGI
-#include
-#endif
-
-//#define SGI_TEST
-// Packets include a ethernet header if SGI_PF_PACKET is defined
-#define SGI_PF_PACKET
-
-#include "common_types.h"
-#include "hashtable.h"
-#include "obj_hashtable.h"
-#include "sgw_lite_ie_defs.h"
-#include "ip_forward_messages_types.h"
-
-# define SGI_IF_DEBUG(x, args...)
-# define SGI_IF_ERROR(x, args...)
-# define SGI_IF_WARNING(x, args...)
-//-----------------------------------------------------------------------------
-#ifndef SGI_IF_DEBUG
-# define SGI_IF_DEBUG(x, args...) do { fprintf(stdout, "[SGI_IF][D]"x, ##args); } \
- while(0)
-#endif
-#ifndef SGI_IF_ERROR
-# define SGI_IF_ERROR(x, args...) do { fprintf(stderr, "[SGI_IF][E]"x, ##args); } \
- while(0)
-#endif
-#ifndef SGI_IF_WARNING
-# define SGI_IF_WARNING(x, args...) do { fprintf(stderr, "[SGI_IF][W]"x, ##args); } \
- while(0)
-#endif
-
-// refer to 3GPP TS 23.203 V10.6.0 (2012-03) page 33
-//#define MAX_DEFINED_QCI 0
-#define MAX_DEFINED_QCI 9
-#define SGI_MIN_EPS_BEARER_ID 5
-#define SGI_MAX_SERVED_USERS_PER_PGW 1024
-#define SGI_MAX_EPS_BEARERS_PER_USER 11
-#define MAX_DEFINED_IPV6_ADDRESSES_PER_UE 16
-
-
-#define NIP6ADDR(addr) \
- ntohs((addr)->s6_addr16[0]), \
- ntohs((addr)->s6_addr16[1]), \
- ntohs((addr)->s6_addr16[2]), \
- ntohs((addr)->s6_addr16[3]), \
- ntohs((addr)->s6_addr16[4]), \
- ntohs((addr)->s6_addr16[5]), \
- ntohs((addr)->s6_addr16[6]), \
- ntohs((addr)->s6_addr16[7])
-
-#define NIPADDR(addr) \
- (uint8_t)(addr & 0x000000FF), \
- (uint8_t)((addr & 0x0000FF00) >> 8), \
- (uint8_t)((addr & 0x00FF0000) >> 16), \
- (uint8_t)((addr & 0xFF000000) >> 24)
-
-#define NMACADDR(addr) \
- (uint8_t)(addr[0]), \
- (uint8_t)(addr[1]), \
- (uint8_t)(addr[2]), \
- (uint8_t)(addr[3]), \
- (uint8_t)(addr[4]), \
- (uint8_t)(addr[5])
-#ifdef VLAN8021Q
-typedef struct vlan_tag_s {
- uint16_t vlan_tpid; /* ETH_P_8021Q */
- uint16_t vlan_tci; /* VLAN TCI */
-} vlan_tag_t __attribute__ ((__packed__));
-
-typedef struct ether_header_8021q_s {
- u_int8_t ether_dhost[ETH_ALEN]; /* destination eth addr */
- u_int8_t ether_shost[ETH_ALEN]; /* source ether addr */
- vlan_tag_t ether_vlan8021q;
- u_int16_t ether_type; /* packet type ID field */
-} ether_header_8021q_t __attribute__ ((__packed__));
-#endif
-
-typedef struct arphdr_s {
- __be16 ar_hrd; /* format of hardware address */
- __be16 ar_pro; /* format of protocol address */
- unsigned char ar_hln; /* length of hardware address */
- unsigned char ar_pln; /* length of protocol address */
- __be16 ar_op; /* ARP opcode (command) */
- /*
- * Ethernet looks like this : This bit is variable sized however...
- */
- unsigned char ar_sha[ETH_ALEN]; /* sender hardware address */
- unsigned char ar_sip[4]; /* sender IP address */
- unsigned char ar_tha[ETH_ALEN]; /* target hardware address */
- unsigned char ar_tip[4]; /* target IP address */
-
-} arphdr_t;
-
-typedef struct sgi_teid_mapping_s {
- int is_outgoing_ipv4_packet_seen;
- int is_outgoing_ipv6_packet_seen;
- Teid_t enb_S1U_teid; ///< dest tunnel identifier
- qci_t qci;
- ebi_t eps_bearer_id; ///< EPS bearer identifier
- char hw_addrlen;
-#ifdef SGI_UE_ETHER_TRAFFIC
- char ue_mac_addr[8];
-#endif
- struct in6_addr in6_addr_captured[MAX_DEFINED_IPV6_ADDRESSES_PER_UE];
- struct in_addr in_add_captured;
-} sgi_teid_mapping_t;
-
-
-// Main goal is to do an association IP address <-> MAC address
-// may be usefull for netfilter that does not capture MAC address
-// if not set on certain hook points (table,path).
-typedef struct sgi_addr_mapping_s {
- int is_outgoing_packet_seen;
- ebi_t eps_bearer_id; ///< EPS default bearer identifier, (really ?)
- Teid_t enb_S1U_teid; ///< dest tunnel identifier, for default bearer
- Teid_t sgw_S1U_teid; ///< dest tunnel identifier, for default bearer
-#ifdef SGI_UE_ETHER_TRAFFIC
- char ue_mac_addr[ETH_ALEN];
-#endif
-} sgi_addr_mapping_t;
-
-
-
-
-typedef struct sgi_data_s {
- int sd[SGI_MAX_EPS_BEARERS_PER_USER];
- unsigned int if_index[SGI_MAX_EPS_BEARERS_PER_USER];
- int sd6;
- char *interface_name;
- int interface_name_len;
- int interface_index;
-#ifndef SGI_UE_ETHER_TRAFFIC
- char interface_hw_address[ETH_ALEN];
-#ifdef VLAN8021Q
- struct ether_header_8021q_s eh;
-#else
- struct ether_header eh;
-#endif
-#endif
- uint32_t ipv4_addr;
- hash_table_t *teid_mapping;
- hash_table_t *addr_v4_mapping;
- obj_hash_table_t *addr_v6_mapping;
- pthread_t capture_on_sgi_if_thread;
- pthread_mutex_t thread_started_mutex;
- int thread_started;
-
- void *sock_mmap_ring;
- struct iovec *malloc_ring;
-
- int hw_address_of_router_captured;
- uint32_t local_addr_v4_4_hw_address_router_capture;
- uint32_t ipv4_addr_of_router;
- char hss_associated;
-
-
-#ifdef ENABLE_USE_PCAP_FOR_SGI
- //brief PCAP descriptor for capturing packets on SGI interface.
- pcap_t * pcap_descr;
-#endif
-#define SGI_BUFFER_RECV_LEN 3000
- unsigned char recv_buffer[sizeof(struct ether_header) + SGI_BUFFER_RECV_LEN][SGI_MAX_EPS_BEARERS_PER_USER];
-
-} sgi_data_t;
-
-
-typedef struct sgi_read_thread_args_s {
- sgi_data_t *sgi_data;
- int socket_index;
-} sgi_read_thread_args_t;
-//-----------------------------------------------------------------------------
-
-#include "mme_config.h"
-
-
-#define SGI_MAX_EPS_BEARERS (SGI_MAX_SERVED_USERS_PER_PGW*SGI_MAX_EPS_BEARERS_PER_USER)
-
-
-
-//-----------------------------------------------------------------------------
-// sgi_task.c
-//-----------------------------------------------------------------------------
-#include "spgw_config.h"
-int sgi_init(const pgw_config_t *pgw_config_p);
-char* sgi_status_2_str(SGIStatus_t statusP);
-
-//-----------------------------------------------------------------------------
-// sgi_nf.c
-//-----------------------------------------------------------------------------
-#ifdef ENABLE_USE_NETFILTER_FOR_SGI
-void* sgi_nf_fw_2_gtpv1u_thread(void *args_p);
-#endif
-
-//-----------------------------------------------------------------------------
-// sgi_pcap.c
-//-----------------------------------------------------------------------------
-#ifdef ENABLE_USE_PCAP_FOR_SGI
-# define SGI_PCAPMAXBYTES2CAPTURE 65535
-# define SGI_PCAPTIMEDELAYKERNEL2USERSPACE 1000
-
-/*! \fn void* sgi_pcap_loop(void*)
-* \brief
-* \param[in] devname The name of the device (ex "eth1") that will be listened for capturing packets.
-* \param[in] iif The interface identifier that will be listened for capturing packets.
-*/
-void* sgi_pcap_fw_2_gtpv1u_thread(void*);
-#endif
-//-----------------------------------------------------------------------------
-// sgi_util.c
-//-----------------------------------------------------------------------------
-void sgi_print_hex_octets(unsigned char* dataP, unsigned long sizeP);
-char* sgi_status_2_str (SGIStatus_t statusP);
-char* sgi_arpopcode_2_str (unsigned short int opcodeP);
-unsigned short in_cksum(unsigned short *addr, int len);
-void sgi_send_arp_request(sgi_data_t *sgi_dataP, char* dst_ip_addrP);
-
-//-----------------------------------------------------------------------------
-// sgi_socket.c
-//-----------------------------------------------------------------------------
-int sgi_create_sockets(sgi_data_t *sgi_data_p);
-int sgi_send_data(uint8_t *buffer, uint32_t length, sgi_data_t *sgi_dataP, Teid_t originating_sgw_S1u_teidP);
-int sgi_dgram_send_data(uint8_t *buffer_pP, uint32_t length, sgi_data_t *sgi_data_pP, Teid_t originating_sgw_S1u_teidP);
-
-#ifdef SGI_TEST
-unsigned short in_cksum(unsigned short *addr, int len);
-void sgi_test_send_ping(sgi_data_t *sgi_dataP, uint32_t markP, uint64_t src_mac_addrP, uint64_t dst_mac_addrP, char* src_ip_addrP, char* dst_ip_addrP);
-#endif
-#ifdef ENABLE_USE_RAW_SOCKET_FOR_SGI
-void sgi_sock_raw_cleanup_handler(void *args_p);
-void* sgi_sock_raw_fw_2_gtpv1u_thread(void* args_p);
-#endif
-
-//-----------------------------------------------------------------------------
-// sgi_egress.c
-//-----------------------------------------------------------------------------
-void sgi_forward_ip_packet(sgi_data_t *sgi_dataP, struct ether_header *ehP, int packet_sizeP, sgi_addr_mapping_t *addr_mappingP);
-#ifdef ENABLE_USE_RAW_SOCKET_FOR_SGI
-void sgi_process_raw_packet(sgi_data_t *sgi_dataP, unsigned char* dataP, int packet_sizeP);
-#endif
-void sgi_process_dgram_packet(sgi_data_t *sgi_dataP, unsigned char* dataP, int packet_sizeP);
-#endif /* SGI_H_ */
diff --git a/openair-cn/SGI/sgi_egress.c b/openair-cn/SGI/sgi_egress.c
deleted file mode 100755
index 526c088bdd..0000000000
--- a/openair-cn/SGI/sgi_egress.c
+++ /dev/null
@@ -1,427 +0,0 @@
-/*******************************************************************************
- 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.
-
- *******************************************************************************/
-/*! \file sgi_egress.c
-* \brief
-* \author Lionel Gauthier
-* \company Eurecom
-* \email: lionel.gauthier@eurecom.fr
-*/
-#include
-#include
-#include
-#include
-
-
-#include "sgi.h"
-#include "gtpv1u.h"
-#include "intertask_interface.h"
-#include "assertions.h"
-
-#include
-#include
-#include
-
-
-struct ipv6hdr {
- __u8 priority:4,
- version:4;
- __u8 flow_lbl[3];
-
- __be16 payload_len;
- __u8 nexthdr;
- __u8 hop_limit;
-
- struct in6_addr saddr;
- struct in6_addr daddr;
-};
-
-#ifdef ENABLE_USE_RAW_SOCKET_FOR_SGI
-
-#ifdef SGI_UE_ETHER_TRAFFIC
-void sgi_process_raw_packet(sgi_data_t *sgi_data_pP, unsigned char* data_pP, int packet_sizeP)
-{
- Gtpv1uTunnelDataReq *gtpv1u_tunnel_data_req_p = NULL;
- MessageDef *message_p = NULL;
- unsigned char *message_payload_p = NULL ;
- struct ether_header *eh_p = (struct ether_header *) data_pP;
- struct arphdr *arph_p = NULL;
- struct iphdr *iph_p = NULL;
- struct ipv6hdr *ip6h_p = NULL;
- //struct arphdr *rarph = NULL;
- //unsigned char *rarp_ptr = NULL;
- //unsigned char *sha = NULL; /* Sender hardware address. */
- //unsigned char *tha = NULL; /* Target hardware address. */
- sgi_addr_mapping_t *addr_mapping_p = NULL;
- //__be32 sip, tip; /* Sender, target IP address. */
- struct in6_addr dest6_addr;
- u_int32_t dest4_addr;
- struct in_addr in_dest_addr;
-
-
- switch (htons(eh_p->ether_type)) {
-
- //*******************
- case ETHERTYPE_IP:
- //*******************
- iph_p = (struct iphdr *) (data_pP + sizeof(struct ether_header));
- dest4_addr = iph_p->daddr;
-
- if (hashtable_get(sgi_data_pP->addr_v4_mapping, dest4_addr, (void**)&addr_mapping_p) == HASH_TABLE_OK) {
- memcpy(eh_p->ether_dhost, addr_mapping_p->ue_mac_addr, ETH_ALEN);
- //SGI_IF_DEBUG("--------------------------------------------------------------\n%s :\n", __FUNCTION__);
- //sgi_print_hex_octets(data_pP, packet_sizeP);
-
- } else {
- if (sgi_data_pP->ipv4_addr == dest4_addr) {
- //SGI_IF_DEBUG("%s Dropping incoming egress IPV4 packet not UE IP flow\n", __FUNCTION__);
- return;
- } else {
- in_dest_addr.s_addr = dest4_addr;
- //SGI_IF_WARNING("%s Dropping incoming egress IPV4 packet, IPV4 dest %s not found \n", __FUNCTION__, inet_ntoa(in_dest_addr));
- return;
- }
- }
-
- break;
-
-
- //*******************
- case ETHERTYPE_IPV6:
- //*******************
- ip6h_p = (struct ipv6hdr *) (data_pP + sizeof(struct ether_header));
- memcpy(dest6_addr.__in6_u.__u6_addr8, ip6h_p->daddr.__in6_u.__u6_addr8, 16);
-
- if (obj_hashtable_get(sgi_data_pP->addr_v6_mapping, (void*)&dest6_addr, sizeof(struct in6_addr), (void**)&addr_mapping_p) == HASH_TABLE_OK) {
- memcpy(eh_p->ether_dhost, addr_mapping_p->ue_mac_addr, ETH_ALEN);
- //SGI_IF_DEBUG("--------------------------------------------------------------\n%s :\n", __FUNCTION__);
- //sgi_print_hex_octets(data_pP, packet_sizeP);
- } else {
- //SGI_IF_WARNING("%s Dropping incoming egress IPV6 packet, IPV6 dest %X:%X:%X:%X:%X:%X:%X:%X not found \n", __FUNCTION__, NIP6ADDR(&dest6_addr));
- return;
- }
-
- break;
-
-
- //*******************
- case ETHERTYPE_REVARP:
- //*******************
- SGI_IF_ERROR("%s UNHANDLED ETHERTYPE_REVARP of incoming egress packet\n", __FUNCTION__);
- return;
- break;
-
-
- //*******************
- case ETHERTYPE_ARP:
- //*******************
- SGI_IF_DEBUG("%s HANDLED ETHERTYPE_ARP of incoming egress packet\n", __FUNCTION__);
- arph_p = (struct arphdr *) (data_pP + sizeof(struct ether_header));
-#ifdef SGI_UE_ETHER_TRAFFIC
- // The entry should be here but all signalling tied with RRC procedures not finished so
- // a data packet can arrive before the MODIFY_BEARER REQUEST
- // get " unsigned char __ar_tip[4]; /* Target IP address. */" (from /usr/include/net/if_apr.h line 68)
- memcpy(&dest4_addr, &((unsigned char*)(&arph_p[1]))[ETH_ALEN*2+4], 4);
- SGI_IF_DEBUG("%s ARP OPCODE %s TARGET IP %d.%d.%d.%d\n", __FUNCTION__, sgi_arpopcode_2_str(ntohl(arph_p->ar_op)), NIPADDR(dest4_addr));
-
- if (hashtable_get(sgi_data_pP->addr_v4_mapping, dest4_addr, (void**)&addr_mapping_p) == HASH_TABLE_OK) {
- memcpy(eh_p->ether_dhost, addr_mapping_p->ue_mac_addr, ETH_ALEN);
- } else {
- if (sgi_data_pP->ipv4_addr == dest4_addr) {
- //SGI_IF_DEBUG("%s Dropping incoming egress IPV4 packet not UE IP flow\n", __FUNCTION__);
- return;
- } else {
- in_dest_addr.s_addr = dest4_addr;
- //SGI_IF_WARNING("%s Dropping incoming egress IPV4 packet, IPV4 dest %s not found \n", __FUNCTION__, inet_ntoa(in_dest_addr));
- return;
- }
- }
-
-#else
-#endif
- break;
- // rarph = (struct arphdr *)(data_pP + sizeof(struct ether_header));
- //
- // // If it's not Ethernet, delete it.
- // if (rarph->ar_pro != htons(ETH_P_IP)) {
- // SGI_IF_ERROR("%s ARP PACKET PROTOCOL OG INCOMING PACKET IS NOT ETHERNET\n",__FUNCTION__);
- // break;
- // }
- // rarp_ptr = (unsigned char *) (rarph + 1);
- // sha = rarp_ptr;
- // rarp_ptr += ETH_ALEN;
- // memcpy(&sip, rarp_ptr, 4);
- // rarp_ptr += 4;
- // tha = rarp_ptr;
- // rarp_ptr += ETH_ALEN;
- // memcpy(&tip, rarp_ptr, 4);
- // SGI_IF_DEBUG("%s ARP DEST IP transport IP = %d.%d.%d.%d\n",__FUNCTION__, NIPADDR(tip));
- // // TO DO IF NECESSARY
- // break;
- //
-
- default:
- SGI_IF_ERROR("%s UNHANDLED ether type %d of incoming egress packet\n", __FUNCTION__, eh_p->ether_type);
- return;
- }
-
- message_p = itti_alloc_new_message(TASK_FW_IP, GTPV1U_TUNNEL_DATA_REQ);
-
- if (message_p == NULL) {
- SGI_IF_ERROR("%s OUT OF MEMORY DROP EGRESS PACKET\n", __FUNCTION__);
- return;
- }
-
- message_payload_p = itti_malloc(TASK_FW_IP, TASK_GTPV1_U, packet_sizeP);
-
- if (message_payload_p == NULL) {
- SGI_IF_ERROR("%s OUT OF MEMORY DROP EGRESS PACKET\n", __FUNCTION__);
- return;
- }
-
- memcpy(message_payload_p, data_pP, packet_sizeP);
-
- gtpv1u_tunnel_data_req_p = &message_p->ittiMsg.gtpv1uTunnelDataReq;
- //LG HACK gtpv1u_tunnel_data_req_p->S1u_enb_teid = addr_mapping_p->enb_S1U_teid;
-#warning forced S1u_enb_teid to 1 for testing, waiting for MODIFY_BEARER REQUEST
- gtpv1u_tunnel_data_req_p->S1u_enb_teid = 1;
- gtpv1u_tunnel_data_req_p->local_S1u_teid = addr_mapping_p->sgw_S1U_teid;
- gtpv1u_tunnel_data_req_p->length = packet_sizeP;
- gtpv1u_tunnel_data_req_p->buffer = message_payload_p;
- SGI_IF_DEBUG("%s ETHER send GTPV1U_TUNNEL_DATA_REQ to GTPV1U S1u_enb_teid %u local_S1u_teid %u size %u\n", __FUNCTION__, gtpv1u_tunnel_data_req_p->S1u_enb_teid,
- gtpv1u_tunnel_data_req_p->local_S1u_teid, packet_sizeP);
-
- itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p);
-
-}
-#else
-void sgi_process_raw_packet(sgi_data_t *sgi_data_pP, unsigned char* data_pP, int packet_sizeP)
-{
- Gtpv1uTunnelDataReq *gtpv1u_tunnel_data_req_p = NULL;
- MessageDef *message_p = NULL;
- unsigned char *message_payload_p = NULL ;
- struct ether_header *eh_p = (struct ether_header *) data_pP;
- struct arphdr *arph_p = NULL;
- struct iphdr *iph_p = NULL;
- struct ipv6hdr *ip6h_p = NULL;
- sgi_addr_mapping_t *addr_mapping_p = NULL;
- struct in6_addr dest6_addr;
- u_int32_t dest4_addr;
- u_int32_t src4_addr;
- struct in_addr in_dest_addr;
-
-
- switch (htons(eh_p->ether_type)) {
- //sgi_print_hex_octets(data_pP, packet_sizeP);
-
- //*******************
- case ETHERTYPE_IP:
- //*******************
- iph_p = (struct iphdr *) (data_pP + sizeof(struct ether_header));
- dest4_addr = iph_p->daddr;
-
- if (hashtable_get(sgi_data_pP->addr_v4_mapping, dest4_addr, (void**)&addr_mapping_p) != HASH_TABLE_OK) {
- if (sgi_data_pP->ipv4_addr == dest4_addr) {
- //SGI_IF_DEBUG("%s Dropping incoming egress IPV4 packet not UE IP flow\n", __FUNCTION__);
- return;
- } else {
- in_dest_addr.s_addr = dest4_addr;
- //SGI_IF_WARNING("%s Dropping incoming egress IPV4 packet, IPV4 dest %s not found \n", __FUNCTION__, inet_ntoa(in_dest_addr));
- return;
- }
- }
-
- break;
-
-
- //*******************
- case ETHERTYPE_IPV6:
- //*******************
- ip6h_p = (struct ipv6hdr *) (data_pP + sizeof(struct ether_header));
- memcpy(dest6_addr.__in6_u.__u6_addr8, ip6h_p->daddr.__in6_u.__u6_addr8, 16);
-
- if (obj_hashtable_get(sgi_data_pP->addr_v6_mapping, (void*)&dest6_addr, sizeof(struct in6_addr), (void**)&addr_mapping_p) != HASH_TABLE_OK) {
- SGI_IF_WARNING("%s Dropping incoming egress IPV6 packet, IPV6 dest %X:%X:%X:%X:%X:%X:%X:%X not found \n", __FUNCTION__, NIP6ADDR(&dest6_addr));
- return;
- }
-
- break;
-
-
- //*******************
- case ETHERTYPE_REVARP:
- //*******************
- SGI_IF_ERROR("%s UNHANDLED ETHERTYPE_REVARP of incoming egress packet\n", __FUNCTION__);
- return;
- break;
-
-
- //*******************
- case ETHERTYPE_ARP:
- //*******************
- SGI_IF_DEBUG("%s HANDLED ETHERTYPE_ARP of incoming egress packet\n", __FUNCTION__);
- arph_p = (struct arphdr *) (data_pP + sizeof(struct ether_header));
- // The entry should be here but all signalling tied with RRC procedures not finished so
- // a data packet can arrive before the MODIFY_BEARER REQUEST
- // get " unsigned char __ar_tip[4]; /* Target IP address. */" (from /usr/include/net/if_apr.h line 68)
- memcpy(&dest4_addr, &((unsigned char*)(&arph_p[1]))[ETH_ALEN*2+4], 4);
- SGI_IF_DEBUG("%s ARP OPCODE %s TARGET IP %d.%d.%d.%d\n", __FUNCTION__, sgi_arpopcode_2_str(ntohl(arph_p->ar_op)), NIPADDR(dest4_addr));
-
- if (hashtable_get(sgi_data_pP->addr_v4_mapping, dest4_addr, (void**)&addr_mapping_p) != HASH_TABLE_OK) {
- if (sgi_data_pP->ipv4_addr == dest4_addr) {
- SGI_IF_DEBUG("%s Dropping incoming egress IPV4 packet not UE IP flow\n", __FUNCTION__);
- return;
- } else {
- if (sgi_data_pP->hw_address_of_router_captured) {
- in_dest_addr.s_addr = dest4_addr;
- SGI_IF_WARNING("%s Dropping incoming egress IPV4 packet, IPV4 dest %s not found \n", __FUNCTION__, inet_ntoa(in_dest_addr));
- } else {
- // may be a response to our ARP request to router
- if (htons(arph_p->ar_op) == ARPOP_REPLY) {
- memcpy(&src4_addr, &((unsigned char*)(&arph_p[1]))[ETH_ALEN], 4);
- SGI_IF_DEBUG("%s FOR ROUTER HW ADDRESS COMPARING: %d - %d %d - %d\n",
- __FUNCTION__,
- sgi_data_pP->local_addr_v4_4_hw_address_router_capture,
- dest4_addr,
- sgi_data_pP->ipv4_addr_of_router,
- src4_addr);
-
- if ((sgi_data_pP->local_addr_v4_4_hw_address_router_capture == dest4_addr) && (sgi_data_pP->ipv4_addr_of_router == src4_addr)) {
- sgi_data_pP->hw_address_of_router_captured = 1;
- sgi_data_pP->eh.ether_dhost[0] = ((unsigned char*)(&arph_p[1]))[0];
- sgi_data_pP->eh.ether_dhost[1] = ((unsigned char*)(&arph_p[1]))[1];
- sgi_data_pP->eh.ether_dhost[2] = ((unsigned char*)(&arph_p[1]))[2];
- sgi_data_pP->eh.ether_dhost[3] = ((unsigned char*)(&arph_p[1]))[3];
- sgi_data_pP->eh.ether_dhost[4] = ((unsigned char*)(&arph_p[1]))[4];
- sgi_data_pP->eh.ether_dhost[5] = ((unsigned char*)(&arph_p[1]))[5];
- SGI_IF_DEBUG("%s FOUND ROUTER HW ADDRESS: %02x:%02x:%02x:%02x:%02x:%02x\n", __FUNCTION__, NMACADDR(sgi_data_pP->eh.ether_dhost));
- }
- }
- }
-
- return;
- }
- }
-
- break;
-
- default:
- //SGI_IF_ERROR("%s UNHANDLED ether type %d of incoming egress packet\n", __FUNCTION__, eh_p->ether_type);
- return;
- }
-
- //SGI_IF_DEBUG("--------------------------------------------------------------\n%s :\n", __FUNCTION__);
- //sgi_print_hex_octets(data_pP+sizeof(sgi_data_pP->eh), packet_sizeP - sizeof(sgi_data_pP->eh));
-
- message_p = itti_alloc_new_message(TASK_FW_IP, GTPV1U_TUNNEL_DATA_REQ);
-
- if (message_p == NULL) {
- SGI_IF_ERROR("%s OUT OF MEMORY DROP EGRESS PACKET\n", __FUNCTION__);
- return;
- }
-
- AssertFatal((packet_sizeP - sizeof(sgi_data_pP->eh)) > 20, "BAD IP PACKET SIZE");
- message_payload_p = itti_malloc(TASK_FW_IP, TASK_GTPV1_U, packet_sizeP - sizeof(sgi_data_pP->eh) + GTPU_HEADER_OVERHEAD_MAX);
-
- if (message_payload_p == NULL) {
- SGI_IF_ERROR("%s OUT OF MEMORY DROP EGRESS PACKET\n", __FUNCTION__);
- return;
- }
-
- memcpy(message_payload_p + GTPU_HEADER_OVERHEAD_MAX, data_pP+sizeof(sgi_data_pP->eh), packet_sizeP - sizeof(sgi_data_pP->eh));
-
- gtpv1u_tunnel_data_req_p = &message_p->ittiMsg.gtpv1uTunnelDataReq;
- gtpv1u_tunnel_data_req_p->S1u_enb_teid = addr_mapping_p->enb_S1U_teid;
- //#warning forced S1u_enb_teid to 1 for testing, waiting for MODIFY_BEARER REQUEST
- // gtpv1u_tunnel_data_req_p->S1u_enb_teid = 1;
- gtpv1u_tunnel_data_req_p->local_S1u_teid = addr_mapping_p->sgw_S1U_teid;
- gtpv1u_tunnel_data_req_p->length = packet_sizeP - sizeof(sgi_data_pP->eh);
- gtpv1u_tunnel_data_req_p->offset = GTPU_HEADER_OVERHEAD_MAX;
- gtpv1u_tunnel_data_req_p->buffer = message_payload_p;
- SGI_IF_DEBUG("%s send GTPV1U_TUNNEL_DATA_REQ to GTPV1U S1u_enb_teid %u local_S1u_teid %u size %u\n",
- __FUNCTION__,
- gtpv1u_tunnel_data_req_p->S1u_enb_teid,
- gtpv1u_tunnel_data_req_p->local_S1u_teid,
- gtpv1u_tunnel_data_req_p->length);
-
- itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p);
-
-}
-#endif
-#endif
-void sgi_process_dgram_packet(sgi_data_t *sgi_data_pP, unsigned char* data_pP, int packet_sizeP)
-{
- Gtpv1uTunnelDataReq *gtpv1u_tunnel_data_req_p = NULL;
- MessageDef *message_p = NULL;
- unsigned char *message_payload_p = NULL ;
- struct arphdr *arph_p = NULL;
- struct iphdr *iph_p = NULL;
- struct ipv6hdr *ip6h_p = NULL;
- sgi_addr_mapping_t *addr_mapping_p = NULL;
- struct in6_addr dest6_addr;
- u_int32_t dest4_addr;
- u_int32_t src4_addr;
- struct in_addr in_dest_addr;
-
- sgi_print_hex_octets(data_pP, packet_sizeP);
-
- return;
- message_p = itti_alloc_new_message(TASK_FW_IP, GTPV1U_TUNNEL_DATA_REQ);
-
- if (message_p == NULL) {
- SGI_IF_ERROR("%s OUT OF MEMORY DROP EGRESS PACKET\n", __FUNCTION__);
- return;
- }
-
- AssertFatal(packet_sizeP > 20, "BAD IP PACKET SIZE");
- message_payload_p = itti_malloc(TASK_FW_IP, TASK_GTPV1_U, packet_sizeP + GTPU_HEADER_OVERHEAD_MAX);
-
- if (message_payload_p == NULL) {
- SGI_IF_ERROR("%s OUT OF MEMORY DROP EGRESS PACKET\n", __FUNCTION__);
- return;
- }
-
- memcpy(message_payload_p + GTPU_HEADER_OVERHEAD_MAX, data_pP, packet_sizeP);
-
- gtpv1u_tunnel_data_req_p = &message_p->ittiMsg.gtpv1uTunnelDataReq;
- gtpv1u_tunnel_data_req_p->S1u_enb_teid = addr_mapping_p->enb_S1U_teid;
- //#warning forced S1u_enb_teid to 1 for testing, waiting for MODIFY_BEARER REQUEST
- // gtpv1u_tunnel_data_req_p->S1u_enb_teid = 1;
- gtpv1u_tunnel_data_req_p->local_S1u_teid = addr_mapping_p->sgw_S1U_teid;
- gtpv1u_tunnel_data_req_p->length = packet_sizeP ;
- gtpv1u_tunnel_data_req_p->offset = GTPU_HEADER_OVERHEAD_MAX;
- gtpv1u_tunnel_data_req_p->buffer = message_payload_p;
- SGI_IF_DEBUG("%s send GTPV1U_TUNNEL_DATA_REQ to GTPV1U S1u_enb_teid %u local_S1u_teid %u size %u\n",
- __FUNCTION__,
- gtpv1u_tunnel_data_req_p->S1u_enb_teid,
- gtpv1u_tunnel_data_req_p->local_S1u_teid,
- gtpv1u_tunnel_data_req_p->length);
-
- itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p);
-
-}
diff --git a/openair-cn/SGI/sgi_nf.c b/openair-cn/SGI/sgi_nf.c
deleted file mode 100755
index c81dcf64d6..0000000000
--- a/openair-cn/SGI/sgi_nf.c
+++ /dev/null
@@ -1,362 +0,0 @@
-/*******************************************************************************
- 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.
-
- *******************************************************************************/
-/*! \file sgi_nf.c
-* \brief
-* \author Lionel Gauthier
-* \company Eurecom
-* \email: lionel.gauthier@eurecom.fr
-*/
-#include
-#include
-
-#include
-#include /* Defines verdicts (NF_ACCEPT, etc) */
-#include
-#include
-#include
-
-#include "mme_config.h"
-#include "intertask_interface.h"
-#include "sgi.h"
-//-----------------------------------------------------------------------------
-struct nfq_handle {
- struct nfnl_handle *nfnlh;
- struct nfnl_subsys_handle *nfnlssh;
- struct nfq_q_handle *qh_list;
-};
-
-struct nfq_q_handle {
- struct nfq_q_handle *next;
- struct nfq_handle *h;
- u_int16_t id;
-
- nfq_callback *cb;
- void *data;
-};
-
-struct nfq_data {
- struct nfattr **data;
-};
-
-
-enum {
- NFQ_XML_HW = (1 << 0), NFQ_XML_MARK = (1 << 1), NFQ_XML_DEV = (1 << 2), NFQ_XML_PHYSDEV = (1 << 3),
- NFQ_XML_PAYLOAD = (1 << 4), NFQ_XML_TIME = (1 << 5), NFQ_XML_ALL = ~0U
-};
-//------------------------------------------------------
-#define SNPRINTF_FAILURE(ret, rem, offset, len) \
-do { \
- if (ret < 0) \
- return ret; \
- len += ret; \
- if (ret > rem) \
- ret = rem; \
- offset += ret; \
- rem -= ret; \
-} while (0)
-
-//------------------------------------------------------
-static int nfq_snprintf(char *buf, size_t rem, struct nfq_data *tb, int flags)
-//------------------------------------------------------
-{
- struct nfqnl_msg_packet_hdr *ph;
- struct nfqnl_msg_packet_hw *hwph;
- u_int32_t mark, ifi;
- int size, offset = 0, len = 0, ret;
- unsigned char *data;
-
- size = snprintf(buf + offset, rem, "");
- SNPRINTF_FAILURE(size, rem, offset, len);
-
-
-
- ph = nfq_get_msg_packet_hdr(tb);
-
- if (ph) {
- size = snprintf(buf + offset, rem,
- " %u %u",
- ph->hook, ntohl(ph->packet_id));
- SNPRINTF_FAILURE(size, rem, offset, len);
-
- hwph = nfq_get_packet_hw(tb);
-
- if (hwph && (flags & NFQ_XML_HW)) {
- int i, hlen = ntohs(hwph->hw_addrlen);
-
- size = snprintf(buf + offset, rem, "%04x"
- "",
- ntohs(ph->hw_protocol));
- SNPRINTF_FAILURE(size, rem, offset, len);
-
- size = snprintf(buf + offset, rem, "");
- SNPRINTF_FAILURE(size, rem, offset, len);
-
- for (i=0; ihw_addr[i]);
- SNPRINTF_FAILURE(size, rem, offset, len);
- }
-
- size = snprintf(buf + offset, rem, "");
- SNPRINTF_FAILURE(size, rem, offset, len);
- } else if (flags & NFQ_XML_HW) {
- size = snprintf(buf + offset, rem, "%04x"
- "",
- ntohs(ph->hw_protocol));
- SNPRINTF_FAILURE(size, rem, offset, len);
- }
- }
-
- mark = nfq_get_nfmark(tb);
-
- if (mark && (flags & NFQ_XML_MARK)) {
- size = snprintf(buf + offset, rem, "%u", mark);
- SNPRINTF_FAILURE(size, rem, offset, len);
- }
-
- ifi = nfq_get_indev(tb);
-
- if (ifi && (flags & NFQ_XML_DEV)) {
- size = snprintf(buf + offset, rem, "%u", ifi);
- SNPRINTF_FAILURE(size, rem, offset, len);
- }
-
- ifi = nfq_get_outdev(tb);
-
- if (ifi && (flags & NFQ_XML_DEV)) {
- size = snprintf(buf + offset, rem, "%u", ifi);
- SNPRINTF_FAILURE(size, rem, offset, len);
- }
-
- ifi = nfq_get_physindev(tb);
-
- if (ifi && (flags & NFQ_XML_PHYSDEV)) {
- size = snprintf(buf + offset, rem,
- "%u", ifi);
- SNPRINTF_FAILURE(size, rem, offset, len);
- }
-
- ifi = nfq_get_physoutdev(tb);
-
- if (ifi && (flags & NFQ_XML_PHYSDEV)) {
- size = snprintf(buf + offset, rem,
- "%u", ifi);
- SNPRINTF_FAILURE(size, rem, offset, len);
- }
-
- ret = nfq_get_payload(tb, &data);
-
- if (ret >= 0 && (flags & NFQ_XML_PAYLOAD)) {
- int i;
-
- size = snprintf(buf + offset, rem, "");
- SNPRINTF_FAILURE(size, rem, offset, len);
-
- for (i=0; i");
- SNPRINTF_FAILURE(size, rem, offset, len);
- }
-
- size = snprintf(buf + offset, rem, "");
- SNPRINTF_FAILURE(size, rem, offset, len);
-
- return len;
-}
-//------------------------------------------------------
-static int sgi_nfqueue_callback(struct nfq_q_handle *myQueue, struct nfgenmsg *msg,
- struct nfq_data *pkt, void *cbData)
-//-----------------------------------------------------------------------------
-{
- uint32_t id = 0;
- struct nfqnl_msg_packet_hdr *header;
- struct nfqnl_msg_packet_hw *macAddr;
- MessageDef *message_p;
- Gtpv1uTunnelDataReq *data_req_p;
- Teid_t local_teid;
- u_int32_t verdict;
-
- if ((header = nfq_get_msg_packet_hdr(pkt))) {
- id = ntohl(header->packet_id);
- SGI_IF_DEBUG("packet_id %u hw_protocol %u hook %u\n", ntohl(header->packet_id), ntohs(header->hw_protocol), header->hook);
- }
-
- // The HW address is only fetchable at certain hook points
- // LG Warning HW address is src address
- macAddr = nfq_get_packet_hw(pkt);
-
- if (macAddr) {
- SGI_IF_DEBUG("MAC len %u addr %02X:%02X:%02X:%02X:%02X:%02X\n",
- ntohs(macAddr->hw_addrlen),
- macAddr->hw_addr[0],
- macAddr->hw_addr[1],
- macAddr->hw_addr[2],
- macAddr->hw_addr[3],
- macAddr->hw_addr[4],
- macAddr->hw_addr[5]);
- } else {
- SGI_IF_DEBUG("No MAC addr\n");
- }
-
- /*timeval tv;
- if (!nfq_get_timestamp(pkt, &tv)) {
- cout << "; tstamp " << tv.tv_sec << "." << tv.tv_usec;
- } else {
- cout << "; no tstamp";
- }*/
-
- //cout << "; mark " << nfq_get_nfmark(pkt);
- // Print the payload; in copy meta mode, only headers will be included;
- // in copy packet mode, whole packet will be returned.
- char *pktData;
- int len = nfq_get_payload(pkt, &pktData);
-
- // Note that you can also get the physical devices
- SGI_IF_DEBUG("pkt id %d recvd: indev %d outdev %d mark %d len %d\n",
- id,
- nfq_get_indev(pkt),
- nfq_get_outdev(pkt),
- nfq_get_nfmark(pkt),
- len);
-
-
- //sgi_print_hex_octets((unsigned char *)pktData, len);
-
- message_p = itti_alloc_new_message(TASK_FW_IP, GTPV1U_TUNNEL_DATA_REQ);
-
- if (message_p == NULL) {
- return -1;
- }
-
- data_req_p = &message_p->ittiMsg.gtpv1uTunnelDataReq;
- data_req_p->buffer = malloc(sizeof(uint8_t) * len);
-
- if (data_req_p->buffer == NULL) {
- SGI_IF_ERROR("Failed to allocate new buffer\n");
- itti_free(ITTI_MSG_ORIGIN_ID(message_p), message_p);
- message_p = NULL;
- return -1;
- } else {
- // MAY BE TO BE CHANGED
- local_teid = nfq_get_nfmark(pkt);
-
- // if packet is marked, it is a packet going into a EPS bearer
- //if (local_teid != 0) {
- if (1) {
- data_req_p->local_S1u_teid = local_teid;
-
- memcpy(data_req_p->buffer, pktData, len);
- data_req_p->length = len;
-
- if (itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p) < 0) {
- SGI_IF_ERROR("Failed to send message to task\n");
- itti_free(ITTI_MSG_ORIGIN_ID(message_p), message_p);
- message_p = NULL;
- }
-
- verdict = NF_STOLEN;
- return nfq_set_verdict(myQueue, id, verdict, 0, NULL);
- } else {
- verdict = NF_ACCEPT;
- return nfq_set_verdict(myQueue, id, verdict, len, pktData);
- }
- }
-
- return 0;
- // end sgi_nfqueue_callback
-}
-//-----------------------------------------------------------------------------
-void* sgi_nf_fw_2_gtpv1u_thread(void *args_p)
-//-----------------------------------------------------------------------------
-{
- struct nfq_handle *nfqHandle;
- struct nfq_q_handle *myQueue;
- struct nfnl_handle *netlinkHandle;
- int fd, res;
- volatile sgi_data_t *sgi_data_p;
-
- sgi_data_p = (sgi_data_t*)args_p;
-
- SGI_IF_DEBUG("RX thread on netfilter queue started, operating on Device %s iif %d\n", sgi_data_p->interface_name, sgi_data_p->interface_index);
-
- // Get a queue connection handle from the module
- if (!(nfqHandle = nfq_open())) {
- SGI_IF_ERROR("Error in nfq_open()");
- exit(-1);
- }
-
- // Unbind the handler from processing any IP packets
- // Not totally sure why this is done, or if it's necessary...
- if (nfq_unbind_pf(nfqHandle, PF_INET) < 0) {
- SGI_IF_ERROR("Error in nfq_unbind_pf()");
- exit(-1);
- }
-
- // Bind this handler to process IP packets...
- if (nfq_bind_pf(nfqHandle, PF_INET) < 0) {
- SGI_IF_ERROR("Error in nfq_bind_pf()");
- exit(-1);
- }
-
- // Install a callback on queue 1
- if (!(myQueue = nfq_create_queue(nfqHandle, 1, &sgi_nfqueue_callback, NULL))) {
- SGI_IF_ERROR("Error in nfq_create_queue()");
- exit(-1);
- }
-
- // Turn on packet copy mode
- if (nfq_set_mode(myQueue, NFQNL_COPY_PACKET, 0xffff) < 0) {
- SGI_IF_ERROR("Could not set packet copy mode");
- exit(-1);
- }
-
- netlinkHandle = nfq_nfnlh(nfqHandle);
- fd = nfnl_fd(netlinkHandle);
-
- SGI_IF_DEBUG("Waiting for egress packets\n");
- sgi_data_p->thread_started = 1;
-
- while ((res = recv(fd, &sgi_data_p->recv_buffer[sizeof(struct ether_header)], SGI_BUFFER_RECV_LEN, 0)) && res >= 0) {
- // a callback mechanism is used
- // rather than just handling it directly here, but that
- // seems to be the convention...
- nfq_handle_packet(nfqHandle, &sgi_data_p->recv_buffer[sizeof(struct ether_header)], res);
- // end while receiving traffic
- }
-
- nfq_destroy_queue(myQueue);
-
- nfq_close(nfqHandle);
-
- return NULL;
-}
diff --git a/openair-cn/SGI/sgi_pcap.c b/openair-cn/SGI/sgi_pcap.c
deleted file mode 100755
index b81d743562..0000000000
--- a/openair-cn/SGI/sgi_pcap.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/*******************************************************************************
- 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.
-
- *******************************************************************************/
-/*! \file sgi_pcap.c
-* \brief
-* \author Lionel Gauthier
-* \company Eurecom
-* \email: lionel.gauthier@eurecom.fr
-*/
-#include
-#include "sgi.h"
-
-
-//---------------------------------------------------------------------------------------------------------------------
-void* sgi_pcap_fw_2_gtpv1u_thread(void* args_p)
-{
- bpf_u_int32 netaddr = 0, mask = 0; // To store network address and netmask
- struct bpf_program filter; // Place to store the BPF filter program
- char errbuf[PCAP_ERRBUF_SIZE]; // Error buffer
- struct pcap_pkthdr pkthdr; // Packet information (timestamp, size...)
- const unsigned char *packet = NULL; // Received raw data
- char filter_string[] = "";
- sgi_data_t *sgi_data_p;
-
- sgi_data_p = (sgi_data_t*)args_p;
-
- SGI_IF_DEBUG("[PCAP] Device is %s and iif is %d\n", sgi_data_p->interface_name, sgi_data_p->interface_index);
-
- memset(errbuf, 0, PCAP_ERRBUF_SIZE);
-
- sgi_data_p->pcap_descr = pcap_open_live(sgi_data_p->interface_name, SGI_PCAPMAXBYTES2CAPTURE, 0, SGI_PCAPTIMEDELAYKERNEL2USERSPACE, errbuf);
-
- if (sgi_data_p->pcap_descr == NULL)
- SGI_IF_ERROR("Error %s", errbuf);
- else if (*errbuf)
- SGI_IF_WARNING("Warning %s\n", errbuf);
-
- // Look up info from the capture device
- if (pcap_lookupnet(sgi_data_p->interface_name, &netaddr, &mask, errbuf) == -1) {
- SGI_IF_ERROR("Can't get netmask for device %s\n", sgi_data_p->interface_name);
- netaddr = 0;
- mask = 0;
- pthread_exit(NULL);
- }
-
- // Compiles the filter expression into a BPF filter program
- if (pcap_compile(sgi_data_p->pcap_descr, &filter, filter_string, 0, mask) == -1) {
- SGI_IF_ERROR("Couldn't parse filter : %s\n", pcap_geterr(sgi_data_p->pcap_descr));
- pthread_exit(NULL);
- }
-
- // Load the filter program into the packet capture device
- if (pcap_setfilter(sgi_data_p->pcap_descr, &filter) == -1) {
- SGI_IF_ERROR("Couldn't install filter: %s\n", pcap_geterr(sgi_data_p->pcap_descr));
- pthread_exit(NULL);
- }
-
- pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
- sgi_data_p->thread_started = 1;
-
- while (1) {
- packet = pcap_next(sgi_data_p->pcap_descr, &pkthdr); // Get one packet
-
- if ( ( pkthdr.len > 0 ) && ( packet != NULL ) ) {
- sgi_print_hex_octets(packet, pkthdr.len);
-
- if (packet[54] == 0x85) { // case ROUTER SOLICITATION WITH ETHERNET HEADER
- }
- }
- }
-
- pthread_exit(NULL);
-}
-
diff --git a/openair-cn/SGI/sgi_socket.c b/openair-cn/SGI/sgi_socket.c
deleted file mode 100644
index a73fcbd9d2..0000000000
--- a/openair-cn/SGI/sgi_socket.c
+++ /dev/null
@@ -1,1035 +0,0 @@
-/*******************************************************************************
- 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.
-
- *******************************************************************************/
-/*! \file sgi_socket.c
-* \brief
-* \author Lionel Gauthier
-* \company Eurecom
-* \email: lionel.gauthier@eurecom.fr
-*/
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include //mmap
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#ifndef SGI_UE_ETHER_TRAFFIC
-#include
-#endif
-
-
-#include
-#include
-#include "sgi.h"
-#include "intertask_interface.h"
-
-
-//static char sgi_command_buffer[256];
-
-#define HW_ADDRESS "%02x:%02x:%02x:%02x:%02x:%02x"
-#define HW_ADDRESS_FORMAT(iFR) \
- (uint8_t)(iFR)[0], \
- (uint8_t)(iFR)[1], \
- (uint8_t)(iFR)[2], \
- (uint8_t)(iFR)[3], \
- (uint8_t)(iFR)[4], \
- (uint8_t)(iFR)[5]
-
-#define IPV4_ADDR "%u.%u.%u.%u"
-#define IPV4_ADDR_FORMAT(aDDRESS) \
- (uint8_t)((aDDRESS) & 0x000000ff), \
- (uint8_t)(((aDDRESS) & 0x0000ff00) >> 8 ), \
- (uint8_t)(((aDDRESS) & 0x00ff0000) >> 16), \
- (uint8_t)(((aDDRESS) & 0xff000000) >> 24)
-
-struct ipv6hdr {
- __u8 priority:4,
- version:4;
- __u8 flow_lbl[3];
-
- __be16 payload_len;
- __u8 nexthdr;
- __u8 hop_limit;
-
- struct in6_addr saddr;
- struct in6_addr daddr;
-};
-
-
-/// The number of frames in the ring
-// This number is not set in stone. Nor are block_size, block_nr or frame_size
-#define CONF_RING_FRAMES 128
-
-/// Offset of data from start of frame
-#define PKT_OFFSET (TPACKET_ALIGN(sizeof(struct tpacket_hdr)) + \
- TPACKET_ALIGN(sizeof(struct sockaddr_ll)))
-
-int sgi_create_vlan_interface(char *interface_nameP, int vlan_idP)
-{
- char vlan_interface_name[IFNAMSIZ];
- char command_line[256];
- int ret = 0;
-
- ret = sprintf(vlan_interface_name, "%s.%d", interface_nameP, vlan_idP);
-
- if (ret > 0) {
- ret = sprintf(command_line, "ifconfig %s down > /dev/null 2>&1", vlan_interface_name);
-
- if (ret > 0) ret = system(command_line);
- else return -1;
-
- ret = sprintf(command_line, "vconfig rem %s > /dev/null 2>&1", vlan_interface_name);
-
- if (ret > 0) ret = system(command_line);
- else return -1;
-
- ret = sprintf(command_line, "vconfig add %s %d", interface_nameP, vlan_idP);
-
- if (ret > 0) ret = system(command_line);
- else return -1;
-
- ret = sprintf(command_line, "ifconfig %s up", vlan_interface_name);
-
- if (ret > 0) ret = system(command_line);
- else return -1;
-
- ret = sprintf(command_line, "sync");
-
- if (ret > 0) ret = system(command_line);
- else return -1;
-
- //ret = sprintf(command_line, "ip -4 addr add 10.0.%d.2/24 dev %s", vlan_idP+200, vlan_interface_name);
- //if (ret > 0) ret = system(command_line); else return -1;
- return 0;
- } else {
- return -1;
- }
-}
-
-
-int sgi_create_sockets(sgi_data_t *sgi_data_p)
-{
-#ifdef SGI_SOCKET_BIND_TO_IF
- struct sockaddr_ll socket_address;
- char if_name[16];
-#endif
-#ifdef SGI_MARKING
- int value = 0;
- const int *val_p=&value;
-#endif
-#ifdef SGI_PACKET_RX_RING
- struct tpacket_req tp;
-#endif
- uint32_t i = 0;
-#ifndef SGI_UE_ETHER_TRAFFIC
- FILE *fp = NULL;
- char filename[128];
- int rc = 0;
- char *router_mac_addr = NULL;
- int b = 0;
- char addr_mac_byte[16];
-#endif
-
- if (sgi_data_p == NULL) {
- return -1;
- }
-
- SGI_IF_DEBUG("Creating sockets for sgi on interface %s\n", sgi_data_p->interface_name);
-
- // qci = 0 is for the default bearers QOS, Non-GBR
- /* Create a RAW IP socket and request for all internet IP traffic */
- // work
- for (i = 0; i < SGI_MAX_EPS_BEARERS_PER_USER; i++) {
-
- sgi_create_vlan_interface(sgi_data_p->interface_name,i+SGI_MIN_EPS_BEARER_ID);
-
- // works also
-#if defined SGI_SOCKET_RAW
- sgi_data_p->sd[i] = socket(PF_PACKET, SOCK_RAW, htons(IPPROTO_RAW));
-#else
-#if defined SGI_SOCKET_DGRAM
- SGI_IF_DEBUG("Created socket PF_PACKET/SOCK_DGRAM/ETH_P_ALL\n",strerror(errno), errno);
- sgi_data_p->sd[i] = socket(PF_PACKET, SOCK_DGRAM, htons(ETH_P_ALL));
-#endif
-#endif
- //sgi_data_p->sd[i] = socket(AF_INET, SOCK_RAW, ETH_P_IP);
- //sgi_data_p->sd[i] = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_IP));
-
- if (sgi_data_p->sd[i] < 0) {
- SGI_IF_ERROR("Error during socket creation (%s:%d)\n",strerror(errno), errno);
- goto error;
- }
-
- /* socket options, tell the kernel we provide the IP structure
- int one = 1;
- const int *val = &one;
- if(setsockopt(sgi_data_p->sd[i], IPPROTO_IP, IP_HDRINCL, val, sizeof(one)) < 0)
- {
- SGI_IF_ERROR("Error during socket setsockopt IP_HDRINCL (%s:%d)\n", strerror(errno), errno);
- goto error;
- }*/
-
-
-#ifdef SGI_MARKING
- // setting socket option to use MARK value
- //value = rab_id + SGI_MIN_EPS_BEARER_ID;
- value = 5;
-
- if (setsockopt (sgi_data_p->sd[i], SOL_SOCKET, SO_MARK, val_p, sizeof (value)) < 0) {
- SGI_IF_ERROR("error notifying kernel about MARK");
- goto error;
- }
-
- SGI_IF_DEBUG("Created socket %d for rab_id %d (for any UE context)\n", sgi_data_p->sd[i], value);
-#endif
-
-#ifdef SGI_PACKET_RX_RING
- // tell kernel to export data through mmap()ped ring
- tp.tp_block_size = CONF_RING_FRAMES * getpagesize();
- tp.tp_block_nr = 1;
- tp.tp_frame_size = getpagesize();
- tp.tp_frame_nr = CONF_RING_FRAMES;
-
- if (setsockopt(sgi_data_p->sd[i], SOL_PACKET, PACKET_RX_RING, (void*) &tp, sizeof(tp))) {
- SGI_IF_ERROR("setsockopt() ring\n");
- goto error;
- }
-
- // open ring
- sgi_data_p->sock_mmap_ring = mmap(0, tp.tp_block_size * tp.tp_block_nr, PROT_READ | PROT_WRITE, MAP_SHARED, sgi_data_p->sd[i], 0);
-
- if (!sgi_data_p->sock_mmap_ring) {
- SGI_IF_ERROR("Failed to mmap socket (%s:%d)\n", strerror(errno), errno);
- goto error;
- }
-
- /* Setup our ringbuffer */
- sgi_data_p->malloc_ring = malloc(tp.tp_frame_nr * sizeof(struct iovec));
-
- for(i=0; imalloc_ring[i].iov_base=(void *)((long)sgi_data_p->sock_mmap_ring)+(i*tp.tp_frame_size);
- sgi_data_p->malloc_ring[i].iov_len=tp.tp_frame_size;
- }
-
-#endif
-
-#ifdef SGI_SOCKET_BIND_TO_IF
- sprintf(if_name, "%s.%d",sgi_data_p->interface_name,i+SGI_MIN_EPS_BEARER_ID);
-
- memset(&socket_address, 0, sizeof(struct sockaddr_ll));
- socket_address.sll_family = AF_PACKET; //always PF_PACKET
-
- //socket_address.sll_addr = ;// Filled when we want to tx
- //socket_address.sll_halen = ;// Filled when we want to tx
- //socket_address.sll_family ;// Filled when we want to tx
-
- //socket_address.sll_hatype = ;// Filled when packet received
- //socket_address.sll_pkttype = ;// Filled when packet received
- sgi_data_p->if_index[i] = if_nametoindex(if_name);
- socket_address.sll_ifindex = sgi_data_p->if_index[i];
- //LG 2014-11-07socket_address.sll_protocol = htons(ETH_P_IP);/* Protocol phy level */
- socket_address.sll_protocol = htons(ETH_P_ALL);
-
- // Now we can bind the socket to send the IP traffic
- if (bind(sgi_data_p->sd[i], (struct sockaddr *)&socket_address, sizeof(struct sockaddr_ll)) < 0) {
- SGI_IF_ERROR("Bind socket to %s (%s:%d)\n", if_name, strerror(errno), errno);
- goto error;
- } else {
- SGI_IF_DEBUG("Bind EPS bearer ID %d socket %d to %s\n",
- i+SGI_MIN_EPS_BEARER_ID, sgi_data_p->sd[i], if_name);
- }
-
-#endif
-
- }
-
-#ifndef SGI_SOCKET_DGRAM
-
- if (sprintf(filename, "/sys/class/net/%s/address", sgi_data_p->interface_name) <= 0 ) {
- SGI_IF_ERROR("Build of file name /sys/class/net/sgi_if_name/address Failed (%s:%d)\n", strerror(errno), errno);
- goto error;
- }
-
- fp = fopen(filename, "r");
-
- if (fp) {
- rc = fscanf(fp, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx",
- &sgi_data_p->interface_hw_address[0],
- &sgi_data_p->interface_hw_address[1],
- &sgi_data_p->interface_hw_address[2],
- &sgi_data_p->interface_hw_address[3],
- &sgi_data_p->interface_hw_address[4],
- &sgi_data_p->interface_hw_address[5]);
- fclose(fp);
-
- if (rc <= 0) {
- SGI_IF_ERROR("ERROR reading %s\n" ,filename);
- goto error;
- }
- } else {
- SGI_IF_ERROR("Correct /sys/class/net/sgi_if_name file not found\n");
- goto error;
- }
-
- memcpy((void*)(&sgi_data_p->eh.ether_shost[0]), (void*)(&sgi_data_p->interface_hw_address[0]), ETH_ALEN);
- router_mac_addr = getenv("MAC_ROUTER");
-
- if (router_mac_addr == NULL) {
- SGI_IF_ERROR("ERROR getting ENV variable MAC_ROUTER, should be set by start script\n");
- goto error;
- }
-
- for (b = 0 ; b < 6; b++) {
- strncpy(addr_mac_byte, router_mac_addr+2*b, 2);
- addr_mac_byte[2] = '\0';
- // we can do (unsigned int*) because x86 processors are little-endian
- // (done for suppressing a warning)
- rc = sscanf ((const char*)addr_mac_byte, "%02x", (uint32_t*)&i);
-
- if (rc < 1) {
- SGI_IF_ERROR("Error in converting string MAC_ROUTER address %s in char array\n", router_mac_addr);
- goto error;
- }
-
- sgi_data_p->eh.ether_dhost[b] = (i & 0x000000FF);
- }
-
- SGI_IF_DEBUG("Found MAC address for ROUTER : %02x:%02x:%02x:%02x:%02x:%02x\n",
- NMACADDR(sgi_data_p->eh.ether_dhost));
-
-#ifdef VLAN8021Q
- sgi_data_p->eh.ether_vlan8021q.vlan_tpid = htons(0x8100);
- sgi_data_p->eh.ether_vlan8021q.vlan_tci = htons(0x7000 | 0x0000 | 0x0000);
-#endif
- SGI_IF_DEBUG("Found MAC address for SGI IF %s: %02x:%02x:%02x:%02x:%02x:%02x\n",
- sgi_data_p->interface_name, NMACADDR(sgi_data_p->eh.ether_shost));
-
-#endif
- return 0;
-error:
- SGI_IF_ERROR("ERROR (%s)\n", strerror(errno));
-
- for (i=0; isd[i] > 0) {
- close(sgi_data_p->sd[i]);
- }
-
- sgi_data_p->sd[i] = -1;
- }
-
- return -1;
-}
-#ifdef SGI_UE_ETHER_TRAFFIC
-int sgi_send_data(uint8_t *buffer_pP, uint32_t length, sgi_data_t *sgi_data_pP, Teid_t originating_sgw_S1u_teidP)
-{
- struct ether_header *eh_p = (struct ether_header *) buffer_pP;
- struct iphdr *iph_p = NULL;
- struct arphdr *arph_p = NULL;
- struct ipv6hdr *ip6h_p = NULL;
- sgi_teid_mapping_t *mapping_p = NULL;
- sgi_addr_mapping_t *addr_mapping_p = NULL;
- hashtable_rc_t hash_rc;
- struct in6_addr src6_addr; /* source address */
- struct in6_addr *src6_addr_p; /* source address */
- u_int32_t src4_addr;
-
- if (buffer_pP == NULL) {
- SGI_IF_ERROR("sgi_send_data: received bad parameter\n");
- return -1;
- }
-
- // get IP version of this packet
- switch (htons(eh_p->ether_type)) {
-
- //*******************
- case ETHERTYPE_IP:
- //*******************
- iph_p = (struct iphdr *) (buffer_pP + sizeof(struct ether_header));
- // The entry should be here but all signalling tied with RRC procedures not finished so
- // a data packet can arrive before the MODIFY_BEARER REQUEST
- src4_addr = iph_p->saddr;
-
- if (hashtable_get(sgi_data_pP->addr_v4_mapping, src4_addr, (void**)&addr_mapping_p) != HASH_TABLE_OK) {
- hash_rc = hashtable_get(sgi_data_pP->teid_mapping, originating_sgw_S1u_teidP, (void**)&mapping_p);
-
- if (hash_rc == HASH_TABLE_KEY_NOT_EXISTS) {
- SGI_IF_ERROR("%s Error unknown context SGW teid %d\n", __FUNCTION__, originating_sgw_S1u_teidP);
- return -1;
- } else {
- if (mapping_p->is_outgoing_ipv4_packet_seen == 0) {
- mapping_p->hw_addrlen = ETH_ALEN; // TO DO
- memcpy(mapping_p->ue_mac_addr, eh_p->ether_shost, ETH_ALEN);
- mapping_p->is_outgoing_ipv4_packet_seen = 1;
- mapping_p->in_add_captured.s_addr = src4_addr;
-
- addr_mapping_p = calloc(1, sizeof(sgi_addr_mapping_t));
- memcpy(addr_mapping_p->ue_mac_addr, eh_p->ether_shost, ETH_ALEN);
- addr_mapping_p->is_outgoing_packet_seen = 1;
- addr_mapping_p->enb_S1U_teid = mapping_p->enb_S1U_teid;
- addr_mapping_p->sgw_S1U_teid = originating_sgw_S1u_teidP;
- hashtable_insert(sgi_data_pP->addr_v4_mapping, src4_addr, (void*)addr_mapping_p);
- SGI_IF_DEBUG("%s ASSOCIATED %d.%d.%d.%d to MAC %02x:%02x:%02x:%02x:%02x:%02x teid %d\n",
- __FUNCTION__, NIPADDR(src4_addr), NMACADDR(eh_p->ether_shost), originating_sgw_S1u_teidP);
- } else {
- SGI_IF_ERROR("Error IPv4 address already registered for teid %d\n", originating_sgw_S1u_teidP);
- return -1;
- }
- }
-
- } else {
- hash_rc = hashtable_get(sgi_data_pP->teid_mapping, originating_sgw_S1u_teidP, (void**)&mapping_p);
- }
-
- break;
-
- //*******************
- case ETHERTYPE_ARP:
- //*******************
- arph_p = (struct arphdr *) (buffer_pP + sizeof(struct ether_header));
- // The entry should be here but all signalling tied with RRC procedures not finished so
- // a data packet can arrive before the MODIFY_BEARER REQUEST
- memcpy(&src4_addr, &((unsigned char*)(&arph_p[1]))[ETH_ALEN], 4);
- SGI_IF_ERROR("%s ARP OPCODE %s TARGET IP %d.%d.%d.%d\n", __FUNCTION__, sgi_arpopcode_2_str(ntohl(arph_p->ar_op)), NIPADDR(src4_addr));
-
- if (hashtable_get(sgi_data_pP->addr_v4_mapping, src4_addr, (void**)&addr_mapping_p) != HASH_TABLE_OK) {
- hash_rc = hashtable_get(sgi_data_pP->teid_mapping, originating_sgw_S1u_teidP, (void**)&mapping_p);
-
- if (hash_rc == HASH_TABLE_KEY_NOT_EXISTS) {
- SGI_IF_ERROR("%s Error unknown context SGW teid %d\n", __FUNCTION__, originating_sgw_S1u_teidP);
- return -1;
- } else {
- if (mapping_p->is_outgoing_ipv4_packet_seen == 0) {
- mapping_p->hw_addrlen = ETH_ALEN; // TO DO
- memcpy(mapping_p->ue_mac_addr, eh_p->ether_shost, ETH_ALEN);
- mapping_p->is_outgoing_ipv4_packet_seen = 1;
- mapping_p->in_add_captured.s_addr = src4_addr;
-
- addr_mapping_p = calloc(1, sizeof(sgi_addr_mapping_t));
- memcpy(addr_mapping_p->ue_mac_addr, eh_p->ether_shost, ETH_ALEN);
- addr_mapping_p->is_outgoing_packet_seen = 1;
- addr_mapping_p->enb_S1U_teid = mapping_p->enb_S1U_teid;
- addr_mapping_p->sgw_S1U_teid = originating_sgw_S1u_teidP;
- hashtable_insert(sgi_data_pP->addr_v4_mapping, src4_addr, (void*)addr_mapping_p);
- SGI_IF_DEBUG("%s ASSOCIATED %d.%d.%d.%d to MAC %02x:%02x:%02x:%02x:%02x:%02x teid %d\n",
- __FUNCTION__, NIPADDR(src4_addr), NMACADDR(eh_p->ether_shost), originating_sgw_S1u_teidP);
- } else {
- SGI_IF_ERROR("Error IPv4 address already registered for teid %d\n", originating_sgw_S1u_teidP);
- return -1;
- }
- }
-
- } else {
- hash_rc = hashtable_get(sgi_data_pP->teid_mapping, originating_sgw_S1u_teidP, (void**)&mapping_p);
- }
-
- break;
-
-
- //*******************
- case ETHERTYPE_IPV6:
- ip6h_p = (struct ipv6hdr *) (buffer_pP + sizeof(struct ether_header));
-
- if (obj_hashtable_get(sgi_data_pP->addr_v6_mapping, &src6_addr, sizeof(struct in6_addr), (void**)&addr_mapping_p) != HASH_TABLE_OK) {
- hash_rc = hashtable_get(sgi_data_pP->teid_mapping, originating_sgw_S1u_teidP, (void**)&mapping_p);
-
- if (hash_rc == HASH_TABLE_KEY_NOT_EXISTS) {
- SGI_IF_ERROR("%s Error unknown context SGW teid %d\n", __FUNCTION__, originating_sgw_S1u_teidP);
- return -1;
- } else {
-
- if (mapping_p->is_outgoing_ipv6_packet_seen < MAX_DEFINED_IPV6_ADDRESSES_PER_UE) {
- mapping_p->hw_addrlen = ETH_ALEN;
- memcpy(mapping_p->ue_mac_addr, eh_p->ether_shost, ETH_ALEN);
-
- memcpy(&mapping_p->in6_addr_captured[mapping_p->is_outgoing_ipv6_packet_seen].s6_addr, src6_addr.s6_addr, 16);
- mapping_p->is_outgoing_ipv6_packet_seen +=1;
-
- addr_mapping_p = calloc(1, sizeof(sgi_addr_mapping_t));
- memcpy(addr_mapping_p->ue_mac_addr, eh_p->ether_shost, ETH_ALEN);
- addr_mapping_p->is_outgoing_packet_seen = 1;
- addr_mapping_p->enb_S1U_teid = mapping_p->enb_S1U_teid;
- addr_mapping_p->sgw_S1U_teid = originating_sgw_S1u_teidP;
-
- src6_addr_p = malloc(sizeof(struct in6_addr));
-
- if (src6_addr_p == NULL) {
- return -1;
- }
-
- memcpy(src6_addr_p->s6_addr, ip6h_p->saddr.s6_addr, 16);
- obj_hashtable_insert(sgi_data_pP->addr_v6_mapping, src6_addr_p,sizeof(struct in6_addr), (void*)addr_mapping_p);
- } else {
- SGI_IF_ERROR("Error TOO MANY IPv6 address already registered for teid %d\n", originating_sgw_S1u_teidP);
- return -1;
- }
- }
-
- } else {
- hash_rc = hashtable_get(sgi_data_pP->teid_mapping, originating_sgw_S1u_teidP, (void**)&mapping_p);
- }
-
- break;
-
- default:
- SGI_IF_WARNING("%s UNHANDLED ETHERTYPE: %X\n", __FUNCTION__, htons(eh_p->ether_type));
- break;
- }
-
- assert(mapping_p != NULL);
-
- if (send(sgi_data_pP->sd[mapping_p->eps_bearer_id - SGI_MIN_EPS_BEARER_ID], (void *)buffer_pP, length, 0) < 0) {
- SGI_IF_ERROR("Error during send to socket %d bearer id %d : (%s:%d)\n",
- sgi_data_pP->sd[mapping_p->eps_bearer_id - SGI_MIN_EPS_BEARER_ID],
- mapping_p->eps_bearer_id,
- strerror(errno),
- errno);
- return -1;
- }
-
- return 0;
-}
-#else
-int sgi_send_data(uint8_t *buffer_pP, uint32_t length, sgi_data_t *sgi_data_pP, Teid_t originating_sgw_S1u_teidP)
-{
- struct iphdr *iph_p = (struct iphdr *) buffer_pP;
- struct ipv6hdr *ip6h_p = (struct ipv6hdr *) buffer_pP;
- sgi_teid_mapping_t *mapping_p = NULL;
- sgi_addr_mapping_t *addr_mapping_p = NULL;
- hashtable_rc_t hash_rc;
- struct in6_addr src6_addr; /* source address */
- struct in6_addr *src6_addr_p; /* source address */
- u_int32_t src4_addr;
- struct iovec iov[2];
-
- if (buffer_pP == NULL) {
- SGI_IF_ERROR("sgi_send_data: received bad parameter\n");
- return -1;
- }
-
- // get IP version of this packet
- switch (iph_p->version) {
-
- //*******************
- case 4:
- //*******************
- // The entry should be here but all signalling tied with RRC procedures not finished so
- // a data packet can arrive before the MODIFY_BEARER REQUEST
- sgi_data_pP->eh.ether_type = htons(ETHERTYPE_IP);
- src4_addr = iph_p->saddr;
-
- if (hashtable_get(sgi_data_pP->addr_v4_mapping, src4_addr, (void**)&addr_mapping_p) != HASH_TABLE_OK) {
- hash_rc = hashtable_get(sgi_data_pP->teid_mapping, originating_sgw_S1u_teidP, (void**)&mapping_p);
-
- if (hash_rc == HASH_TABLE_KEY_NOT_EXISTS) {
- SGI_IF_ERROR("%s Error unknown context SGW teid %d\n", __FUNCTION__, originating_sgw_S1u_teidP);
- return -1;
- } else {
- if (mapping_p->is_outgoing_ipv4_packet_seen == 0) {
- mapping_p->hw_addrlen = ETH_ALEN; // TO DO
- mapping_p->is_outgoing_ipv4_packet_seen = 1;
- mapping_p->in_add_captured.s_addr = src4_addr;
-
- addr_mapping_p = calloc(1, sizeof(sgi_addr_mapping_t));
- addr_mapping_p->is_outgoing_packet_seen = 1;
- addr_mapping_p->enb_S1U_teid = mapping_p->enb_S1U_teid;
- addr_mapping_p->sgw_S1U_teid = originating_sgw_S1u_teidP;
- hashtable_insert(sgi_data_pP->addr_v4_mapping, src4_addr, (void*)addr_mapping_p);
- SGI_IF_DEBUG("%s ASSOCIATED %d.%d.%d.%d to teid %d\n",
- __FUNCTION__, NIPADDR(src4_addr), originating_sgw_S1u_teidP);
- } else {
- SGI_IF_ERROR("Error IPv4 address already registered for teid %d\n", originating_sgw_S1u_teidP);
- return -1;
- }
- }
-
- } else {
- hash_rc = hashtable_get(sgi_data_pP->teid_mapping, originating_sgw_S1u_teidP, (void**)&mapping_p);
- }
-
- break;
-
-
-
- //*******************
- case 6:
- sgi_data_pP->eh.ether_type = htons(ETHERTYPE_IPV6);
-
- if (obj_hashtable_get(sgi_data_pP->addr_v6_mapping, &src6_addr, sizeof(struct in6_addr), (void**)&addr_mapping_p) != HASH_TABLE_OK) {
- hash_rc = hashtable_get(sgi_data_pP->teid_mapping, originating_sgw_S1u_teidP, (void**)&mapping_p);
-
- if (hash_rc == HASH_TABLE_KEY_NOT_EXISTS) {
- SGI_IF_ERROR("%s Error unknown context SGW teid %d\n", __FUNCTION__, originating_sgw_S1u_teidP);
- return -1;
- } else {
-
- if (mapping_p->is_outgoing_ipv6_packet_seen < MAX_DEFINED_IPV6_ADDRESSES_PER_UE) {
- mapping_p->hw_addrlen = 0;
-
- memcpy(&mapping_p->in6_addr_captured[mapping_p->is_outgoing_ipv6_packet_seen].s6_addr, src6_addr.s6_addr, 16);
- mapping_p->is_outgoing_ipv6_packet_seen +=1;
-
- addr_mapping_p = calloc(1, sizeof(sgi_addr_mapping_t));
- addr_mapping_p->is_outgoing_packet_seen = 1;
- addr_mapping_p->enb_S1U_teid = mapping_p->enb_S1U_teid;
- addr_mapping_p->sgw_S1U_teid = originating_sgw_S1u_teidP;
-
- src6_addr_p = malloc(sizeof(struct in6_addr));
-
- if (src6_addr_p == NULL) {
- return -1;
- }
-
- memcpy(src6_addr_p->s6_addr, ip6h_p->saddr.s6_addr, 16);
- obj_hashtable_insert(sgi_data_pP->addr_v6_mapping, src6_addr_p,sizeof(struct in6_addr), (void*)addr_mapping_p);
- } else {
- SGI_IF_ERROR("Error TOO MANY IPv6 address already registered for teid %d\n", originating_sgw_S1u_teidP);
- return -1;
- }
- }
-
- } else {
- hash_rc = hashtable_get(sgi_data_pP->teid_mapping, originating_sgw_S1u_teidP, (void**)&mapping_p);
- }
-
- break;
-
- default:
- SGI_IF_WARNING("%s UNHANDLED IP VERSION: %X\n", __FUNCTION__, iph_p->version);
- break;
- }
-
- assert(mapping_p != NULL);
- iov[0].iov_base = &sgi_data_pP->eh;
- iov[0].iov_len = sizeof(sgi_data_pP->eh);
- iov[1].iov_base = (void *)buffer_pP;
- iov[1].iov_len = length;
-#ifdef VLAN8021Q
- sgi_data_pP->eh.ether_vlan8021q.vlan_tci = htons(0x7000 | 0x0000 | mapping_p->eps_bearer_id);
-#endif
-
- //sgi_print_hex_octets(iov[0].iov_base, iov[0].iov_len);
- //sgi_print_hex_octets(iov[1].iov_base, iov[1].iov_len);
- if (writev(sgi_data_pP->sd[mapping_p->eps_bearer_id - SGI_MIN_EPS_BEARER_ID], (const struct iovec *)iov, 2) < 0) {
- SGI_IF_ERROR("Error during writev to socket %d bearer id %d : (%s:%d)\n",
- sgi_data_pP->sd[mapping_p->eps_bearer_id - SGI_MIN_EPS_BEARER_ID],
- mapping_p->eps_bearer_id,
- strerror(errno),
- errno);
- return -1;
- }
-
- /* if (send(sgi_data_pP->sd[mapping_p->eps_bearer_id - SGI_MIN_EPS_BEARER_ID], (void *)buffer_pP, length, 0) < 0) {
- SGI_IF_ERROR("Error during send to socket %d bearer id %d : (%s:%d)\n",
- sgi_data_pP->sd[mapping_p->eps_bearer_id - SGI_MIN_EPS_BEARER_ID],
- mapping_p->eps_bearer_id,
- strerror(errno),
- errno);
- return -1;
- }
- */
- return 0;
-}
-
-#endif
-int sgi_dgram_send_data(uint8_t *buffer_pP, uint32_t length, sgi_data_t *sgi_data_pP, Teid_t originating_sgw_S1u_teidP)
-{
- struct iphdr *iph_p = (struct iphdr *) buffer_pP;
- struct ipv6hdr *ip6h_p = (struct ipv6hdr *) buffer_pP;
- sgi_teid_mapping_t *mapping_p = NULL;
- sgi_addr_mapping_t *addr_mapping_p = NULL;
- hashtable_rc_t hash_rc;
- struct in6_addr src6_addr; /* source address */
- struct in6_addr *src6_addr_p; /* source address */
- u_int32_t src4_addr;
-
- struct sockaddr_ll device;
-
- if (buffer_pP == NULL) {
- SGI_IF_ERROR("sgi_send_data: received bad parameter\n");
- return -1;
- }
-
- // get IP version of this packet
- switch (iph_p->version) {
-
- //*******************
- case 4:
- //*******************
- // The entry should be here but all signalling tied with RRC procedures not finished so
- // a data packet can arrive before the MODIFY_BEARER REQUEST
- sgi_data_pP->eh.ether_type = htons(ETHERTYPE_IP);
- src4_addr = iph_p->saddr;
-
- if (hashtable_get(sgi_data_pP->addr_v4_mapping, src4_addr, (void**)&addr_mapping_p) != HASH_TABLE_OK) {
- hash_rc = hashtable_get(sgi_data_pP->teid_mapping, originating_sgw_S1u_teidP, (void**)&mapping_p);
-
- if (hash_rc == HASH_TABLE_KEY_NOT_EXISTS) {
- SGI_IF_ERROR("%s Error unknown context SGW teid %d\n", __FUNCTION__, originating_sgw_S1u_teidP);
- return -1;
- } else {
- if (mapping_p->is_outgoing_ipv4_packet_seen == 0) {
- mapping_p->hw_addrlen = 0; // TO DO
- mapping_p->is_outgoing_ipv4_packet_seen = 1;
- mapping_p->in_add_captured.s_addr = src4_addr;
-
- addr_mapping_p = calloc(1, sizeof(sgi_addr_mapping_t));
- addr_mapping_p->is_outgoing_packet_seen = 1;
- addr_mapping_p->enb_S1U_teid = mapping_p->enb_S1U_teid;
- addr_mapping_p->sgw_S1U_teid = originating_sgw_S1u_teidP;
- hashtable_insert(sgi_data_pP->addr_v4_mapping, src4_addr, (void*)addr_mapping_p);
- SGI_IF_DEBUG("%s ASSOCIATED %d.%d.%d.%d to teid %d\n",
- __FUNCTION__, NIPADDR(src4_addr), originating_sgw_S1u_teidP);
- } else {
- SGI_IF_ERROR("Error IPv4 address already registered for teid %d\n", originating_sgw_S1u_teidP);
- return -1;
- }
- }
- } else {
- hash_rc = hashtable_get(sgi_data_pP->teid_mapping, originating_sgw_S1u_teidP, (void**)&mapping_p);
- }
-
- break;
-
-
-
- //*******************
- case 6:
- sgi_data_pP->eh.ether_type = htons(ETHERTYPE_IPV6);
-
- if (obj_hashtable_get(sgi_data_pP->addr_v6_mapping, &src6_addr, sizeof(struct in6_addr), (void**)&addr_mapping_p) != HASH_TABLE_OK) {
- hash_rc = hashtable_get(sgi_data_pP->teid_mapping, originating_sgw_S1u_teidP, (void**)&mapping_p);
-
- if (hash_rc == HASH_TABLE_KEY_NOT_EXISTS) {
- SGI_IF_ERROR("%s Error unknown context SGW teid %d\n", __FUNCTION__, originating_sgw_S1u_teidP);
- return -1;
- } else {
-
- if (mapping_p->is_outgoing_ipv6_packet_seen < MAX_DEFINED_IPV6_ADDRESSES_PER_UE) {
- mapping_p->hw_addrlen = 0;
-
- memcpy(&mapping_p->in6_addr_captured[mapping_p->is_outgoing_ipv6_packet_seen].s6_addr, src6_addr.s6_addr, 16);
- mapping_p->is_outgoing_ipv6_packet_seen +=1;
-
- addr_mapping_p = calloc(1, sizeof(sgi_addr_mapping_t));
- addr_mapping_p->is_outgoing_packet_seen = 1;
- addr_mapping_p->enb_S1U_teid = mapping_p->enb_S1U_teid;
- addr_mapping_p->sgw_S1U_teid = originating_sgw_S1u_teidP;
-
- src6_addr_p = malloc(sizeof(struct in6_addr));
-
- if (src6_addr_p == NULL) {
- return -1;
- }
-
- memcpy(src6_addr_p->s6_addr, ip6h_p->saddr.s6_addr, 16);
- obj_hashtable_insert(sgi_data_pP->addr_v6_mapping, src6_addr_p,sizeof(struct in6_addr), (void*)addr_mapping_p);
- } else {
- SGI_IF_ERROR("Error TOO MANY IPv6 address already registered for teid %d\n", originating_sgw_S1u_teidP);
- return -1;
- }
- }
-
- } else {
- hash_rc = hashtable_get(sgi_data_pP->teid_mapping, originating_sgw_S1u_teidP, (void**)&mapping_p);
- }
-
- break;
-
- default:
- SGI_IF_WARNING("%s UNHANDLED IP VERSION: %X\n", __FUNCTION__, iph_p->version);
- break;
- }
-
- memset(&device, 0, sizeof(device));
- device.sll_family = AF_PACKET;
- device.sll_protocol = htons(ETH_P_ALL);
- device.sll_ifindex = sgi_data_pP->if_index[mapping_p->eps_bearer_id - SGI_MIN_EPS_BEARER_ID];
-
-
- if (sendto(sgi_data_pP->sd[mapping_p->eps_bearer_id - SGI_MIN_EPS_BEARER_ID],
- buffer_pP,
- length,
- 0,
- (struct sockaddr *) &device,
- sizeof (device)) < 0) {
- SGI_IF_ERROR("%d Error during send to socket %d bearer id %d : (%s:%d)\n",
- __LINE__,
- sgi_data_pP->sd[mapping_p->eps_bearer_id - SGI_MIN_EPS_BEARER_ID],
- mapping_p->eps_bearer_id,
- strerror(errno),
- errno);
- return -1;
- }
-
-
- return 0;
-}
-
-#ifdef SGI_TEST
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#define SGI_TEST_BUFF_LEN 500
-unsigned char sgi_test_tx_buffer[SGI_TEST_BUFF_LEN];
-
-
-void sgi_test_send_ping(sgi_data_t *sgi_dataP, uint32_t markP, uint64_t src_mac_addrP, uint64_t dst_mac_addrP, char* src_ip_addrP, char* dst_ip_addrP)
-{
-#ifdef SGI_PF_PACKET
- struct ether_header *eh = (struct ether_header *) sgi_test_tx_buffer;
- struct iphdr *iph = (struct iphdr *) (sgi_test_tx_buffer + sizeof(struct ether_header));
- struct icmphdr *icmp = (struct icmphdr *) (sgi_test_tx_buffer + sizeof(struct ether_header) + sizeof(struct iphdr));
-#else
- struct iphdr *iph = (struct iphdr *) sgi_test_tx_buffer;
- struct icmphdr *icmp = (struct icmphdr *) (sgi_test_tx_buffer + sizeof(struct iphdr));
-#endif
- struct hostent *hp, *hp2;
- struct in_addr ip_dst;
- struct in_addr ip_src;
-
-
-
-#ifdef SGI_PF_PACKET
- eh->ether_shost[0] = (u_int8_t)((src_mac_addrP & 0x0000FF0000000000) >> 40);
- eh->ether_shost[1] = (u_int8_t)((src_mac_addrP & 0x000000FF00000000) >> 32);
- eh->ether_shost[2] = (u_int8_t)((src_mac_addrP & 0x00000000FF000000) >> 24);
- eh->ether_shost[3] = (u_int8_t)((src_mac_addrP & 0x0000000000FF0000) >> 16);
- eh->ether_shost[4] = (u_int8_t)((src_mac_addrP & 0x000000000000FF00) >> 8);
- eh->ether_shost[5] = (u_int8_t) (src_mac_addrP & 0x00000000000000FF);
-
- eh->ether_dhost[0] = (u_int8_t)((dst_mac_addrP & 0x0000FF0000000000) >> 40);
- eh->ether_dhost[1] = (u_int8_t)((dst_mac_addrP & 0x000000FF00000000) >> 32);
- eh->ether_dhost[2] = (u_int8_t)((dst_mac_addrP & 0x00000000FF000000) >> 24);
- eh->ether_dhost[3] = (u_int8_t)((dst_mac_addrP & 0x0000000000FF0000) >> 16);
- eh->ether_dhost[4] = (u_int8_t)((dst_mac_addrP & 0x000000000000FF00) >> 8);
- eh->ether_dhost[5] = (u_int8_t) (dst_mac_addrP & 0x00000000000000FF);
- eh->ether_type = htons(ETH_P_IP);
-#endif
-
- if ((hp = gethostbyname(dst_ip_addrP)) == NULL) {
- SGI_IF_DEBUG("gethostbyname() is OK.\n");
-
- if ((ip_dst.s_addr = inet_addr(dst_ip_addrP)) == -1) {
- fprintf(stderr, "%s: Can't resolve, unknown host.\n", dst_ip_addrP);
- exit(1);
- }
- } else
- bcopy(hp->h_addr_list[0], &ip_dst.s_addr, hp->h_length);
-
- /* The following source address just redundant for target to collect */
- if ((hp2 = gethostbyname(src_ip_addrP)) == NULL) {
- SGI_IF_DEBUG("gethostbyname() is OK.\n");
-
- if ((ip_src.s_addr = inet_addr(src_ip_addrP)) == -1) {
- fprintf(stderr, "%s: Can't resolve, unknown host\n", src_ip_addrP);
- exit(1);
- }
- } else
- bcopy(hp2->h_addr_list[0], &ip_src.s_addr, hp->h_length);
-
- printf("Sending to %08X from spoofed %08X\n", ip_dst.s_addr, ip_src.s_addr);
- /* Ip structure, check the ip.h */
- iph->version = 4;
- iph->ihl = sizeof *iph >> 2;
- iph->tos = 0;
- iph->tot_len = htons(SGI_TEST_BUFF_LEN-sizeof(struct ether_header));
- iph->id = htons(4321);
- iph->frag_off = htons(0);
- iph->ttl = 255;
- iph->protocol = IPPROTO_ICMP;
- iph->check = htons(0);
- iph->saddr = ip_src.s_addr;
- iph->daddr = ip_dst.s_addr;
-
- icmp->type = ICMP_ECHO;
- icmp->code = 0;
- icmp->un.echo.id = 1000;
- icmp->un.echo.sequence = 10;
- /* Header checksum */
- icmp->checksum = 0;
-
- icmp-> checksum = in_cksum((unsigned short *)icmp, sizeof(struct icmphdr));
- iph->check = in_cksum((unsigned short *)iph, sizeof(struct iphdr));
-
- /* sending time */
- if (send(sgi_dataP->sd[0], sgi_test_tx_buffer, SGI_TEST_BUFF_LEN, 0) < 0) {
- SGI_IF_ERROR("sendto() error (%s:%d)\n", strerror(errno), errno);
- } else
- SGI_IF_DEBUG("sendto() is OK.\n");
-}
-
-#endif
-
-#ifdef ENABLE_USE_RAW_SOCKET_FOR_SGI
-
-void sgi_sock_raw_cleanup_handler(void *args_p)
-{
- sgi_data_t *sgi_data_p;
- int socket_index;
-
- sgi_data_p = ((sgi_read_thread_args_t*)args_p)->sgi_data;
- socket_index = ((sgi_read_thread_args_t*)args_p)->socket_index;
-
- SGI_IF_DEBUG("Called %s\n", __FUNCTION__);
-#ifdef SGI_PACKET_RX_RING
- free(sgi_data_p->malloc_ring);
- sgi_data_p->malloc_ring = NULL;
-
- if (munmap(sgi_data_p->sock_mmap_ring, CONF_RING_FRAMES * getpagesize())) {
- SGI_IF_ERROR("munmap\n");
- } else {
- sgi_data_p->sock_mmap_ring = NULL;
- }
-
-#endif
-
- if (sgi_data_p->sd[socket_index] > 0) {
- close(sgi_data_p->sd[socket_index]);
- SGI_IF_DEBUG("Closed soket %d\n", sgi_data_p->sd[socket_index]);
- }
-
- sgi_data_p->sd[socket_index] = -1;
-
- free(args_p);
-}
-
-void* sgi_sock_raw_fw_2_gtpv1u_thread(void* args_p)
-{
- sgi_data_t *sgi_data_p;
- int socket_index;
-#ifdef SGI_PACKET_RX_RING
- struct pollfd pfd;
- int i;
- pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
- char *names[]= {
- "<", /* incoming */
- "B", /* broadcast */
- "M", /* multicast */
- "P", /* promisc */
- ">", /* outgoing */
- };
-#else
- int num_bytes;
-#endif
- sgi_data_p = ((sgi_read_thread_args_t*)args_p)->sgi_data;
- socket_index = ((sgi_read_thread_args_t*)args_p)->socket_index;
-
- SGI_IF_DEBUG("RX thread on raw socket started, operating on Device %s.%d\n", sgi_data_p->interface_name, socket_index+SGI_MIN_EPS_BEARER_ID);
-
-
- pthread_cleanup_push(sgi_sock_raw_cleanup_handler, args_p);
-
- pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
-
- pthread_mutex_lock (&sgi_data_p->thread_started_mutex);
- sgi_data_p->thread_started += 1;
- pthread_mutex_unlock (&sgi_data_p->thread_started_mutex);
-
-#ifdef SGI_PACKET_RX_RING
- i = 0;
-
- while (1) {
- while(*(unsigned long*)sgi_data_p->malloc_ring[i].iov_base) {
- struct tpacket_hdr *h=sgi_data_p->malloc_ring[i].iov_base;
- struct sockaddr_ll *sll=(void *)h + TPACKET_ALIGN(sizeof(*h));
- unsigned char *bp=(unsigned char *)h + h->tp_mac;
-
- SGI_IF_DEBUG("%u.%.6u: if%u %s %u bytes\n",
- h->tp_sec, h->tp_usec,
- sll->sll_ifindex,
- names[sll->sll_pkttype],
- h->tp_len);
-
- sgi_process_raw_packet(sgi_data_p, bp, h->tp_len);
- pthread_mutex_lock(&mutex); /* memory barrier */
- /* tell the kernel this packet is done with */
- h->tp_status=0;
- pthread_mutex_unlock(&mutex); /* memory barrier */
-
- i=(i==CONF_RING_FRAMES-1) ? 0 : i+1;
- }
-
- /* Sleep when nothings happen */
- pfd.fd=sgi_data_p->sd;
- pfd.events=POLLIN|POLLERR;
- pfd.revents=0;
- poll(&pfd, 1, -1);
- }
-
-#else
-
- while (1) {
- num_bytes = recvfrom(sgi_data_p->sd[socket_index], &sgi_data_p->recv_buffer[0][socket_index], SGI_BUFFER_RECV_LEN, 0, NULL, NULL);
-
- if (num_bytes > 0) {
- SGI_IF_DEBUG("recvfrom bearer id %d %d bytes\n", socket_index + SGI_MIN_EPS_BEARER_ID, num_bytes);
-#ifdef SGI_SOCKET_RAW
- sgi_process_raw_packet(sgi_data_p, &sgi_data_p->recv_buffer[0][socket_index], num_bytes);
-#else
-#ifdef SGI_SOCKET_DGRAM
- sgi_process_dgram_packet(sgi_data_p, &sgi_data_p->recv_buffer[0][socket_index], num_bytes);
-#endif
-#endif
- } else {
- SGI_IF_DEBUG("recvfrom bearer id %d %d (%s:%d)\n", socket_index + SGI_MIN_EPS_BEARER_ID, num_bytes, strerror(errno), errno);
- }
- }
-
-#endif
- pthread_cleanup_pop(0);
- pthread_exit(NULL);
-}
-#endif
-
diff --git a/openair-cn/SGI/sgi_task.c b/openair-cn/SGI/sgi_task.c
deleted file mode 100644
index aa7e99eef5..0000000000
--- a/openair-cn/SGI/sgi_task.c
+++ /dev/null
@@ -1,361 +0,0 @@
-/*******************************************************************************
- 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.
-
- *******************************************************************************/
-/*! \file sgi_task.c
-* \brief
-* \author Lionel Gauthier
-* \company Eurecom
-* \email: lionel.gauthier@eurecom.fr
-*/
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-
-//-----------------------------------------------------------------------------
-#include "assertions.h"
-#include "mme_config.h"
-#include "intertask_interface.h"
-#include "sgi.h"
-
-//-----------------------------------------------------------------------------
-static void* sgi_task_thread(void *args_p);
-static int sgi_create_endpoint_request(sgi_data_t *sgi_dataP, SGICreateEndpointReq *req_p);
-static int sgi_update_endpoint_request(sgi_data_t *sgi_dataP, SGIUpdateEndpointReq *req_p);
-static int sgi_init_phase2(sgi_data_t *sgi_data_pP);
-//-----------------------------------------------------------------------------
-static pthread_t fw_2_sgi_task_thread;
-//-----------------------------------------------------------------------------
-static void* sgi_task_thread(void *args_p)
-//-----------------------------------------------------------------------------
-{
- sgi_data_t *sgi_data_p;
-
- if (args_p == NULL) {
- return NULL;
- }
-
- itti_mark_task_ready(TASK_FW_IP);
-
- sgi_data_p = (sgi_data_t *)args_p;
-
-
- while(1) {
- /* Trying to fetch a message from the message queue.
- * If the queue is empty, this function will block till a
- * message is sent to the task.
- */
- MessageDef *received_message_p;
- itti_receive_msg(TASK_FW_IP, &received_message_p);
-
- DevAssert(received_message_p != NULL);
-
- if (sgi_data_p->hss_associated) {
- switch (ITTI_MSG_ID(received_message_p)) {
- case GTPV1U_TUNNEL_DATA_IND: {
- /* We received data from GTPV1_U incoming from an UE.
- * Forward it host adapter.
- */
- Gtpv1uTunnelDataInd *data_ind_p;
- data_ind_p = &received_message_p->ittiMsg.gtpv1uTunnelDataInd;
-#ifdef SGI_SOCKET_RAW
- sgi_send_data(&data_ind_p->buffer[data_ind_p->offset], data_ind_p->length, sgi_data_p, data_ind_p->local_S1u_teid);
-#else
-#ifdef SGI_SOCKET_DGRAM
- sgi_dgram_send_data(&data_ind_p->buffer[data_ind_p->offset], data_ind_p->length, sgi_data_p, data_ind_p->local_S1u_teid);
-#endif
-#endif
- /* Buffer is no longer needed, free it */
- itti_free(ITTI_MSG_ORIGIN_ID(received_message_p), data_ind_p->buffer);
- }
- break;
-
- case SGI_CREATE_ENDPOINT_REQUEST: {
- SGICreateEndpointReq *req_p;
- req_p = &received_message_p->ittiMsg.sgiCreateEndpointReq;
- sgi_create_endpoint_request(sgi_data_p, req_p);
- }
- break;
-
- case SGI_UPDATE_ENDPOINT_REQUEST: {
- SGIUpdateEndpointReq *req_p;
- req_p = &received_message_p->ittiMsg.sgiUpdateEndpointReq;
- sgi_update_endpoint_request(sgi_data_p, req_p);
- }
- break;
-
- default: {
- SGI_IF_ERROR("Unkwnon message ID %d:%s\n",
- ITTI_MSG_ID(received_message_p), ITTI_MSG_NAME(received_message_p));
- }
- break;
- }
- } else {
- switch (ITTI_MSG_ID(received_message_p)) {
- case ACTIVATE_MESSAGE: {
- sgi_data_p->hss_associated = 1;
-#if !defined(ENABLE_USE_GTPU_IN_KERNEL)
- SGI_IF_DEBUG("HSS ASSOCIATED, CAN START VLANS (bug in freediameter)");
- sgi_init_phase2(sgi_data_p);
-#endif
- }
- break;
-
- default: {
- SGI_IF_ERROR("Unkwnon or ignored message ID %d:%s\n",
- ITTI_MSG_ID(received_message_p), ITTI_MSG_NAME(received_message_p));
- }
- break;
- }
- }
-
- itti_free(ITTI_MSG_ORIGIN_ID(received_message_p), received_message_p);
- received_message_p = NULL;
- }
-
- return NULL;
-}
-
-
-//------------------------------------------------------
-static int sgi_create_endpoint_request(sgi_data_t *sgi_dataP, SGICreateEndpointReq *req_p)
-//------------------------------------------------------
-{
- SGICreateEndpointResp *sgi_create_endpoint_resp_p;
- MessageDef *message_p;
- sgi_teid_mapping_t *mapping;
-
- SGI_IF_DEBUG("Rx IP_FW_CREATE_SGI_ENDPOINT_REQUEST, Context: S-GW S11 teid %u, S-GW S1U teid %u EPS bearer id %u\n",
- req_p->context_teid, req_p->sgw_S1u_teid, req_p->eps_bearer_id);
-
- message_p = itti_alloc_new_message(TASK_FW_IP, SGI_CREATE_ENDPOINT_RESPONSE);
-
- if (message_p == NULL) {
- return -1;
- }
-
- sgi_create_endpoint_resp_p = &message_p->ittiMsg.sgiCreateEndpointResp;
- sgi_create_endpoint_resp_p->context_teid = req_p->context_teid;
- sgi_create_endpoint_resp_p->sgw_S1u_teid = req_p->sgw_S1u_teid;
- sgi_create_endpoint_resp_p->eps_bearer_id = req_p->eps_bearer_id;
- sgi_create_endpoint_resp_p->pdn_type = req_p->pdn_type;
- sgi_create_endpoint_resp_p->paa = req_p->paa;
- sgi_create_endpoint_resp_p->status = SGI_STATUS_OK;
-
- if (hashtable_is_key_exists(sgi_dataP->teid_mapping, req_p->sgw_S1u_teid) == HASH_TABLE_OK) {
- SGI_IF_ERROR("SGI_STATUS_ERROR_CONTEXT_ALREADY_EXIST Context: S11 teid %u\n", req_p->context_teid);
- sgi_create_endpoint_resp_p->status = SGI_STATUS_ERROR_CONTEXT_ALREADY_EXIST;
- } else {
- mapping = malloc(sizeof(sgi_teid_mapping_t));
-
- if (mapping == NULL) {
- sgi_create_endpoint_resp_p->status = SGI_STATUS_ERROR_NO_MEMORY_AVAILABLE;
- } else {
- memset(mapping, 0 , sizeof(sgi_teid_mapping_t));
-
- mapping->eps_bearer_id = req_p->eps_bearer_id;
- mapping->enb_S1U_teid = -1;
-
- if (hashtable_insert(sgi_dataP->teid_mapping, req_p->sgw_S1u_teid, mapping) != 0) {
- SGI_IF_ERROR("SGI_STATUS_ERROR_SYSTEM_FAILURE Context: S11 teid %u\n", req_p->context_teid);
- sgi_create_endpoint_resp_p->status = SGI_STATUS_ERROR_SYSTEM_FAILURE;
- free(mapping);
- } else {
- SGI_IF_ERROR("SGI_STATUS_OK Context: S11 teid %u\n", req_p->context_teid);
- sgi_create_endpoint_resp_p->status = SGI_STATUS_OK;
- }
- }
- }
-
- return itti_send_msg_to_task(TASK_SPGW_APP, INSTANCE_DEFAULT, message_p);
-}
-
-//------------------------------------------------------
-static int sgi_update_endpoint_request(sgi_data_t *sgi_dataP, SGIUpdateEndpointReq *req_p)
-//------------------------------------------------------
-{
- SGIUpdateEndpointResp *sgi_update_endpoint_resp_p = NULL;
- MessageDef *message_p = NULL;
- sgi_teid_mapping_t *mapping = NULL;
-
- SGI_IF_DEBUG("Rx IP_FW_UPDATE_SGI_ENDPOINT_REQUEST, Context: S-GW S11 teid %u, S-GW S1U teid %u EPS bearer id %u\n",
- req_p->context_teid, req_p->sgw_S1u_teid, req_p->eps_bearer_id);
-
- message_p = itti_alloc_new_message(TASK_FW_IP, SGI_UPDATE_ENDPOINT_RESPONSE);
-
- if (message_p == NULL) {
- return -1;
- }
-
- sgi_update_endpoint_resp_p = &message_p->ittiMsg.sgiUpdateEndpointResp;
- sgi_update_endpoint_resp_p->context_teid = req_p->context_teid;
- sgi_update_endpoint_resp_p->sgw_S1u_teid = req_p->sgw_S1u_teid;
- sgi_update_endpoint_resp_p->eps_bearer_id = req_p->eps_bearer_id;
- sgi_update_endpoint_resp_p->enb_S1u_teid = req_p->enb_S1u_teid;
- sgi_update_endpoint_resp_p->status = SGI_STATUS_OK;
-
- if (hashtable_get(sgi_dataP->teid_mapping, req_p->sgw_S1u_teid, (void**)&mapping) == HASH_TABLE_OK) {
- mapping->enb_S1U_teid = req_p->enb_S1u_teid;
- } else {
- SGI_IF_ERROR("SGI_STATUS_ERROR_CONTEXT_NOT_FOUND Context: S11 teid %u\n", req_p->context_teid);
- sgi_update_endpoint_resp_p->status = SGI_STATUS_ERROR_CONTEXT_NOT_FOUND;
- }
-
- return itti_send_msg_to_task(TASK_SPGW_APP, INSTANCE_DEFAULT, message_p);
-}
-
-//-----------------------------------------------------------------------------
-int sgi_init(const pgw_config_t *pgw_config_p)
-//-----------------------------------------------------------------------------
-{
-
- volatile sgi_data_t *sgi_data_p;
- int len;
- int i;
-
- SGI_IF_DEBUG("Initializing FW_IP task interface\n");
-
- sgi_data_p = malloc(sizeof(sgi_data_t));
- memset((void *)sgi_data_p, 0, sizeof(sgi_data_t));
-
- for (i=0; i < SGI_MAX_EPS_BEARERS_PER_USER; i++) {
- sgi_data_p->sd[i] = -1;
- }
-
- sgi_data_p->thread_started = 0;
- pthread_mutex_init (&sgi_data_p->thread_started_mutex, NULL);
-
- sgi_data_p->teid_mapping = hashtable_create (SGI_MAX_EPS_BEARERS, NULL, NULL);
-
- if (sgi_data_p->teid_mapping == NULL) {
- SGI_IF_ERROR("Failed to create SGI hashtable teid_mapping\n");
- return -1;
- }
-
- sgi_data_p->addr_v4_mapping = hashtable_create (SGI_MAX_SERVED_USERS_PER_PGW, NULL, NULL);
-
- if (sgi_data_p->addr_v4_mapping == NULL) {
- SGI_IF_ERROR("Failed to create SGI hashtable addr_v4_mapping\n");
- return -1;
- }
-
- sgi_data_p->addr_v6_mapping = obj_hashtable_create (SGI_MAX_SERVED_USERS_PER_PGW, NULL, NULL, NULL);
-
- if (sgi_data_p->addr_v6_mapping == NULL) {
- SGI_IF_ERROR("Failed to create SGI hashtable addr_v6_mapping\n");
- return -1;
- }
-
-
- len = strlen(pgw_config_p->ipv4.pgw_interface_name_for_SGI);
- sgi_data_p->interface_name = calloc(len + 1, sizeof(char));
- memcpy(sgi_data_p->interface_name, pgw_config_p->ipv4.pgw_interface_name_for_SGI, len);
- sgi_data_p->interface_name[len] = '\0';
- sgi_data_p->ipv4_addr = pgw_config_p->ipv4.pgw_ipv4_address_for_SGI;
-
-
- if (pthread_create(&fw_2_sgi_task_thread, NULL, &sgi_task_thread, (void *)sgi_data_p) < 0) {
- SGI_IF_ERROR("sgi_task_thread pthread_create: %s", strerror(errno));
- return -1;
- }
-
- return 0;
-}
-
-int sgi_init_phase2(sgi_data_t *sgi_data_pP)
-{
- int i;
-
- if (strcmp(sgi_data_pP->interface_name, PGW_CONFIG_STRING_INTERFACE_DISABLED) != 0) {
- sgi_data_pP->interface_index = if_nametoindex(sgi_data_pP->interface_name);
-
- if (sgi_create_sockets(sgi_data_pP) < 0) {
- SGI_IF_ERROR("Could not create socket, leaving thread %s\n", __FUNCTION__);
- free(sgi_data_pP);
- return -1;
- }
- } else {
- SGI_IF_WARNING("SGI interface disabled by config file\n");
- }
-
-
- if (strcmp(sgi_data_pP->interface_name, PGW_CONFIG_STRING_INTERFACE_DISABLED) != 0) {
-#ifdef ENABLE_USE_PCAP_FOR_SGI
-
- if (pthread_create(&sgi_data_pP->capture_on_sgi_if_thread, NULL, &sgi_pcap_fw_2_gtpv1u_thread, (void *)sgi_data_pP) < 0) {
- SGI_IF_ERROR("sgi_pcap_fw_2_gtpv1u_thread pthread_create: %s", strerror(errno));
- return -1;
- }
-
-#endif
-#ifdef ENABLE_USE_NETFILTER_FOR_SGI
-
- if (pthread_create(&sgi_data_pP->capture_on_sgi_if_thread, NULL, &sgi_nf_fw_2_gtpv1u_thread, (void *)sgi_data_pP) < 0) {
- SGI_IF_ERROR("sgi_nf_fw_2_gtpv1u_thread pthread_create: %s", strerror(errno));
- return -1;
- }
-
-#endif
- //#if 0
-#ifdef ENABLE_USE_RAW_SOCKET_FOR_SGI
-
- for (i=0; i < SGI_MAX_EPS_BEARERS_PER_USER; i++) {
- sgi_read_thread_args_t *args_p = malloc(sizeof(sgi_read_thread_args_t));
- args_p->sgi_data = sgi_data_pP;
- args_p->socket_index = i;
-
- if (pthread_create(&sgi_data_pP->capture_on_sgi_if_thread, NULL, &sgi_sock_raw_fw_2_gtpv1u_thread, (void *)args_p) < 0) {
- SGI_IF_ERROR("sgi_sock_raw_fw_2_gtpv1u_thread pthread_create: %s", strerror(errno));
- return -1;
- }
- }
-
-#endif
- //#endif
- }
-
- while (sgi_data_pP->thread_started != SGI_MAX_EPS_BEARERS_PER_USER ) {
- usleep(1000);
- }
-
- /*SGI_IF_DEBUG("ARP RESOLVING ROUTER...\n");
- while (sgi_data_p->hw_address_of_router_captured == 0) {
- sgi_send_arp_request(sgi_data_p, "router.eur");
- sleep(2);
- }*/
- SGI_IF_DEBUG("Initializing FW_IP task interface: DONE\n");
- return 0;
-}
diff --git a/openair-cn/SGI/sgi_util.c b/openair-cn/SGI/sgi_util.c
deleted file mode 100755
index 879b451e50..0000000000
--- a/openair-cn/SGI/sgi_util.c
+++ /dev/null
@@ -1,304 +0,0 @@
-/*******************************************************************************
- 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.
-
- *******************************************************************************/
-/*! \file sgi_util.c
-* \brief
-* \author Lionel Gauthier
-* \company Eurecom
-* \email: lionel.gauthier@eurecom.fr
-*/
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include "sgi.h"
-
-#define FW_2_PRINT_BUFFER_LEN 10000
-static char fw_2_print_buffer[FW_2_PRINT_BUFFER_LEN];
-//-----------------------------------------------------------------------------
-void sgi_print_hex_octets(unsigned char* dataP, unsigned long sizeP)
-//-----------------------------------------------------------------------------
-{
- unsigned long octet_index = 0;
- unsigned long buffer_marker = 0;
- unsigned char aindex;
- struct timeval tv;
- struct timezone tz;
- char timeofday[64];
- unsigned int h,m,s;
-
- if (dataP == NULL) {
- return;
- }
-
- gettimeofday(&tv, &tz);
- h = (tv.tv_sec/3600) % 24;
- m = (tv.tv_sec / 60) % 60;
- s = tv.tv_sec % 60;
- snprintf(timeofday, 64, "%02d:%02d:%02d.%06d", h,m,s,tv.tv_usec);
-
- SGI_IF_DEBUG("%s------+-------------------------------------------------+\n",timeofday);
- SGI_IF_DEBUG("%s | 0 1 2 3 4 5 6 7 8 9 a b c d e f |\n",timeofday);
- SGI_IF_DEBUG("%s------+-------------------------------------------------+\n",timeofday);
-
- for (octet_index = 0; octet_index < sizeP; octet_index++) {
- if ((octet_index % 16) == 0) {
- if (octet_index != 0) {
- buffer_marker+=snprintf(&fw_2_print_buffer[buffer_marker], FW_2_PRINT_BUFFER_LEN - buffer_marker, " |\n");
- SGI_IF_DEBUG("%s%s",timeofday, fw_2_print_buffer);
- buffer_marker = 0;
- }
-
- buffer_marker+=snprintf(&fw_2_print_buffer[buffer_marker], FW_2_PRINT_BUFFER_LEN - buffer_marker, " %04ld |", octet_index);
- }
-
- /*
- * Print every single octet in hexadecimal form
- */
- buffer_marker+=snprintf(&fw_2_print_buffer[buffer_marker], FW_2_PRINT_BUFFER_LEN - buffer_marker, " %02x", dataP[octet_index]);
- /*
- * Align newline and pipes according to the octets in groups of 2
- */
- }
-
- /*
- * Append enough spaces and put final pipe
- */
- for (aindex = octet_index; aindex < 16; ++aindex)
- buffer_marker+=snprintf(&fw_2_print_buffer[buffer_marker], FW_2_PRINT_BUFFER_LEN - buffer_marker, " ");
-
- //SGI_IF_DEBUG(" ");
- buffer_marker+=snprintf(&fw_2_print_buffer[buffer_marker], FW_2_PRINT_BUFFER_LEN - buffer_marker, " |\n");
- SGI_IF_DEBUG("%s%s",timeofday,fw_2_print_buffer);
-}
-
-//-----------------------------------------------------------------------------
-char* sgi_status_2_str(SGIStatus_t statusP)
-//-----------------------------------------------------------------------------
-{
- switch (statusP) {
- case SGI_STATUS_OK:
- return "SGI_STATUS_OK";
- break;
-
- case SGI_STATUS_ERROR_CONTEXT_ALREADY_EXIST:
- return "SGI_STATUS_ERROR_CONTEXT_ALREADY_EXIST";
- break;
-
- case SGI_STATUS_ERROR_CONTEXT_NOT_FOUND:
- return "SGI_STATUS_ERROR_CONTEXT_NOT_FOUND";
- break;
-
- case SGI_STATUS_ERROR_INVALID_MESSAGE_FORMAT:
- return "SGI_STATUS_ERROR_INVALID_MESSAGE_FORMAT";
- break;
-
- case SGI_STATUS_ERROR_SERVICE_NOT_SUPPORTED:
- return "SGI_STATUS_ERROR_SERVICE_NOT_SUPPORTED";
- break;
-
- case SGI_STATUS_ERROR_SYSTEM_FAILURE:
- return "SGI_STATUS_ERROR_SYSTEM_FAILURE";
- break;
-
- case SGI_STATUS_ERROR_NO_RESOURCES_AVAILABLE:
- return "SGI_STATUS_ERROR_NO_RESOURCES_AVAILABLE";
- break;
-
- case SGI_STATUS_ERROR_NO_MEMORY_AVAILABLE:
- return "SGI_STATUS_ERROR_NO_MEMORY_AVAILABLE";
- break;
-
- default:
- return "UNKNOWN_SGI_STATUS";
- }
-}
-
-//-----------------------------------------------------------------------------
-char* sgi_arpopcode_2_str(unsigned short int opcodeP)
-//-----------------------------------------------------------------------------
-{
- switch (opcodeP) {
- case ARPOP_REQUEST:
- return "ARPOP_REQUEST";
- break;
-
- case ARPOP_REPLY:
- return "ARPOP_REPLY";
- break;
-
- case ARPOP_RREQUEST:
- return "ARPOP_RREQUEST";
- break;
-
- case ARPOP_RREPLY:
- return "ARPOP_RREPLY";
- break;
-
- case ARPOP_InREQUEST:
- return "ARPOP_InREQUEST";
- break;
-
- case ARPOP_InREPLY:
- return "ARPOP_InREPLY";
- break;
-
- case ARPOP_NAK:
- return "ARPOP_NAK";
- break;
-
- default:
- return "UNKNOWN_ARP_OPCODE";
- }
-}
-//-----------------------------------------------------------------------------
-unsigned short in_cksum(unsigned short *addr, int len)
-//-----------------------------------------------------------------------------
-{
- register int sum = 0;
- u_short answer = 0;
- register u_short *w = addr;
- register int nleft = len;
-
- /*
- * Our algorithm is simple, using a 32 bit accumulator (sum), we add
- * sequential 16 bit words to it, and at the end, fold back all the
- * carry bits from the top 16 bits into the lower 16 bits.
- */
- while (nleft > 1) {
- sum += *w++;
- nleft -= 2;
- }
-
- /* mop up an odd byte, if necessary */
- if (nleft == 1) {
- *(u_char *) (&answer) = *(u_char *) w;
- sum += answer;
- }
-
- /* add back carry outs from top 16 bits to low 16 bits */
- sum = (sum >> 16) + (sum & 0xffff); /* add hi 16 to low 16 */
- sum += (sum >> 16); /* add carry */
- answer = ~sum; /* truncate to 16 bits */
- return (answer);
-}
-//-----------------------------------------------------------------------------
-void sgi_send_arp_request(sgi_data_t *sgi_dataP, char* dst_ip_addrP)
-//-----------------------------------------------------------------------------
-{
- char buffer[100]; // ARP request is 60 bytes including ethernet
- struct arphdr_s *arph = (struct arphdr_s *)(buffer);
- struct hostent *hp = NULL;
- uint32_t i;
- struct in_addr ip_dst;
- struct ifreq ifr;
- struct iovec iov[2];
-
- sgi_dataP->eh.ether_dhost[0] = (u_int8_t)(0xFF);
- sgi_dataP->eh.ether_dhost[1] = (u_int8_t)(0xFF);
- sgi_dataP->eh.ether_dhost[2] = (u_int8_t)(0xFF);
- sgi_dataP->eh.ether_dhost[3] = (u_int8_t)(0xFF);
- sgi_dataP->eh.ether_dhost[4] = (u_int8_t)(0xFF);
- sgi_dataP->eh.ether_dhost[5] = (u_int8_t)(0xFF);
-
- // get IP address of the default virtual interface
- ifr.ifr_addr.sa_family = AF_INET;
- sprintf(ifr.ifr_name, "%s.%d",sgi_dataP->interface_name,SGI_MIN_EPS_BEARER_ID);
-
- if (ioctl(sgi_dataP->sd[0], SIOCGIFADDR, &ifr) != 0) {
- SGI_IF_ERROR("Error during IP ADDRESS RETRIEVAL ON SGI INTERFACE (%s:%d)\n",strerror(errno), errno);
- exit (-1);
- }
-
- if ((hp = gethostbyname(dst_ip_addrP)) == NULL) {
- SGI_IF_DEBUG("gethostbyname() is OK.\n");
-
- if ((ip_dst.s_addr = inet_addr(dst_ip_addrP)) == -1) {
- SGI_IF_ERROR("%s: Can't resolve, unknown host.\n", dst_ip_addrP);
- exit(1);
- }
- } else
- bcopy(hp->h_addr_list[0], &ip_dst.s_addr, hp->h_length);
-
- arph->ar_hrd = htons(ARPHRD_ETHER);
- arph->ar_pro = htons(ETH_P_IP);
- arph->ar_hln = ETH_ALEN;
- arph->ar_pln = 4;
- arph->ar_op = htons(ARPOP_REQUEST);
-
- // sources
- memcpy(arph->ar_sha, sgi_dataP->eh.ether_shost, ETH_ALEN);
-
- i = ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr.s_addr;
- arph->ar_sip[3] = i >> 24;
- arph->ar_sip[2] = (i & 0x00FF0000) >> 16;
- arph->ar_sip[1] = (i & 0x0000FF00) >> 8;
- arph->ar_sip[0] = (i & 0x000000FF);
-
- // destinations
- memset(arph->ar_tha, 0, ETH_ALEN);
-
- i = ip_dst.s_addr;
- arph->ar_tip[3] = i >> 24;
- arph->ar_tip[2] = (i & 0x00FF0000) >> 16;
- arph->ar_tip[1] = (i & 0x0000FF00) >> 8;
- arph->ar_tip[0] = (i & 0x000000FF);
- // save ip address of router for comparing with ARP REPLY
- sgi_dataP->ipv4_addr_of_router = ip_dst.s_addr;
-
- iov[0].iov_base = &sgi_dataP->eh;
- iov[0].iov_len = sizeof(sgi_dataP->eh);
- iov[1].iov_base = (void *)buffer;
- iov[1].iov_len = sizeof (struct arphdr) + ETH_ALEN*2 + 4*2;
-#ifdef VLAN8021Q
- sgi_data_p->eh.ether_vlan8021q.vlan_tpid = htons(0x8100);
- sgi_dataP->eh.ether_vlan8021q.vlan_tci = htons(0x7000 | 0x0000 | SGI_MIN_EPS_BEARER_ID);
-#endif
- sgi_dataP->eh.ether_type = htons(ETH_P_ARP);
-
- sgi_print_hex_octets(iov[0].iov_base, iov[0].iov_len);
- sgi_print_hex_octets(iov[1].iov_base, iov[1].iov_len);
-
- if (writev(sgi_dataP->sd[0], (const struct iovec *)&iov, 2) < 0) {
- SGI_IF_ERROR("Error during send ARP to socket %d bearer id %d : (%s:%d)\n",
- sgi_dataP->sd[0],
- SGI_MIN_EPS_BEARER_ID,
- strerror(errno),
- errno);
- exit(1);
- }
-
-}
-
diff --git a/openair-cn/SGW-LITE/sgw_lite_context_manager.h b/openair-cn/SGW-LITE/sgw_lite_context_manager.h
index 16d558b1bb..7cdd2676f4 100644
--- a/openair-cn/SGW-LITE/sgw_lite_context_manager.h
+++ b/openair-cn/SGW-LITE/sgw_lite_context_manager.h
@@ -119,9 +119,7 @@ typedef struct pgw_eps_bearer_context_information_s {
// A primary key for a EPS Bearer entry can be a tuple (eps bearer id, imsi)
typedef struct sgw_eps_bearer_entry_s {
-#if defined (ENABLE_USE_GTPU_IN_KERNEL)
PAA_t paa;
-#endif
ebi_t eps_bearer_id; ///< An EPS bearer identity uniquely identifies an EPS bearer for one UE accessing via E-UTRAN
// TO DO traffic_flow_template_t tft; ///< Traffic Flow Template
diff --git a/openair-cn/SGW-LITE/sgw_lite_handlers.c b/openair-cn/SGW-LITE/sgw_lite_handlers.c
index d3cdb6abe0..66db5a9675 100644
--- a/openair-cn/SGW-LITE/sgw_lite_handlers.c
+++ b/openair-cn/SGW-LITE/sgw_lite_handlers.c
@@ -52,6 +52,7 @@
#include "sgw_lite_handlers.h"
#include "sgw_lite_context_manager.h"
#include "sgw_lite.h"
+#include "sgw_lite_ie_defs.h"
#include "pgw_lite_paa.h"
#include "spgw_config.h"
@@ -213,7 +214,6 @@ sgw_lite_handle_create_session_request(
return -1;
}
-#if defined (ENABLE_USE_GTPU_IN_KERNEL)
{
Gtpv1uCreateTunnelResp createTunnelResp;
@@ -223,14 +223,6 @@ sgw_lite_handle_create_session_request(
createTunnelResp.S1u_teid = sgw_get_new_teid();
sgw_lite_handle_gtpv1uCreateTunnelResp(&createTunnelResp);
}
-#else
- message_p->ittiMsg.gtpv1uCreateTunnelReq.context_teid = new_endpoint_p->local_teid;
- message_p->ittiMsg.gtpv1uCreateTunnelReq.eps_bearer_id = session_req_pP->bearer_to_create.eps_bearer_id;
- SPGW_APP_DEBUG("Tx GTPV1U_CREATE_TUNNEL_REQ -> TASK_GTPV1_U, Context: S-GW S11 teid %u eps bearer id %d (from session req)\n",
- message_p->ittiMsg.gtpv1uCreateTunnelReq.context_teid,
- message_p->ittiMsg.gtpv1uCreateTunnelReq.eps_bearer_id);
- return itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p);
-#endif
} else {
SPGW_APP_WARN("Could not create new transaction for SESSION_CREATE message\n");
free(new_endpoint_p);
@@ -252,6 +244,9 @@ sgw_lite_handle_sgi_endpoint_created(
MessageDef *message_p = NULL;
hashtable_rc_t hash_rc;
+
+
+
SPGW_APP_DEBUG("Rx SGI_CREATE_ENDPOINT_RESPONSE,Context: S11 teid %u, SGW S1U teid %u EPS bearer id %u\n",
resp_pP->context_teid, resp_pP->sgw_S1u_teid, resp_pP->eps_bearer_id);
hash_rc = hashtable_get(sgw_app.s11_bearer_context_information_hashtable, resp_pP->context_teid, (void**)&new_bearer_ctxt_info_p);
@@ -289,7 +284,6 @@ sgw_lite_handle_sgi_endpoint_created(
create_session_response_p->ambr.br_dl = 100000000;
create_session_response_p->ambr.br_ul = 40000000;
-#if defined(ENABLE_USE_GTPU_IN_KERNEL)
{
sgw_eps_bearer_entry_t* eps_bearer_entry_p = NULL;
hash_rc = hashtable_get (new_bearer_ctxt_info_p->sgw_eps_bearer_context_information.pdn_connection.sgw_eps_bearers,
@@ -305,10 +299,14 @@ sgw_lite_handle_sgi_endpoint_created(
sizeof(PAA_t));
}
}
-#endif
memcpy(&create_session_response_p->paa,
&resp_pP->paa,
sizeof(PAA_t));
+
+ memcpy(&create_session_response_p->pco,
+ &resp_pP->pco,
+ sizeof(pco_flat_t));
+
/* Set the Cause information from bearer context created.
* "Request accepted" is returned when the GTPv2 entity has accepted a control plane request.
*/
@@ -368,6 +366,33 @@ sgw_lite_handle_gtpv1uCreateTunnelResp(
hashtable_rc_t hash_rc;
struct in_addr inaddr ;
struct in6_addr in6addr = IN6ADDR_ANY_INIT;
+ SGICreateEndpointResp sgi_create_endpoint_resp;
+
+ unsigned int pco_in_index = 0;
+ unsigned int pco_out_index = 0;
+ signed int length_in_pco = 0;
+ uint16_t pi_or_ci = 0; // protocol identifier or container identifier;
+ uint8_t length_pi_or_ci = 0;
+ uint8_t length_out_pi_or_ci = 0;
+
+ uint16_t ipcp_length = 0;
+ uint16_t ipcp_out_length = 0;
+ signed int ipcp_remaining_length = 0;
+ uint8_t ipcp_option = 0;
+ uint8_t ipcp_option_length = 0;
+ uint8_t ipcp_code = 0;
+ uint8_t ipcp_out_code = IPCP_CODE_CONFIGURE_ACK;
+ uint8_t ipcp_identifier = 0;
+ uint32_t ipcp_dns_prim_ipv4_addr = 0xFFFFFFFF;
+ uint32_t ipcp_dns_sec_ipv4_addr = 0xFFFFFFFF;
+ uint32_t ipcp_out_dns_prim_ipv4_addr = 0xFFFFFFFF;
+ uint32_t ipcp_out_dns_sec_ipv4_addr = 0xFFFFFFFF;
+ pco_flat_t *in_pco_p = NULL;
+ pco_flat_t out_pco ;
+
+ uint8_t address_allocation_via_nas_signalling = FALSE;
+ uint8_t address_allocation_via_dhcpv4 = FALSE;
+
#if defined(ENABLE_STANDALONE_EPC)
to_task = TASK_MME_APP;
@@ -401,10 +426,173 @@ sgw_lite_handle_gtpv1uCreateTunnelResp(
sgw_lite_display_s11_bearer_context_information_mapping();
-#if defined (ENABLE_USE_GTPU_IN_KERNEL)
- SGICreateEndpointResp sgi_create_endpoint_resp;
-
memset(&sgi_create_endpoint_resp, 0, sizeof(SGICreateEndpointResp));
+
+
+ //--------------------------------------------------------------------------
+ // PCO processing
+ //--------------------------------------------------------------------------
+ in_pco_p = &new_bearer_ctxt_info_p->sgw_eps_bearer_context_information.saved_message.pco;
+
+ length_in_pco = in_pco_p->byte[1];
+ if ((length_in_pco+1+1) != in_pco_p->length) {
+ SPGW_APP_DEBUG("PCO: mismatch in lengths length_pco+1+1 %u != in_pco_p->length %u\n",
+ length_in_pco+1+1, in_pco_p->length);
+ }
+ sgi_create_endpoint_resp.pco.byte[0] = in_pco_p->byte[0];
+ pco_out_index = 2;
+
+ if ((length_in_pco > 0) && (in_pco_p->byte[2] & 0x80)) {
+ sgi_create_endpoint_resp.pco.byte[pco_out_index++] = in_pco_p->byte[2];
+
+ pco_in_index = PCO_MIN_LENGTH;
+ while (length_in_pco >= 3) {
+ SPGW_APP_DEBUG("PCO: Protocol identifier in length_in_pco %d\n", length_in_pco);
+ pi_or_ci = (((uint16_t)in_pco_p->byte[pco_in_index]) << 8) | (uint16_t)in_pco_p->byte[pco_in_index+1];
+ pco_in_index += 2;
+ length_pi_or_ci = in_pco_p->byte[pco_in_index++];
+ switch (pi_or_ci) {
+ case PCO_PI_LCP:
+ case PCO_PI_PAP:
+ case PCO_PI_CHAP:
+ pco_in_index += length_pi_or_ci;
+ SPGW_APP_WARN("PCO: Protocol identifier 0x%X not supported now\n", pi_or_ci);
+ break;
+
+ case PCO_PI_IPCP:
+ ipcp_code = in_pco_p->byte[pco_in_index++];
+ ipcp_identifier = in_pco_p->byte[pco_in_index++];
+ ipcp_length = (((uint16_t)in_pco_p->byte[pco_in_index]) << 8) | ((uint16_t)in_pco_p->byte[pco_in_index+1]);
+ SPGW_APP_DEBUG("PCO: Protocol identifier IPCP (0x%x) code 0x%x identifier 0x%x length %u\n",
+ pi_or_ci, ipcp_code, ipcp_identifier, ipcp_length);
+ pco_in_index += 2;
+ ipcp_remaining_length = ipcp_length - 1 - 1 - 2;
+ ipcp_out_length = 1 + 1 + 2;
+
+ // Protocol Id: Internet Protocol Control Protocol ...
+ sgi_create_endpoint_resp.pco.byte[pco_out_index++] = (uint8_t)(pi_or_ci >> 8);
+ sgi_create_endpoint_resp.pco.byte[pco_out_index++] = (uint8_t)(pi_or_ci & 0x00FF);
+
+ while (ipcp_remaining_length >= 2) {
+ ipcp_option = in_pco_p->byte[pco_in_index];
+ ipcp_option_length = in_pco_p->byte[pco_in_index+1];
+ ipcp_remaining_length = ipcp_remaining_length - ipcp_option_length;
+ SPGW_APP_DEBUG("PCO: Protocol identifier IPCP ipcp_option %u ipcp_option_length %u ipcp_remaining_length %u pco_in_index %u\n",
+ ipcp_option, ipcp_option_length, ipcp_remaining_length, pco_in_index);
+
+ switch (ipcp_option) {
+ case IPCP_OPTION_PRIMARY_DNS_SERVER_IP_ADDRESS:
+ SPGW_APP_DEBUG("PCO: Protocol identifier IPCP option PRIMARY_DNS_SERVER_IP_ADDRESS length %u\n", ipcp_option_length);
+ if (ipcp_option_length >= 6) {
+ ipcp_dns_prim_ipv4_addr = (((uint32_t)in_pco_p->byte[pco_in_index+2]) << 24 ) |
+ (((uint32_t)in_pco_p->byte[pco_in_index+3]) << 16 ) |
+ (((uint32_t)in_pco_p->byte[pco_in_index+4]) << 8 ) |
+ (((uint32_t)in_pco_p->byte[pco_in_index+5]) );
+
+ SPGW_APP_DEBUG("PCO: Protocol identifier IPCP option SECONDARY_DNS_SERVER_IP_ADDRESS ipcp_dns_prim_ipv4_addr 0x%x\n", ipcp_dns_prim_ipv4_addr);
+ if ((ipcp_dns_prim_ipv4_addr == 0) ||
+ (spgw_config.pgw_config.ipv4.default_dns_v4 != ipcp_dns_prim_ipv4_addr)){
+ ipcp_out_code = IPCP_CODE_CONFIGURE_NACK;
+ ipcp_out_dns_prim_ipv4_addr = spgw_config.pgw_config.ipv4.default_dns_v4;
+ } else {
+ ipcp_out_dns_prim_ipv4_addr = ipcp_dns_prim_ipv4_addr;
+ }
+ SPGW_APP_DEBUG("PCO: Protocol identifier IPCP option SECONDARY_DNS_SERVER_IP_ADDRESS ipcp_out_dns_prim_ipv4_addr 0x%x\n", ipcp_out_dns_prim_ipv4_addr);
+ } else {
+ ipcp_out_code = IPCP_CODE_CONFIGURE_NACK;// not sure
+ }
+ ipcp_out_length += 6;
+ break;
+ case IPCP_OPTION_SECONDARY_DNS_SERVER_IP_ADDRESS:
+ SPGW_APP_DEBUG("PCO: Protocol identifier IPCP option SECONDARY_DNS_SERVER_IP_ADDRESS length %u\n", ipcp_option_length);
+ if (ipcp_option_length >= 6) {
+ ipcp_dns_sec_ipv4_addr = (((uint32_t)in_pco_p->byte[pco_in_index+2]) << 24 ) |
+ (((uint32_t)in_pco_p->byte[pco_in_index+3]) << 16 ) |
+ (((uint32_t)in_pco_p->byte[pco_in_index+4]) << 8 ) |
+ (((uint32_t)in_pco_p->byte[pco_in_index+5]) );
+ SPGW_APP_DEBUG("PCO: Protocol identifier IPCP option SECONDARY_DNS_SERVER_IP_ADDRESS ipcp_dns_sec_ipv4_addr 0x%x\n", ipcp_dns_sec_ipv4_addr);
+ if ((ipcp_dns_prim_ipv4_addr == 0) ||
+ (spgw_config.pgw_config.ipv4.default_dns_sec_v4 != ipcp_dns_sec_ipv4_addr)){
+ ipcp_out_code = IPCP_CODE_CONFIGURE_NACK;
+ ipcp_out_dns_sec_ipv4_addr = spgw_config.pgw_config.ipv4.default_dns_sec_v4;
+ } else {
+ ipcp_out_dns_sec_ipv4_addr = ipcp_dns_sec_ipv4_addr;
+ }
+ SPGW_APP_DEBUG("PCO: Protocol identifier IPCP option SECONDARY_DNS_SERVER_IP_ADDRESS ipcp_out_dns_sec_ipv4_addr 0x%x\n", ipcp_out_dns_sec_ipv4_addr);
+ } else {
+ ipcp_out_code = IPCP_CODE_CONFIGURE_NACK; // not sure
+ }
+ ipcp_out_length += 6;
+ break;
+ default:
+ SPGW_APP_WARN("PCO: Protocol identifier IPCP option 0x%04X unknown\n", ipcp_option);
+ }
+ pco_in_index += ipcp_option_length;
+ }
+ // ... continuing Protocol Id: Internet Protocol Control Protocol
+ sgi_create_endpoint_resp.pco.byte[pco_out_index++] = ipcp_out_length; // option length
+
+ break;
+
+ case PCO_CI_P_CSCF_IPV6_ADDRESS_REQUEST:
+ case PCO_CI_DNS_SERVER_IPV6_ADDRESS_REQUEST:
+ case PCO_CI_MS_SUPPORT_OF_NETWORK_REQUESTED_BEARER_CONTROL_INDICATOR:
+ case PCO_CI_DSMIPV6_HOME_AGENT_ADDRESS_REQUEST:
+ case PCO_CI_DSMIPV6_HOME_NETWORK_PREFIX_REQUEST:
+ case PCO_CI_DSMIPV6_IPV4_HOME_AGENT_ADDRESS_REQUEST:
+ case PCO_CI_P_CSCF_IPV4_ADDRESS_REQUEST:
+ case PCO_CI_MSISDN_REQUEST:
+ case PCO_CI_IFOM_SUPPORT_REQUEST:
+ pco_in_index += length_pi_or_ci;
+ SPGW_APP_WARN("PCO: Container identifier 0x%X not supported now\n", pi_or_ci);
+ break;
+
+ case PCO_CI_DNS_SERVER_IPV4_ADDRESS_REQUEST:
+ // PPP IP Control Protocol
+ sgi_create_endpoint_resp.pco.byte[pco_out_index++] = ipcp_out_code;
+ sgi_create_endpoint_resp.pco.byte[pco_out_index++] = ipcp_identifier;
+ sgi_create_endpoint_resp.pco.byte[pco_out_index++] = (uint8_t)(ipcp_out_length >> 8);
+ sgi_create_endpoint_resp.pco.byte[pco_out_index++] = (uint8_t)(ipcp_out_length & 0x00FF);
+
+ if (ipcp_out_dns_prim_ipv4_addr != 0xFFFFFFFF) {
+ sgi_create_endpoint_resp.pco.byte[pco_out_index++] = IPCP_OPTION_PRIMARY_DNS_SERVER_IP_ADDRESS;
+ sgi_create_endpoint_resp.pco.byte[pco_out_index++] = 6;
+ sgi_create_endpoint_resp.pco.byte[pco_out_index++] = (uint8_t)(ipcp_out_dns_prim_ipv4_addr & 0x000000FF);
+ sgi_create_endpoint_resp.pco.byte[pco_out_index++] = (uint8_t)((ipcp_out_dns_prim_ipv4_addr >> 8 ) & 0x000000FF);
+ sgi_create_endpoint_resp.pco.byte[pco_out_index++] = (uint8_t)((ipcp_out_dns_prim_ipv4_addr >> 16 ) & 0x000000FF);
+ sgi_create_endpoint_resp.pco.byte[pco_out_index++] = (uint8_t)((ipcp_out_dns_prim_ipv4_addr >> 24 ) & 0x000000FF);
+ }
+ if (ipcp_out_dns_sec_ipv4_addr != 0xFFFFFFFF) {
+ sgi_create_endpoint_resp.pco.byte[pco_out_index++] = IPCP_OPTION_SECONDARY_DNS_SERVER_IP_ADDRESS;
+ sgi_create_endpoint_resp.pco.byte[pco_out_index++] = 6;
+ sgi_create_endpoint_resp.pco.byte[pco_out_index++] = (uint8_t)(ipcp_out_dns_sec_ipv4_addr & 0x000000FF);
+ sgi_create_endpoint_resp.pco.byte[pco_out_index++] = (uint8_t)((ipcp_out_dns_sec_ipv4_addr >> 8 ) & 0x000000FF);
+ sgi_create_endpoint_resp.pco.byte[pco_out_index++] = (uint8_t)((ipcp_out_dns_sec_ipv4_addr >> 16 ) & 0x000000FF);
+ sgi_create_endpoint_resp.pco.byte[pco_out_index++] = (uint8_t)((ipcp_out_dns_sec_ipv4_addr >> 24 ) & 0x000000FF);
+ }
+ break;
+
+ case PCO_CI_IP_ADDRESS_ALLOCATION_VIA_NAS_SIGNALLING:
+ address_allocation_via_nas_signalling = TRUE;
+ break;
+
+ case PCO_CI_IPV4_ADDRESS_ALLOCATION_VIA_DHCPV4:
+ address_allocation_via_dhcpv4 = TRUE;
+ break;
+
+ case PCO_CI_IPV4_LINK_MTU_REQUEST:
+ SPGW_APP_WARN("PCO: Container identifier IPV4_LINK_MTU_REQUEST TODO\n");
+ break;
+ }
+ length_in_pco = length_in_pco - (length_pi_or_ci + 2 + 1);
+ SPGW_APP_DEBUG("PCO: Protocol identifier out length_in_pco %d\n", length_in_pco);
+ } // while (length_in_pco >= 3) {
+ } // if ((length_in_pco > 0) && (in_pco_p->byte[2] & 0x80)) {
+ sgi_create_endpoint_resp.pco.length = pco_out_index;
+ sgi_create_endpoint_resp.pco.byte[1] = pco_out_index - 2;
+ //--------------------------------------------------------------------------
+
+
// IP forward will forward packets to this teid
sgi_create_endpoint_resp.context_teid = endpoint_created_pP->context_teid;
sgi_create_endpoint_resp.sgw_S1u_teid = endpoint_created_pP->S1u_teid;
@@ -430,11 +618,15 @@ sgw_lite_handle_gtpv1uCreateTunnelResp(
break;
case IPv4:
- if (pgw_lite_get_free_ipv4_paa_address(&inaddr) == 0) {
- IN_ADDR_TO_BUFFER(inaddr, sgi_create_endpoint_resp.paa.ipv4_address);
- } else {
- SPGW_APP_ERROR("Failed to allocate IPv4 PAA for PDN type IPv4\n");
- }
+ if (address_allocation_via_nas_signalling == TRUE) {
+ if (pgw_lite_get_free_ipv4_paa_address(&inaddr) == 0) {
+ IN_ADDR_TO_BUFFER(inaddr, sgi_create_endpoint_resp.paa.ipv4_address);
+ } else {
+ SPGW_APP_ERROR("Failed to allocate IPv4 PAA for PDN type IPv4\n");
+ }
+ } /*else {
+ // TODO
+ }*/
break;
@@ -469,82 +661,7 @@ sgw_lite_handle_gtpv1uCreateTunnelResp(
sgi_create_endpoint_resp.status = SGI_STATUS_OK;
sgw_lite_handle_sgi_endpoint_created(&sgi_create_endpoint_resp);
-#else
- /* SEND IP_FW_CREATE_IP_ENDPOINT_REQUEST to FW_IP task */
- message_p = itti_alloc_new_message(TASK_SPGW_APP, SGI_CREATE_ENDPOINT_REQUEST);
-
- if (message_p == NULL) {
- return -1;
- }
-
- sgi_create_endpoint_req_p = &message_p->ittiMsg.sgiCreateEndpointReq;
- memset(sgi_create_endpoint_req_p, 0, sizeof(SGICreateEndpointReq));
- // IP forward will forward packets to this teid
- sgi_create_endpoint_req_p->context_teid = endpoint_created_pP->context_teid;
- sgi_create_endpoint_req_p->sgw_S1u_teid = endpoint_created_pP->S1u_teid;
- sgi_create_endpoint_req_p->eps_bearer_id = endpoint_created_pP->eps_bearer_id;
-
- // TO DO NOW
- sgi_create_endpoint_req_p->paa.pdn_type = new_bearer_ctxt_info_p->sgw_eps_bearer_context_information.saved_message.pdn_type;
-
- switch (sgi_create_endpoint_req_p->paa.pdn_type) {
- case IPv4_OR_v6:
- if (pgw_lite_get_free_ipv4_paa_address(&inaddr) == 0) {
- IN_ADDR_TO_BUFFER(inaddr, sgi_create_endpoint_req_p->paa.ipv4_address);
- } else {
- SPGW_APP_WARN("Failed to allocate IPv4 PAA for PDN type IPv4_OR_v6\n");
-
- if (pgw_lite_get_free_ipv6_paa_prefix(&in6addr) == 0) {
- IN6_ADDR_TO_BUFFER(in6addr, sgi_create_endpoint_req_p->paa.ipv6_address);
- } else {
- SPGW_APP_ERROR("Failed to allocate IPv6 PAA for PDN type IPv4_OR_v6\n");
- }
- }
-
- break;
-
- case IPv4:
- if (pgw_lite_get_free_ipv4_paa_address(&inaddr) == 0) {
- IN_ADDR_TO_BUFFER(inaddr, sgi_create_endpoint_req_p->paa.ipv4_address);
- } else {
- SPGW_APP_ERROR("Failed to allocate IPv4 PAA for PDN type IPv4\n");
- }
-
- break;
-
- case IPv6:
- if (pgw_lite_get_free_ipv6_paa_prefix(&in6addr) == 0) {
- IN6_ADDR_TO_BUFFER(in6addr, sgi_create_endpoint_req_p->paa.ipv6_address);
- } else {
- SPGW_APP_ERROR("Failed to allocate IPv6 PAA for PDN type IPv6\n");
- }
-
- break;
-
- case IPv4_AND_v6:
- if (pgw_lite_get_free_ipv4_paa_address(&inaddr) == 0) {
- IN_ADDR_TO_BUFFER(inaddr, sgi_create_endpoint_req_p->paa.ipv4_address);
- } else {
- SPGW_APP_ERROR("Failed to allocate IPv4 PAA for PDN type IPv4_AND_v6\n");
- }
-
- if (pgw_lite_get_free_ipv6_paa_prefix(&in6addr) == 0) {
- IN6_ADDR_TO_BUFFER(in6addr, sgi_create_endpoint_req_p->paa.ipv6_address);
- } else {
- SPGW_APP_ERROR("Failed to allocate IPv6 PAA for PDN type IPv4_AND_v6\n");
- }
-
- break;
-
- default:
- AssertFatal(0,"BAD paa.pdn_type %d", sgi_create_endpoint_req_p->paa.pdn_type);
- break;
- }
-
- // TO DO TFT, QOS
- return itti_send_msg_to_task(TASK_FW_IP, INSTANCE_DEFAULT, message_p);
-#endif
- } else {
+ } else { // if (hash_rc == HASH_TABLE_OK) {
SPGW_APP_DEBUG("Rx SGW_S1U_ENDPOINT_CREATED, Context: teid %u NOT FOUND\n", endpoint_created_pP->context_teid);
message_p = itti_alloc_new_message(TASK_SPGW_APP, SGW_CREATE_SESSION_RESPONSE);
@@ -683,11 +800,9 @@ sgw_lite_handle_sgi_endpoint_updated(
sgw_eps_bearer_entry_t *eps_bearer_entry_p = NULL;
hashtable_rc_t hash_rc;
task_id_t to_task;
-#if defined (ENABLE_USE_GTPU_IN_KERNEL)
static uint8_t iptable_uplink_remove_gtpu = FALSE;
char cmd[256];
int ret;
-#endif
#if defined(ENABLE_STANDALONE_EPC)
to_task = TASK_MME_APP;
@@ -749,7 +864,6 @@ sgw_lite_handle_sgi_endpoint_updated(
modify_response_p->bearer_choice.bearer_contexts_modified.cause = REQUEST_ACCEPTED;
modify_response_p->cause = REQUEST_ACCEPTED;
modify_response_p->trxn = new_bearer_ctxt_info_p->sgw_eps_bearer_context_information.trxn;
-#if defined (ENABLE_USE_GTPU_IN_KERNEL)
// if default bearer
#warning "TODO define constant for default eps_bearer id"
@@ -757,7 +871,7 @@ sgw_lite_handle_sgi_endpoint_updated(
if (resp_pP->eps_bearer_id == 5) {
ret = snprintf(cmd,
256, // mangle -I
- "iptables -t mangle -A %s -d %u.%u.%u.%u -m mark --mark 0 -j GTPUAH --own-ip %u.%u.%u.%u --own-tun %u --peer-ip %u.%u.%u.%u --peer-tun %u --action add",
+ "iptables -t mangle -A %s -d %u.%u.%u.%u -m mark --mark 0 -j GTPUSP --own-ip %u.%u.%u.%u --own-tun %u --peer-ip %u.%u.%u.%u --peer-tun %u --action add",
(spgw_config.sgw_config.local_to_eNB) ? "FORWARD":"FORWARD", // test
eps_bearer_entry_p->paa.ipv4_address[0],
eps_bearer_entry_p->paa.ipv4_address[1],
@@ -788,7 +902,7 @@ sgw_lite_handle_sgi_endpoint_updated(
//-------------------------
ret = snprintf(cmd,
256,
- "iptables -t mangle -I %s -d %u.%u.%u.%u -m mark --mark %u -j GTPUAH --own-ip %u.%u.%u.%u --own-tun %u --peer-ip %u.%u.%u.%u --peer-tun %u --action add",
+ "iptables -t mangle -I %s -d %u.%u.%u.%u -m mark --mark %u -j GTPUSP --own-ip %u.%u.%u.%u --own-tun %u --peer-ip %u.%u.%u.%u --peer-tun %u --action add",
(spgw_config.sgw_config.local_to_eNB) ? "FORWARD":"FORWARD", // test
eps_bearer_entry_p->paa.ipv4_address[0],
eps_bearer_entry_p->paa.ipv4_address[1],
@@ -819,7 +933,6 @@ sgw_lite_handle_sgi_endpoint_updated(
SPGW_APP_ERROR("ERROR in setting up downlink TUNNEL\n");
}
-#endif
}
MSC_LOG_TX_MESSAGE(
MSC_SP_GWAPP_MME,
@@ -928,7 +1041,6 @@ sgw_lite_handle_modify_bearer_request(
FTEID_T_2_IP_ADDRESS_T( (&modify_bearer_pP->bearer_context_to_modify.s1_eNB_fteid) , (&eps_bearer_entry_p->enb_ip_address_for_S1u) );
eps_bearer_entry_p->enb_teid_for_S1u = modify_bearer_pP->bearer_context_to_modify.s1_eNB_fteid.teid;
-#if defined (ENABLE_USE_GTPU_IN_KERNEL)
{
SGIUpdateEndpointResp sgi_update_end_point_resp;
sgi_update_end_point_resp.context_teid = modify_bearer_pP->teid;
@@ -938,29 +1050,6 @@ sgw_lite_handle_modify_bearer_request(
sgi_update_end_point_resp.status = 0x00;
sgw_lite_handle_sgi_endpoint_updated(&sgi_update_end_point_resp);
}
-#else
- // UPDATE GTPV1U mapping tables with eNB references (teid, addresses)
- message_p = itti_alloc_new_message(TASK_SPGW_APP, GTPV1U_UPDATE_TUNNEL_REQ);
-
- if (message_p == NULL) {
- return -1;
- }
-
- gtpv1u_update_tunnel_req_p = &message_p->ittiMsg.gtpv1uUpdateTunnelReq;
- memset(gtpv1u_update_tunnel_req_p, 0, sizeof(Gtpv1uUpdateTunnelReq));
- gtpv1u_update_tunnel_req_p->context_teid = modify_bearer_pP->teid;
- gtpv1u_update_tunnel_req_p->sgw_S1u_teid = eps_bearer_entry_p->s_gw_teid_for_S1u_S12_S4_up; ///< SGW S1U local Tunnel Endpoint Identifier
- gtpv1u_update_tunnel_req_p->enb_S1u_teid = eps_bearer_entry_p->enb_teid_for_S1u; ///< eNB S1U Tunnel Endpoint Identifier
- gtpv1u_update_tunnel_req_p->enb_ip_address_for_S1u = eps_bearer_entry_p->enb_ip_address_for_S1u;
- gtpv1u_update_tunnel_req_p->eps_bearer_id = eps_bearer_entry_p->eps_bearer_id;
- SPGW_APP_DEBUG("Rx MODIFY_BEARER_REQUEST, gtpv1u_update_tunnel_req_p->context_teid = %u\n",modify_bearer_pP->teid);
- SPGW_APP_DEBUG("Rx MODIFY_BEARER_REQUEST, gtpv1u_update_tunnel_req_p->sgw_S1u_teid = %u\n",gtpv1u_update_tunnel_req_p->sgw_S1u_teid);
- SPGW_APP_DEBUG("Rx MODIFY_BEARER_REQUEST, gtpv1u_update_tunnel_req_p->enb_S1u_teid = %u\n",gtpv1u_update_tunnel_req_p->enb_S1u_teid);
- //SPGW_APP_DEBUG("Rx MODIFY_BEARER_REQUEST, gtpv1u_update_tunnel_req_p->enb_ip_address_for_S1u = %u\n",modify_bearer_pP->enb_ip_address_for_S1u);
- SPGW_APP_DEBUG("Rx MODIFY_BEARER_REQUEST, gtpv1u_update_tunnel_req_p->eps_bearer_id = %u\n",gtpv1u_update_tunnel_req_p->eps_bearer_id);
-
- return itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p);
-#endif
}
} else {
message_p = itti_alloc_new_message(TASK_SPGW_APP, SGW_MODIFY_BEARER_RESPONSE);
diff --git a/openair-cn/SGW-LITE/sgw_lite_ie_defs.h b/openair-cn/SGW-LITE/sgw_lite_ie_defs.h
index 7e95a58398..68683272fb 100644
--- a/openair-cn/SGW-LITE/sgw_lite_ie_defs.h
+++ b/openair-cn/SGW-LITE/sgw_lite_ie_defs.h
@@ -99,6 +99,66 @@ typedef struct {
uint8_t ipv6_prefix_length;
} PAA_t;
+/* Protocol configuration options from ts124008*/
+#define PCO_MIN_LENGTH 3
+#define PCO_MAX_LENGTH 253
+#define PCO_CONFIGURATION_PROTOCOL_PPP_FOR_USE_WITH_IP_PDP_TYPE_OR_IP_PDN_TYPE 000b
+
+#define PCO_PI_LCP (0xC021)
+#define PCO_PI_PAP (0xC023)
+#define PCO_PI_CHAP (0xC223)
+#define PCO_PI_IPCP (0x8021)
+
+#define IPCP_CODE_CONFIGURE_REQUEST (0x01)
+#define IPCP_CODE_CONFIGURE_ACK (0x02)
+#define IPCP_CODE_CONFIGURE_NACK (0x03)
+#define IPCP_CODE_CONFIGURE_REJECT (0x04)
+#define IPCP_CODE_TERMINATE_REQUEST (0x05)
+#define IPCP_CODE_TERMINATE_ACK (0x06)
+#define IPCP_CODE_REJECT (0x07)
+
+#define IPCP_OPTION_PRIMARY_DNS_SERVER_IP_ADDRESS (0x81)
+#define IPCP_OPTION_SECONDARY_DNS_SERVER_IP_ADDRESS (0x83)
+
+/* CONTAINER IDENTIFIER MS to network direction:*/
+#define PCO_CI_P_CSCF_IPV6_ADDRESS_REQUEST (0x0001)
+#define PCO_CI_DNS_SERVER_IPV6_ADDRESS_REQUEST (0x0003)
+#define PCO_CI_MS_SUPPORT_OF_NETWORK_REQUESTED_BEARER_CONTROL_INDICATOR (0x0005)
+#define PCO_CI_DSMIPV6_HOME_AGENT_ADDRESS_REQUEST (0x0007)
+#define PCO_CI_DSMIPV6_HOME_NETWORK_PREFIX_REQUEST (0x0008)
+#define PCO_CI_DSMIPV6_IPV4_HOME_AGENT_ADDRESS_REQUEST (0x0009)
+#define PCO_CI_IP_ADDRESS_ALLOCATION_VIA_NAS_SIGNALLING (0x000A)
+#define PCO_CI_IPV4_ADDRESS_ALLOCATION_VIA_DHCPV4 (0x000B)
+#define PCO_CI_P_CSCF_IPV4_ADDRESS_REQUEST (0x000C)
+#define PCO_CI_DNS_SERVER_IPV4_ADDRESS_REQUEST (0x000D)
+#define PCO_CI_MSISDN_REQUEST (0x000E)
+#define PCO_CI_IFOM_SUPPORT_REQUEST (0x000F)
+#define PCO_CI_IPV4_LINK_MTU_REQUEST (0x0010)
+
+/* CONTAINER IDENTIFIER Network to MS direction:*/
+#define PCO_CI_P_CSCF_IPV6_ADDRESS (0x0001)
+#define PCO_CI_IM_CN_SUBSYSTEM_SIGNALING_FLAG (0x0002)
+#define PCO_CI_DNS_SERVER_IPV6_ADDRESS (0x0003)
+#define PCO_CI_POLICY_CONTROL_REJECTION_CODE (0x0004)
+#define PCO_CI_SELECTED_BEARER_CONTROL_MODE (0x0005)
+#define PCO_CI_DSMIPV6_HOME_AGENT_ADDRESS (0x0007)
+#define PCO_CI_DSMIPV6_HOME_NETWORK_PREFIX (0x0008)
+#define PCO_CI_DSMIPV6_IPV4_HOME_AGENT_ADDRESS (0x0009)
+#define PCO_CI_P_CSCF_IPV4_ADDRESS (0x000C)
+#define PCO_CI_DNS_SERVER_IPV4_ADDRESS (0x000D)
+#define PCO_CI_MSISDN (0x000E)
+#define PCO_CI_IFOM_SUPPORT (0x000F)
+#define PCO_CI_IPV4_LINK_MTU (0x0010)
+
+/* Both directions:*/
+#define PCO_CI_IM_CN_SUBSYSTEM_SIGNALING_FLAG (0x0002)
+
+typedef struct pco_flat_s{
+ uint8_t byte[PCO_MAX_LENGTH];
+ uint8_t length;
+} pco_flat_t;
+
+
#define IMSI(imsi) \
(imsi)->digit[0], \
(imsi)->digit[1], \
diff --git a/openair-cn/SGW-LITE/sgw_lite_task.c b/openair-cn/SGW-LITE/sgw_lite_task.c
index 9d5698b4b6..27f5836bb4 100644
--- a/openair-cn/SGW-LITE/sgw_lite_task.c
+++ b/openair-cn/SGW-LITE/sgw_lite_task.c
@@ -49,6 +49,7 @@
#include "hashtable.h"
#include "spgw_config.h"
#include "pgw_lite_paa.h"
+#include "msc.h"
spgw_config_t spgw_config;
sgw_app_t sgw_app;
@@ -57,6 +58,7 @@ pgw_app_t pgw_app;
static void *sgw_lite_intertask_interface(void *args_p)
{
itti_mark_task_ready(TASK_SPGW_APP);
+ MSC_START_USE();
while(1) {
MessageDef *received_message_p;
@@ -137,7 +139,6 @@ static void *sgw_lite_intertask_interface(void *args_p)
int sgw_lite_init(char* config_file_name_pP)
{
SPGW_APP_DEBUG("Initializing SPGW-APP task interface\n");
-#if defined (ENABLE_USE_GTPU_IN_KERNEL)
spgw_system("modprobe ip_tables", SPGW_ABORT_ON_ERROR, __FILE__, __LINE__);
spgw_system("modprobe x_tables", SPGW_ABORT_ON_ERROR, __FILE__, __LINE__);
spgw_system("iptables -P INPUT ACCEPT", SPGW_WARN_ON_ERROR, __FILE__, __LINE__);
@@ -180,7 +181,7 @@ int sgw_lite_init(char* config_file_name_pP)
spgw_system("sysctl -w net.ipv4.conf.all.route_localnet=1",SPGW_WARN_ON_ERROR, __FILE__, __LINE__);
spgw_system("sysctl -w net.ipv4.conf.all.rp_filter=0",SPGW_WARN_ON_ERROR, __FILE__, __LINE__);
spgw_system("sync", SPGW_ABORT_ON_ERROR, __FILE__, __LINE__);
-#endif
+
spgw_config_init(config_file_name_pP, &spgw_config);
pgw_lite_load_pool_ip_addresses();
diff --git a/openair-cn/SGW-LITE/spgw_config.c b/openair-cn/SGW-LITE/spgw_config.c
index 7a4b896e21..6a490e772d 100755
--- a/openair-cn/SGW-LITE/spgw_config.c
+++ b/openair-cn/SGW-LITE/spgw_config.c
@@ -170,12 +170,12 @@ int spgw_config_process(spgw_config_t* config_pP)
config_pP->sgw_config.local_to_eNB = FALSE;
if (snprintf(system_cmd, 256,
- "insmod $OPENAIR_TARGETS/bin/xt_GTPUAH.ko gtpu_enb_port=2152 gtpu_sgw_port=%u sgw_addr=\"%s\" ",
+ "insmod $OPENAIR_TARGETS/bin/xt_GTPUSP.ko gtpu_enb_port=2152 gtpu_sgw_port=%u sgw_addr=\"%s\" ",
config_pP->sgw_config.sgw_udp_port_for_S1u_S12_S4_up,
inet_ntoa(inaddr)) > 0) {
ret += spgw_system(system_cmd, SPGW_WARN_ON_ERROR, __FILE__, __LINE__);
} else {
- SPGW_APP_ERROR("GTPUAH kernel module\n");
+ SPGW_APP_ERROR("GTPUSP kernel module\n");
ret = -1;
}
}
@@ -201,20 +201,18 @@ int spgw_config_process(spgw_config_t* config_pP)
}
if (snprintf(system_cmd, 256,
- "insmod $OPENAIR_TARGETS/bin/xt_GTPUAH.ko gtpu_enb_port=2153 gtpu_sgw_port=%u sgw_addr=\"%s\" ",
+ "insmod $OPENAIR_TARGETS/bin/xt_GTPUSP.ko gtpu_enb_port=2153 gtpu_sgw_port=%u sgw_addr=\"%s\" ",
config_pP->sgw_config.sgw_udp_port_for_S1u_S12_S4_up,
inet_ntoa(inaddr)) > 0) {
ret += spgw_system(system_cmd, SPGW_WARN_ON_ERROR, __FILE__, __LINE__);
} else {
- SPGW_APP_ERROR("GTPUAH kernel module\n");
+ SPGW_APP_ERROR("GTPUSP kernel module\n");
ret = -1;
}
}
-#if defined (ENABLE_USE_GTPU_IN_KERNEL)
ret += spgw_system("echo 0 > /proc/sys/net/ipv4/conf/all/send_redirects", SPGW_ABORT_ON_ERROR, __FILE__, __LINE__);
-#endif
if (snprintf(system_cmd, 256,
@@ -367,26 +365,6 @@ int spgw_config_init(char* lib_config_file_name_pP, spgw_config_t* config_pP)
}
}
-
- if( (
- config_setting_lookup_string( setting_sgw, SGW_CONFIG_STRING_SGW_DROP_UPLINK_S1U_TRAFFIC,
- (const char **)&sgw_drop_uplink_s1u_traffic)
- && config_setting_lookup_string( setting_sgw, SGW_CONFIG_STRING_SGW_DROP_DOWNLINK_S1U_TRAFFIC,
- (const char **)&sgw_drop_downlink_s1u_traffic)
- )
- ) {
- if (strcasecmp(sgw_drop_uplink_s1u_traffic, "yes") == 0) {
- config_pP->sgw_config.sgw_drop_uplink_traffic=1;
- } else {
- config_pP->sgw_config.sgw_drop_uplink_traffic=0;
- }
-
- if (strcasecmp(sgw_drop_downlink_s1u_traffic, "yes") == 0) {
- config_pP->sgw_config.sgw_drop_downlink_traffic=1;
- } else {
- config_pP->sgw_config.sgw_drop_downlink_traffic=0;
- }
- }
}
setting_pgw = config_lookup(&cfg, PGW_CONFIG_STRING_PGW_CONFIG);
@@ -477,7 +455,7 @@ int spgw_config_init(char* lib_config_file_name_pP, spgw_config_t* config_pP)
// valid address
atoken2 = strtok(NULL, PGW_CONFIG_STRING_IPV4_PREFIX_DELIMITER);
prefix_mask = atoi(atoken2);
-#if defined (ENABLE_USE_GTPU_IN_KERNEL)
+
in_addr_var.s_addr = config_pP->sgw_config.ipv4.sgw_ipv4_address_for_S1u_S12_S4_up;
if (snprintf(system_cmd, 256,
@@ -489,7 +467,7 @@ int spgw_config_init(char* lib_config_file_name_pP, spgw_config_t* config_pP)
}
if (snprintf(system_cmd, 256,
- "iptables -I OUTPUT -t mangle -m mark -s %s/%s ! --mark 0 -j CONNMARK --save-mark",
+ "iptables -I OUTPUT -t mangle -s %s/%s -m mark ! --mark 0 -j CONNMARK --save-mark",
astring, atoken2) > 0) {
spgw_system(system_cmd, SPGW_ABORT_ON_ERROR, __FILE__, __LINE__);
} else {
@@ -503,7 +481,6 @@ int spgw_config_init(char* lib_config_file_name_pP, spgw_config_t* config_pP)
SPGW_APP_ERROR("Route for UEs\n");
}
-#endif
if ((prefix_mask >= 2)&&(prefix_mask < 32)) {
memcpy (&addr_start, buf_in_addr, sizeof(struct in_addr));
@@ -599,15 +576,19 @@ int spgw_config_init(char* lib_config_file_name_pP, spgw_config_t* config_pP)
}
if(
- config_setting_lookup_string(subsetting,
+ config_setting_lookup_string(setting_pgw,
PGW_CONFIG_STRING_DEFAULT_DNS_IPV4_ADDRESS,
(const char **)&pgw_default_dns_ipv4_address)
- && config_setting_lookup_string(subsetting,
+ && config_setting_lookup_string(setting_pgw,
PGW_CONFIG_STRING_DEFAULT_DNS_SEC_IPV4_ADDRESS,
(const char **)&pgw_default_dns_sec_ipv4_address)) {
config_pP->pgw_config.ipv4.pgw_interface_name_for_S5_S8 = strdup(pgw_interface_name_for_S5_S8);
IPV4_STR_ADDR_TO_INT_NWBO ( pgw_default_dns_ipv4_address, config_pP->pgw_config.ipv4.default_dns_v4, "BAD IPv4 ADDRESS FORMAT FOR DEFAULT DNS !\n" )
IPV4_STR_ADDR_TO_INT_NWBO ( pgw_default_dns_sec_ipv4_address, config_pP->pgw_config.ipv4.default_dns_sec_v4, "BAD IPv4 ADDRESS FORMAT FOR DEFAULT DNS SEC!\n" )
+ SPGW_APP_INFO("Parsing configuration file default primary DNS IPv4 address: %x\n",
+ config_pP->pgw_config.ipv4.default_dns_v4);
+ SPGW_APP_INFO("Parsing configuration file default secondary DNS IPv4 address: %x\n",
+ config_pP->pgw_config.ipv4.default_dns_sec_v4);
} else {
SPGW_APP_WARN("NO DNS CONFIGURATION FOUND\n");
}
diff --git a/openair-cn/SGW-LITE/spgw_config.h b/openair-cn/SGW-LITE/spgw_config.h
index 3c2f5a13df..5a201e4482 100755
--- a/openair-cn/SGW-LITE/spgw_config.h
+++ b/openair-cn/SGW-LITE/spgw_config.h
@@ -50,8 +50,6 @@
#define SGW_CONFIG_STRING_SGW_IPV4_ADDRESS_FOR_S5_S8_UP "SGW_IPV4_ADDRESS_FOR_S5_S8_UP"
#define SGW_CONFIG_STRING_SGW_INTERFACE_NAME_FOR_S11 "SGW_INTERFACE_NAME_FOR_S11"
#define SGW_CONFIG_STRING_SGW_IPV4_ADDRESS_FOR_S11 "SGW_IPV4_ADDRESS_FOR_S11"
-#define SGW_CONFIG_STRING_SGW_DROP_UPLINK_S1U_TRAFFIC "SGW_DROP_UPLINK_S1U_TRAFFIC"
-#define SGW_CONFIG_STRING_SGW_DROP_DOWNLINK_S1U_TRAFFIC "SGW_DROP_DOWNLINK_S1U_TRAFFIC"
#define PGW_CONFIG_STRING_PGW_CONFIG "P-GW"
#define PGW_CONFIG_STRING_NETWORK_INTERFACES_CONFIG "NETWORK_INTERFACES"
diff --git a/openair-cn/TEST/mme_test_s1_generate_scenario_from_pcap b/openair-cn/TEST/mme_test_s1_generate_scenario_from_pcap
new file mode 100755
index 0000000000..247814f553
--- /dev/null
+++ b/openair-cn/TEST/mme_test_s1_generate_scenario_from_pcap
@@ -0,0 +1,76 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+import sys
+import subprocess
+import re
+import socket
+import datetime
+from datetime import date
+import os, errno
+import argparse
+import tempfile
+from xml.dom.minidom import parse, parseString
+#from xml.etree.ElementTree import ElementTree
+
+#####################
+# program arguments
+#####################
+parser = argparse.ArgumentParser()
+parser.add_argument("--pcap_file", "-p", type=str,help="input pcap file to be translated")
+args = parser.parse_args()
+
+#####################
+# get xml document from pcap
+#####################
+orig_pcap_file_name = args.pcap_file.strip()
+orig_pdml_string = subprocess.check_output(["tshark", '-T', 'pdml', '-r', orig_pcap_file_name])
+
+orig_dom = parseString(orig_pdml_string)
+#orig_etree = ElementTree()
+#orig_etree.parse(orig_pcap_pdml_file.name)
+
+#####################
+# filtering unwanted packets
+#####################
+#cases = orig_etree.findall(".//proto[@name='sctp']")
+packets = orig_dom.getElementsByTagName("packet")
+for packet in packets:
+ found_sctp = False
+ found_s1ap = False
+ protos = packet.getElementsByTagName("proto")
+ for proto in protos:
+ attrs = proto.attributes
+ urlnode = attrs['name']
+ if urlnode.nodeValue == 'sctp':
+ found_sctp = True
+ elif urlnode.nodeValue == 's1ap':
+ found_s1ap = True
+ elif urlnode.nodeValue == 'geninfo':
+ packet.removeChild(proto)
+ elif urlnode.nodeValue == 'eth':
+ packet.removeChild(proto)
+ if found_s1ap == False:
+ # hopefully it seems to work (remove iterated packet)
+ packet.parentNode.removeChild(packet)
+
+#####################
+# dom to xml string
+#####################
+filtered_pdml_string = orig_dom.toxml()
+cleaned_pdml_string = ""
+#####################
+# remove blank lines in xml string
+#####################
+lines = filtered_pdml_string.splitlines()
+for line in lines:
+ if line[:-1]:
+ cleaned_pdml_string += line + '\r\n'
+#print "'%s'" % cleaned_pdml_string
+#####################
+# write xml string to pdml file
+#####################
+out_pdml_file_name = os.path.dirname(orig_pcap_file_name) + os.path.splitext(os.path.basename(orig_pcap_file_name))[0] + '.pdml'
+out_file = open(out_pdml_file_name, "w")
+out_file.write(cleaned_pdml_string)
+out_file.close()
+
diff --git a/openair-cn/TEST/oaisim_mme_test_s1c.c b/openair-cn/TEST/oaisim_mme_test_s1c.c
index ff271eebaf..0f1d1e6428 100644
--- a/openair-cn/TEST/oaisim_mme_test_s1c.c
+++ b/openair-cn/TEST/oaisim_mme_test_s1c.c
@@ -61,13 +61,19 @@
static void get_options (int argc, char **argv);
static uint32_t eNB_app_register(const uint32_t enb_id_start, const uint32_t enb_id_end, const Enb_properties_array_t *enb_properties);
static void *eNB_app_task (void *args_p);
-static void mme_test_s1_start_test(instance_t instance);
+void mme_test_s1_start_test(instance_t instance);
//------------------------------------------------------------------------------
static char *conf_config_file_name = NULL;
static char *itti_dump_file = NULL;
const Enb_properties_array_t *enb_properties = NULL;
int16_t glog_level = LOG_INFO;
int16_t glog_verbosity = LOG_MED;
+s1c_test_t s1c_test = {
+ 0, // scenario_index
+ 0, // tx_next_message_index
+ 0, // rx_next_message_index
+ 0 // assoc_id
+ };
//------------------------------------------------------------------------------
static void get_options (int argc, char **argv)
@@ -116,7 +122,7 @@ static uint32_t eNB_app_register(const uint32_t enb_id_start, const uint32_t enb
char *str = NULL;
struct in_addr addr;
-
+ // 1 eNB should be max.
// 1 eNB should be max.
for (enb_id = enb_id_start; (enb_id < enb_id_end) ; enb_id++) {
{
@@ -228,7 +234,7 @@ static void *eNB_app_task(void *args_p)
/* Check if all register eNB requests have been processed */
if (register_enb_pending == 0) {
if (registered_enb == enb_nb) {
- mme_test_s1_start_test();
+ mme_test_s1_start_test(instance);
} else {
@@ -288,10 +294,10 @@ void mme_test_s1_start_test(instance_t instance)
//------------------------------------------------------------------------------
{
s1ap_eNB_itti_send_sctp_data_req(instance,
- int32_t assoc_id,
- s1ap_scenario1[scenario_message_index].buffer,
- s1ap_scenario1[scenario_message_index].buf_len,
- s1ap_scenario1[scenario_message_index].sctp_stream_id);
+ s1c_test.assoc_id,
+ s1ap_scenarios[s1c_test.scenario_index][s1c_test.tx_next_message_index].buffer,
+ s1ap_scenarios[s1c_test.scenario_index][s1c_test.tx_next_message_index].buf_len,
+ s1ap_scenarios[s1c_test.scenario_index][s1c_test.tx_next_message_index].sctp_stream_id);
}
@@ -302,6 +308,7 @@ void mme_test_s1_notify_sctp_data_ind(uint32_t assoc_id, int32_t stream, const u
}
+
//------------------------------------------------------------------------------
int main( int argc, char **argv )
//------------------------------------------------------------------------------
diff --git a/openair-cn/TEST/oaisim_mme_test_s1c.h b/openair-cn/TEST/oaisim_mme_test_s1c.h
index 107a7a6d7d..af59dd1a23 100644
--- a/openair-cn/TEST/oaisim_mme_test_s1c.h
+++ b/openair-cn/TEST/oaisim_mme_test_s1c.h
@@ -28,4 +28,12 @@
*******************************************************************************/
+typedef struct s1c_test_s {
+ int scenario_index;
+ int tx_next_message_index;
+ int rx_next_message_index;
+ int32_t assoc_id;
+}s1c_test_t;
+
+void mme_test_s1_start_test(instance_t instance);
void mme_test_s1_notify_sctp_data_ind(uint32_t assoc_id, int32_t stream, const uint8_t * const data, const uint32_t data_length);
diff --git a/openair-cn/TEST/oaisim_mme_test_s1c_s1ap.c b/openair-cn/TEST/oaisim_mme_test_s1c_s1ap.c
new file mode 100755
index 0000000000..a46c8fa6b4
--- /dev/null
+++ b/openair-cn/TEST/oaisim_mme_test_s1c_s1ap.c
@@ -0,0 +1,337 @@
+/*******************************************************************************
+ 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, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
+
+*******************************************************************************/
+#define _GNU_SOURCE
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+
+#include "tree.h"
+#include "queue.h"
+#include "intertask_interface.h"
+#include "s1ap_eNB_default_values.h"
+#include "s1ap_common.h"
+#include "s1ap_ies_defs.h"
+#include "s1ap_eNB_defs.h"
+#include "s1ap_eNB_management_procedures.h"
+#include "assertions.h"
+
+#include "platform_types.h"
+#include "oaisim_mme_test_s1c.h"
+
+
+void s1ap_eNB_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind)
+{
+ int result;
+
+ DevAssert(sctp_data_ind != NULL);
+ mme_test_s1_notify_sctp_data_ind(sctp_data_ind->assoc_id, sctp_data_ind->stream,
+ sctp_data_ind->buffer, sctp_data_ind->buffer_length);
+
+ result = itti_free(TASK_UNKNOWN, sctp_data_ind->buffer);
+ AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
+}
+
+
+void s1ap_eNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer,
+ uint32_t buffer_length, uint16_t stream)
+{
+ MessageDef *message_p;
+ sctp_data_req_t *sctp_data_req;
+
+ message_p = itti_alloc_new_message(TASK_S1AP, SCTP_DATA_REQ);
+
+ sctp_data_req = &message_p->ittiMsg.sctp_data_req;
+
+ sctp_data_req->assoc_id = assoc_id;
+ sctp_data_req->buffer = buffer;
+ sctp_data_req->buffer_length = buffer_length;
+ sctp_data_req->stream = stream;
+
+ itti_send_msg_to_task(TASK_SCTP, instance, message_p);
+}
+
+void s1ap_handle_s1_setup_message(s1ap_eNB_mme_data_t *mme_desc_p, int sctp_shutdown)
+{
+ if (sctp_shutdown) {
+ /* A previously connected MME has been shutdown */
+
+ /* TODO check if it was used by some eNB and send a message to inform these eNB if there is no more associated MME */
+ if (mme_desc_p->state == S1AP_ENB_STATE_CONNECTED) {
+ mme_desc_p->state = S1AP_ENB_STATE_DISCONNECTED;
+
+ if (mme_desc_p->s1ap_eNB_instance->s1ap_mme_associated_nb > 0) {
+ /* Decrease associated MME number */
+ mme_desc_p->s1ap_eNB_instance->s1ap_mme_associated_nb --;
+ }
+
+ /* If there are no more associated MME, inform eNB app */
+ if (mme_desc_p->s1ap_eNB_instance->s1ap_mme_associated_nb == 0) {
+ MessageDef *message_p;
+
+ message_p = itti_alloc_new_message(TASK_S1AP, S1AP_DEREGISTERED_ENB_IND);
+ S1AP_DEREGISTERED_ENB_IND(message_p).nb_mme = 0;
+ itti_send_msg_to_task(TASK_ENB_APP, mme_desc_p->s1ap_eNB_instance->instance, message_p);
+ }
+ }
+ } else {
+ /* Check that at least one setup message is pending */
+ DevCheck(mme_desc_p->s1ap_eNB_instance->s1ap_mme_pending_nb > 0, mme_desc_p->s1ap_eNB_instance->instance,
+ mme_desc_p->s1ap_eNB_instance->s1ap_mme_pending_nb, 0);
+
+ if (mme_desc_p->s1ap_eNB_instance->s1ap_mme_pending_nb > 0) {
+ /* Decrease pending messages number */
+ mme_desc_p->s1ap_eNB_instance->s1ap_mme_pending_nb --;
+ }
+
+ /* If there are no more pending messages, inform eNB app */
+ if (mme_desc_p->s1ap_eNB_instance->s1ap_mme_pending_nb == 0) {
+ MessageDef *message_p;
+
+ message_p = itti_alloc_new_message(TASK_S1AP, S1AP_REGISTER_ENB_CNF);
+ S1AP_REGISTER_ENB_CNF(message_p).nb_mme = mme_desc_p->s1ap_eNB_instance->s1ap_mme_associated_nb;
+ itti_send_msg_to_task(TASK_ENB_APP, mme_desc_p->s1ap_eNB_instance->instance, message_p);
+ }
+ }
+}
+
+void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp)
+{
+ s1ap_eNB_instance_t *instance_p;
+ s1ap_eNB_mme_data_t *s1ap_mme_data_p;
+
+ DevAssert(sctp_new_association_resp != NULL);
+
+ instance_p = s1ap_eNB_get_instance(instance);
+ DevAssert(instance_p != NULL);
+
+ s1ap_mme_data_p = s1ap_eNB_get_MME(instance_p, -1,
+ sctp_new_association_resp->ulp_cnx_id);
+ DevAssert(s1ap_mme_data_p != NULL);
+
+ if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) {
+ S1AP_WARN("Received unsuccessful result for SCTP association (%u), instance %d, cnx_id %u\n",
+ sctp_new_association_resp->sctp_state,
+ instance,
+ sctp_new_association_resp->ulp_cnx_id);
+
+ s1ap_handle_s1_setup_message(s1ap_mme_data_p, sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN);
+
+ return;
+ }
+
+ /* Update parameters */
+ s1ap_mme_data_p->assoc_id = sctp_new_association_resp->assoc_id;
+ s1ap_mme_data_p->in_streams = sctp_new_association_resp->in_streams;
+ s1ap_mme_data_p->out_streams = sctp_new_association_resp->out_streams;
+
+ /* Prepare new S1 Setup Request */
+ mme_test_s1_start_test(instance_p, s1ap_mme_data_p);
+}
+
+void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p,
+ net_ip_address_t *mme_ip_address,
+ net_ip_address_t *local_ip_addr)
+{
+ MessageDef *message_p = NULL;
+ sctp_new_association_req_t *sctp_new_association_req_p = NULL;
+ s1ap_eNB_mme_data_t *s1ap_mme_data_p = NULL;
+
+ DevAssert(instance_p != NULL);
+ DevAssert(mme_ip_address != NULL);
+
+ message_p = itti_alloc_new_message(TASK_S1AP, SCTP_NEW_ASSOCIATION_REQ);
+
+ sctp_new_association_req_p = &message_p->ittiMsg.sctp_new_association_req;
+
+ sctp_new_association_req_p->port = S1AP_PORT_NUMBER;
+ sctp_new_association_req_p->ppid = S1AP_SCTP_PPID;
+
+ memcpy(&sctp_new_association_req_p->remote_address,
+ mme_ip_address,
+ sizeof(*mme_ip_address));
+
+ memcpy(&sctp_new_association_req_p->local_address,
+ local_ip_addr,
+ sizeof(*local_ip_addr));
+
+ /* Create new MME descriptor */
+ s1ap_mme_data_p = calloc(1, sizeof(*s1ap_mme_data_p));
+ DevAssert(s1ap_mme_data_p != NULL);
+
+ s1ap_mme_data_p->cnx_id = s1ap_eNB_fetch_add_global_cnx_id();
+ sctp_new_association_req_p->ulp_cnx_id = s1ap_mme_data_p->cnx_id;
+
+ s1ap_mme_data_p->assoc_id = -1;
+ s1ap_mme_data_p->s1ap_eNB_instance = instance_p;
+
+ STAILQ_INIT(&s1ap_mme_data_p->served_gummei);
+
+ /* Insert the new descriptor in list of known MME
+ * but not yet associated.
+ */
+ RB_INSERT(s1ap_mme_map, &instance_p->s1ap_mme_head, s1ap_mme_data_p);
+ s1ap_mme_data_p->state = S1AP_ENB_STATE_WAITING;
+ instance_p->s1ap_mme_nb ++;
+ instance_p->s1ap_mme_pending_nb ++;
+
+ itti_send_msg_to_task(TASK_SCTP, instance_p->instance, message_p);
+}
+
+
+
+void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *s1ap_register_eNB)
+{
+ s1ap_eNB_instance_t *new_instance;
+ uint8_t index;
+
+ DevAssert(s1ap_register_eNB != NULL);
+
+ /* Look if the provided instance already exists */
+ new_instance = s1ap_eNB_get_instance(instance);
+
+ if (new_instance != NULL) {
+ /* Checks if it is a retry on the same eNB */
+ DevCheck(new_instance->eNB_id == s1ap_register_eNB->eNB_id, new_instance->eNB_id, s1ap_register_eNB->eNB_id, 0);
+ DevCheck(new_instance->cell_type == s1ap_register_eNB->cell_type, new_instance->cell_type, s1ap_register_eNB->cell_type, 0);
+ DevCheck(new_instance->tac == s1ap_register_eNB->tac, new_instance->tac, s1ap_register_eNB->tac, 0);
+ DevCheck(new_instance->mcc == s1ap_register_eNB->mcc, new_instance->mcc, s1ap_register_eNB->mcc, 0);
+ DevCheck(new_instance->mnc == s1ap_register_eNB->mnc, new_instance->mnc, s1ap_register_eNB->mnc, 0);
+ DevCheck(new_instance->mnc_digit_length == s1ap_register_eNB->mnc_digit_length, new_instance->mnc_digit_length, s1ap_register_eNB->mnc_digit_length, 0);
+ DevCheck(new_instance->default_drx == s1ap_register_eNB->default_drx, new_instance->default_drx, s1ap_register_eNB->default_drx, 0);
+ } else {
+ new_instance = calloc(1, sizeof(s1ap_eNB_instance_t));
+ DevAssert(new_instance != NULL);
+
+ RB_INIT(&new_instance->s1ap_ue_head);
+ RB_INIT(&new_instance->s1ap_mme_head);
+
+ /* Copy usefull parameters */
+ new_instance->instance = instance;
+ new_instance->eNB_name = s1ap_register_eNB->eNB_name;
+ new_instance->eNB_id = s1ap_register_eNB->eNB_id;
+ new_instance->cell_type = s1ap_register_eNB->cell_type;
+ new_instance->tac = s1ap_register_eNB->tac;
+ new_instance->mcc = s1ap_register_eNB->mcc;
+ new_instance->mnc = s1ap_register_eNB->mnc;
+ new_instance->mnc_digit_length = s1ap_register_eNB->mnc_digit_length;
+ new_instance->default_drx = s1ap_register_eNB->default_drx;
+
+ /* Add the new instance to the list of eNB (meaningfull in virtual mode) */
+ s1ap_eNB_insert_new_instance(new_instance);
+
+ S1AP_DEBUG("Registered new eNB[%d] and %s eNB id %u\n",
+ instance,
+ s1ap_register_eNB->cell_type == CELL_MACRO_ENB ? "macro" : "home",
+ s1ap_register_eNB->eNB_id);
+ }
+
+ DevCheck(s1ap_register_eNB->nb_mme <= S1AP_MAX_NB_MME_IP_ADDRESS,
+ S1AP_MAX_NB_MME_IP_ADDRESS, s1ap_register_eNB->nb_mme, 0);
+
+ /* Trying to connect to provided list of MME ip address */
+ for (index = 0; index < s1ap_register_eNB->nb_mme; index++) {
+ s1ap_eNB_register_mme(new_instance, &s1ap_register_eNB->mme_ip_address[index],
+ &s1ap_register_eNB->enb_ip_address);
+ }
+}
+
+
+
+
+void *s1ap_eNB_task(void *arg)
+{
+ MessageDef *received_msg = NULL;
+ int result;
+
+ S1AP_DEBUG("Starting S1AP layer\n");
+
+ s1ap_eNB_prepare_internal_data();
+
+ itti_mark_task_ready(TASK_S1AP);
+
+ while (1) {
+ itti_receive_msg(TASK_S1AP, &received_msg);
+
+ switch (ITTI_MSG_ID(received_msg)) {
+ case TERMINATE_MESSAGE:
+ itti_exit_task();
+ break;
+
+ case S1AP_REGISTER_ENB_REQ: {
+ /* Register a new eNB.
+ * in Virtual mode eNBs will be distinguished using the mod_id/
+ * Each eNB has to send an S1AP_REGISTER_ENB message with its
+ * own parameters.
+ */
+ s1ap_eNB_handle_register_eNB(ITTI_MESSAGE_GET_INSTANCE(received_msg),
+ &S1AP_REGISTER_ENB_REQ(received_msg));
+ }
+ break;
+
+ case SCTP_NEW_ASSOCIATION_RESP: {
+ s1ap_eNB_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
+ &received_msg->ittiMsg.sctp_new_association_resp);
+ }
+ break;
+
+ case SCTP_DATA_IND: {
+ s1ap_eNB_handle_sctp_data_ind(&received_msg->ittiMsg.sctp_data_ind);
+ }
+ break;
+
+
+
+ default:
+ S1AP_ERROR("Received unhandled message: %d:%s\n",
+ ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg));
+ break;
+ }
+
+ result = itti_free (ITTI_MSG_ORIGIN_ID(received_msg), received_msg);
+ AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
+
+ received_msg = NULL;
+ }
+
+ return NULL;
+}
diff --git a/openair-cn/TEST/oaisim_mme_test_s1c_s1ap.h b/openair-cn/TEST/oaisim_mme_test_s1c_s1ap.h
new file mode 100755
index 0000000000..3e3c186d19
--- /dev/null
+++ b/openair-cn/TEST/oaisim_mme_test_s1c_s1ap.h
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ 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, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
+
+*******************************************************************************/
+#define _GNU_SOURCE
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include