git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7653 818b1a75-f10b-46b9-bf7c-635c3b92a50f

This commit is contained in:
gauthier
2015-06-24 13:16:51 +00:00
parent eebc9396c1
commit 2c2a2c6ae9
606 changed files with 118981 additions and 1889 deletions
+407 -295
View File
@@ -577,12 +577,12 @@ 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")
@@ -608,7 +608,6 @@ 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")
@@ -625,7 +624,7 @@ add_library(HASHTABLE
include_directories(${OPENAIRCN_DIR}/UTILS/HASHTABLE)
if (MESSAGE_CHART_GENERATOR)
add_library(MSC
add_library(MSC
${OPENAIR_DIR}/common/utils/msc/msc.c
)
endif()
@@ -962,15 +961,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}\"
@@ -1041,284 +1040,358 @@ 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/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}
)
add_library(NAS ${libnas_OBJS})
if(NAS_UE)
set(NAS_LIB NAS 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
)
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}
)
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
@@ -1456,6 +1529,7 @@ add_executable(lte-softmodem
${OPENAIR_TARGETS}/SIMU/USER/init_lte.c
${OPENAIR_TARGETS}/COMMON/create_tasks.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
${OPENAIRCN_DIR}/NAS/UE/nas_ue_task.c
${GTPU_need_ITTI}
${HW_SOURCE}
${RTAI_SOURCE}
@@ -1465,18 +1539,54 @@ add_executable(lte-softmodem
if (MESSAGE_CHART_GENERATOR)
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 MSC 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 MSC L2 ${RAL_LIB} LIB_NAS_UE ${ITTI_LIB} ${MIH_LIB}
-Wl,--end-group )
else (MESSAGE_CHART_GENERATOR)
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 ${RAL_LIB} LIB_NAS_UE ${ITTI_LIB} ${MIH_LIB}
-Wl,--end-group )
endif(MESSAGE_CHART_GENERATOR)
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})
# 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
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
${HW_SOURCE}
${RTAI_SOURCE}
${XFORMS_SOURCE}
${XFORMS_SOURCE_SOFTMODEM}
)
if (MESSAGE_CHART_GENERATOR)
target_link_libraries (lte-softmodem-nos1
-Wl,--start-group
RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_LIB PHY LFDS MSC L2 ${RAL_LIB} ${ITTI_LIB} ${MIH_LIB}
-Wl,--end-group )
else (MESSAGE_CHART_GENERATOR)
target_link_libraries (lte-softmodem-nos1
-Wl,--start-group
RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_LIB PHY LFDS L2 ${RAL_LIB} ${ITTI_LIB} ${MIH_LIB}
-Wl,--end-group )
endif(MESSAGE_CHART_GENERATOR)
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
################################
@@ -1486,19 +1596,19 @@ 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
)
if (MESSAGE_CHART_GENERATOR)
target_link_libraries (mme_gw
-Wl,--start-group
NAS S1AP_LIB S1AP_EPC GTPV1U GTPV2C SCTP_SERVER UDP_SERVER SECU_CN SECU_OSA S6A SGW MME_APP LFDS MSC ${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 ${ITTI_LIB} CN_UTILS HASHTABLE
-Wl,--end-group
pthread m sctp rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES} fdproto fdcore
)
else (MESSAGE_CHART_GENERATOR)
target_link_libraries (mme_gw
-Wl,--start-group
NAS S1AP_LIB S1AP_EPC GTPV1U GTPV2C SCTP_SERVER UDP_SERVER SECU_CN SECU_OSA 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 ${ITTI_LIB} CN_UTILS HASHTABLE
-Wl,--end-group
pthread m sctp rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES} fdproto fdcore
)
@@ -1602,24 +1712,24 @@ endif(MESSAGE_CHART_GENERATOR)
# 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 +1753,7 @@ 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}
@@ -1652,12 +1763,12 @@ target_include_directories(oaisim PUBLIC ${OPENAIR_TARGETS}/SIMU/USER)
if (MESSAGE_CHART_GENERATOR)
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 MSC L2 ${RAL_LIB} ${NAS_LIB} SIMU SIMU_ETH SECU_OSA ${ITTI_LIB} ${MIH_LIB}
RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS MSC L2 ${RAL_LIB} LIB_NAS_UE SIMU SIMU_ETH SECU_OSA ${ITTI_LIB} ${MIH_LIB}
-Wl,--end-group )
else(MESSAGE_CHART_GENERATOR)
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 GTPV1U SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS L2 ${RAL_LIB} LIB_NAS_UE SIMU SIMU_ETH SECU_OSA ${ITTI_LIB} ${MIH_LIB}
-Wl,--end-group )
endif(MESSAGE_CHART_GENERATOR)
target_link_libraries (oaisim ${LIBXML2_LIBRARIES} ${LAPACK_LIBRARIES})
@@ -1693,12 +1804,12 @@ target_include_directories(oaisim_nos1 PUBLIC ${OPENAIR_TARGETS}/SIMU/USER)
if (MESSAGE_CHART_GENERATOR)
target_link_libraries (oaisim_nos1
-Wl,--start-group
RRC_LIB SECU_CN UTIL HASHTABLE UDP SCHED_LIB PHY LFDS MSC L2 ${RAL_LIB} ${NAS_LIB} SIMU SIMU_ETH SECU_OSA ${ITTI_LIB} ${MIH_LIB}
RRC_LIB SECU_CN UTIL HASHTABLE SCHED_LIB PHY LFDS MSC L2 ${RAL_LIB} SIMU SIMU_ETH SECU_OSA ${ITTI_LIB} ${MIH_LIB}
-Wl,--end-group )
else(MESSAGE_CHART_GENERATOR)
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 SECU_CN UTIL HASHTABLE SCHED_LIB PHY LFDS L2 ${RAL_LIB} SIMU SIMU_ETH SECU_OSA ${ITTI_LIB} ${MIH_LIB}
-Wl,--end-group )
endif(MESSAGE_CHART_GENERATOR)
target_link_libraries (oaisim_nos1 ${LIBXML2_LIBRARIES} ${LAPACK_LIBRARIES})
@@ -1785,6 +1896,7 @@ target_link_libraries (test_s1c_mme
# pthread m sctp rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES} fdproto fdcore
#)
##################################################
# Generated specific cases is not regular code
###############################################
@@ -1916,7 +2028,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)
+422 -422
View File
@@ -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 <http://www.gnu.org/licenses/>.
# see <http:/www.gnu.org/licenses/>.
#
# 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,257 @@ 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/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/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 +658,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
+2 -2
View File
@@ -276,8 +276,8 @@ function main() {
cmake ..
echo_info "Compiling LTE softmodem (w/o S1 interface)"
compilations \
lte_noS1_build_oai lte-softmodem \
lte-softmodem $dbin/lte-softmodem-nos1
lte_noS1_build_oai lte-softmodem-nos1 \
lte-softmodem-nos1 $dbin/lte-softmodem-nos1
compilations \
lte_noS1_build_oai nasmesh \
CMakeFiles/nasmesh/nasmesh.ko $dbin/nasmesh.ko
@@ -12,5 +12,5 @@ set(PDCP_USE_NETLINK_QUEUES False)
set(LINUX True)
set(SECU False)
set(NAS_UE False)
set(PACKAGE_NAME "\"lte-softmodem\"")
set(PACKAGE_NAME "\"lte-softmodem-nos1\"")
include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)
+26 -26
View File
@@ -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})
+9 -9
View File
@@ -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/GTPUSP && $SUDO make clean)
$SUDO rm -f $OPENAIRCN_DIR/GTPV1-U/GTPUSP/Bin/* 2>&1
$SUDO rm -f /lib/xtables/libxt_GTPU*.so 2>&1
mkdir -m 777 -p -v build
fi
@@ -274,16 +274,16 @@ function main()
mme_gw $dbin/mme_gw.$REL
# Only integrated mme+sgw+pgw is operational today
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
+8 -5
View File
@@ -201,7 +201,7 @@ install_gnutls_from_source(){
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
@@ -251,6 +251,8 @@ install_latest_freediameter_from_source() {
$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"
@@ -295,7 +297,7 @@ check_install_oai_software() {
$SUDO apt-get update
$SUDO apt-get install -y \
autoconf \
autoconf \
automake \
bison \
build-essential \
@@ -306,8 +308,9 @@ check_install_oai_software() {
texlive-latex-base\
ethtool \
flex \
gccxml \
gdb \
gccxml \
gdb \
git \
graphviz \
gtkwave \
guile-2.0-dev \
@@ -326,7 +329,7 @@ check_install_oai_software() {
libgmp-dev \
libgtk-3-dev \
libidn2-0-dev \
libidn11-dev \
libidn11-dev \
libmysqlclient-dev \
liboctave-dev \
libpgm-5.1 \
@@ -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..."
+1 -1
View File
@@ -62,7 +62,7 @@ MME :
# max values = 999.999:65535
# maximum of 32 values, comma separated
TAI_LIST = (
{MCC="208" ; MNC="95"; TAC = "1"; } # YOUR PLMN CONFIG HERE
{MCC="208" ; MNC="10"; TAC = "1"; } # YOUR PLMN CONFIG HERE
);
};
+4 -4
View File
@@ -174,17 +174,17 @@ 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
exec $OPENAIR_DIR/targets/bin/lte-softmodem.Rel10 `echo $exe_arguments` 2>&1 > /tmp/lte_softmodem.stdout.txt
else
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
+25 -17
View File
@@ -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 "$@"
+11 -4
View File
@@ -133,8 +133,8 @@ 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
@@ -148,11 +148,11 @@ function main()
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
$OPENAIR_DIR/targets/bin/mme_gw.Rel10 `echo $exe_arguments` 2>&1
else
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
@@ -175,5 +175,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 "$@"
+6 -6
View File
@@ -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.
-18
View File
@@ -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
@@ -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 <pradip_biswas@polarisnetworks.net>
@@ -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; \
@@ -3,5 +3,4 @@ Known issues in GTPU v1.0
-------------------------
1. Does not implement the "Transport" action.
2. Does not handle segmented GTPu packets.
+18
View File
@@ -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
@@ -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 <pradip_biswas@polarisnetworks.net>
@@ -19,7 +19,7 @@
#include <arpa/inet.h>
#include <linux/netfilter.h>
#include "xt_GTPUAH.h"
#include "xt_GTPUSP.h"
#if (IPTVERSION <= 135)
#include <iptables.h>
@@ -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 <value: add>\n"
" --own-ip value Set own IP address\n"
" --own-tun value Set own tunnel id <value: 1-2^31>\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(&gtpuah_tg_reg);
register_target(&gtpusp_tg_reg);
#else
xtables_register_target(&gtpuah_tg_reg);
xtables_register_target(&gtpusp_tg_reg);
#endif
}
@@ -47,7 +47,7 @@
#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
@@ -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 <pradip_biswas@polarisnetworks.net>");
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*)&gtpuh, 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*)&gtpuh, 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");
@@ -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)));
+674
View File
@@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
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.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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 <http://www.gnu.org/licenses/>.
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:
<program> Copyright (C) <year> <name of author>
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
<http://www.gnu.org/licenses/>.
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
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
@@ -26,42 +26,25 @@
# Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
#
################################################################################
noinst_LTLIBRARIES = libnas.la
ifndef PROJDIR
PROJDIR = $(PWD)/../../..
INCLUDES = -I. -I$(INCDIR) -I$(UTILDIR) -I$(IESDIR) -I$(EMMMSGDIR) -I$(ESMMSGDIR)
endif
libnas_la_LDFLAGS = -all-static
include $(PROJDIR)/Makerules
include $(PROJDIR)/Makefile.inc
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
all: $(OBJS)
%.o: %.c Makefile
@echo Compiling $<
@$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
clean:
$(RM) $(OBJS) *.bak *~
depend:
makedepend -- ${CFLAGS} -- ${SRCS}
# DO NOT DELETE THIS LINE -- make depend depends on it.
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
@@ -0,0 +1,374 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 as_message.c
Version 0.1
Date 2012/11/06
Product NAS stack
Subsystem Application Programming Interface
Author Frederic Maurel
Description Defines the messages supported by the Access Stratum sublayer
protocol (usually RRC and S1AP for E-UTRAN) and functions used
to encode and decode
*****************************************************************************/
#include "as_message.h"
#include "commonDef.h"
#include "nas_log.h"
#include <string.h> // memcpy
#include <stdlib.h> // 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 *******************/
/****************************************************************************/
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
/****************************************************************************
** **
** Name: as_message_decode() **
** **
** Description: Decode AS message and accordingly fills data structure **
** **
** Inputs: buffer: Pointer to the buffer containing the **
** message **
** length: Number of bytes that should be decoded **
** Others: None **
** **
** Outputs: msg: AS message structure to be filled **
** Return: The AS message identifier when the buffer **
** has been successfully decoded; **
** RETURNerror otherwise. **
** Others: None **
** **
***************************************************************************/
int as_message_decode(const char* buffer, as_message_t* msg, int length)
{
LOG_FUNC_IN;
int bytes;
Byte_t** data = NULL;
/* Get the message type */
msg->msgID = *(UInt16_t*)(buffer);
bytes = sizeof(UInt16_t);
switch (msg->msgID) {
case AS_NAS_ESTABLISH_REQ:
/* NAS signalling connection establish request */
bytes += sizeof(nas_establish_req_t) - sizeof(Byte_t*);
data = &msg->msg.nas_establish_req.initialNasMsg.data;
break;
case AS_NAS_ESTABLISH_IND:
/* NAS signalling connection establishment indication */
bytes += sizeof(nas_establish_ind_t) - sizeof(Byte_t*);
data = &msg->msg.nas_establish_ind.initialNasMsg.data;
break;
case AS_NAS_ESTABLISH_RSP:
/* NAS signalling connection establishment response */
bytes += sizeof(nas_establish_rsp_t) - sizeof(Byte_t*);
data = &msg->msg.nas_establish_rsp.nasMsg.data;
break;
case AS_NAS_ESTABLISH_CNF:
/* NAS signalling connection establishment confirm */
bytes += sizeof(nas_establish_cnf_t) - sizeof(Byte_t*);
data = &msg->msg.nas_establish_cnf.nasMsg.data;
break;
case AS_UL_INFO_TRANSFER_REQ:
/* Uplink L3 data transfer request */
bytes += sizeof(ul_info_transfer_req_t) - sizeof(Byte_t*);
data = &msg->msg.ul_info_transfer_req.nasMsg.data;
break;
case AS_UL_INFO_TRANSFER_IND:
/* Uplink L3 data transfer indication */
bytes += sizeof(ul_info_transfer_ind_t) - sizeof(Byte_t*);
data = &msg->msg.ul_info_transfer_ind.nasMsg.data;
break;
case AS_DL_INFO_TRANSFER_REQ:
/* Downlink L3 data transfer request */
bytes += sizeof(dl_info_transfer_req_t) - sizeof(Byte_t*);
data = &msg->msg.dl_info_transfer_req.nasMsg.data;
break;
case AS_DL_INFO_TRANSFER_IND:
/* Downlink L3 data transfer indication */
bytes += sizeof(dl_info_transfer_ind_t) - sizeof(Byte_t*);
data = &msg->msg.dl_info_transfer_ind.nasMsg.data;
break;
case AS_BROADCAST_INFO_IND:
case AS_CELL_INFO_REQ:
case AS_CELL_INFO_CNF:
case AS_CELL_INFO_IND:
case AS_PAGING_REQ:
case AS_PAGING_IND:
case AS_NAS_RELEASE_REQ:
case AS_UL_INFO_TRANSFER_CNF:
case AS_DL_INFO_TRANSFER_CNF:
case AS_NAS_RELEASE_IND:
case AS_RAB_ESTABLISH_REQ:
case AS_RAB_ESTABLISH_IND:
case AS_RAB_ESTABLISH_RSP:
case AS_RAB_ESTABLISH_CNF:
case AS_RAB_RELEASE_REQ:
case AS_RAB_RELEASE_IND:
/* Messages without dedicated NAS information */
bytes = length;
break;
default:
bytes = 0;
LOG_TRACE(WARNING, "NET-API - AS message 0x%x is not valid",
msg->msgID);
break;
}
if (bytes > 0) {
if (data) {
/* Set the pointer to dedicated NAS information */
*data = (Byte_t*)(buffer + bytes);
}
/* Decode the message */
memcpy(msg, (as_message_t*)buffer, bytes);
LOG_FUNC_RETURN (msg->msgID);
}
LOG_TRACE(WARNING, "NET-API - Failed to decode AS message 0x%x",
msg->msgID);
LOG_FUNC_RETURN (RETURNerror);
}
/****************************************************************************
** **
** Name: as_message_encode() **
** **
** Description: Encode AS message **
** **
** Inputs: msg: AS message structure to encode **
** length: Maximal capacity of the output buffer **
** Others: None **
** **
** Outputs: buffer: Pointer to the encoded data buffer **
** Return: The number of characters in the buffer **
** when data have been successfully encoded; **
** RETURNerror otherwise. **
** Others: None **
** **
***************************************************************************/
int as_message_encode(char* buffer, as_message_t* msg, int length)
{
LOG_FUNC_IN;
int bytes = sizeof(msg->msgID);
as_nas_info_t* nas_msg = NULL;
switch (msg->msgID) {
case AS_BROADCAST_INFO_IND:
/* Broadcast information */
bytes += sizeof(broadcast_info_ind_t);
break;
case AS_CELL_INFO_REQ:
/* Cell information request */
bytes += sizeof(cell_info_req_t);
break;
case AS_CELL_INFO_CNF:
/* Cell information response */
bytes += sizeof(cell_info_cnf_t);
break;
case AS_CELL_INFO_IND:
/* Cell information indication */
bytes += sizeof(cell_info_ind_t);
break;
case AS_PAGING_REQ:
/* Paging information request */
bytes += sizeof(paging_req_t);
break;
case AS_PAGING_IND:
/* Paging information indication */
bytes += sizeof(paging_ind_t);
break;
case AS_NAS_ESTABLISH_REQ:
/* NAS signalling connection establish request */
bytes += sizeof(nas_establish_req_t) - sizeof(Byte_t*);
nas_msg = &msg->msg.nas_establish_req.initialNasMsg;
break;
case AS_NAS_ESTABLISH_IND:
/* NAS signalling connection establish indication */
bytes += sizeof(nas_establish_ind_t) - sizeof(Byte_t*);
nas_msg = &msg->msg.nas_establish_ind.initialNasMsg;
break;
case AS_NAS_ESTABLISH_RSP:
/* NAS signalling connection establish response */
bytes += sizeof(nas_establish_rsp_t) - sizeof(Byte_t*);
nas_msg = &msg->msg.nas_establish_rsp.nasMsg;
break;
case AS_NAS_ESTABLISH_CNF:
/* NAS signalling connection establish confirm */
bytes += sizeof(nas_establish_cnf_t) - sizeof(Byte_t*);
nas_msg = &msg->msg.nas_establish_cnf.nasMsg;
break;
case AS_NAS_RELEASE_REQ:
/* NAS signalling connection release request */
bytes += sizeof(nas_release_req_t);
break;
case AS_NAS_RELEASE_IND:
/* NAS signalling connection release indication */
bytes += sizeof(nas_release_ind_t);
break;
case AS_UL_INFO_TRANSFER_REQ:
/* Uplink L3 data transfer request */
bytes += sizeof(ul_info_transfer_req_t) - sizeof(Byte_t*);
nas_msg = &msg->msg.ul_info_transfer_req.nasMsg;
break;
case AS_UL_INFO_TRANSFER_CNF:
/* Uplink L3 data transfer confirm */
bytes += sizeof(ul_info_transfer_cnf_t);
break;
case AS_UL_INFO_TRANSFER_IND:
/* Uplink L3 data transfer indication */
bytes += sizeof(ul_info_transfer_ind_t) - sizeof(Byte_t*);
nas_msg = &msg->msg.ul_info_transfer_ind.nasMsg;
break;
case AS_DL_INFO_TRANSFER_REQ:
/* Downlink L3 data transfer */
bytes += sizeof(dl_info_transfer_req_t) - sizeof(Byte_t*);
nas_msg = &msg->msg.dl_info_transfer_req.nasMsg;
break;
case AS_DL_INFO_TRANSFER_CNF:
/* Downlink L3 data transfer confirm */
bytes += sizeof(dl_info_transfer_cnf_t);
break;
case AS_DL_INFO_TRANSFER_IND:
/* Downlink L3 data transfer indication */
bytes += sizeof(dl_info_transfer_ind_t) - sizeof(Byte_t*);
nas_msg = &msg->msg.dl_info_transfer_ind.nasMsg;
break;
case AS_RAB_ESTABLISH_REQ:
/* Radio Access Bearer establishment request */
bytes += sizeof(rab_establish_req_t);
break;
case AS_RAB_ESTABLISH_IND:
/* Radio Access Bearer establishment indication */
bytes += sizeof(rab_establish_ind_t);
break;
case AS_RAB_ESTABLISH_RSP:
/* Radio Access Bearer establishment response */
bytes += sizeof(rab_establish_rsp_t);
break;
case AS_RAB_ESTABLISH_CNF:
/* Radio Access Bearer establishment confirm */
bytes += sizeof(rab_establish_cnf_t);
break;
case AS_RAB_RELEASE_REQ:
/* Radio Access Bearer release request */
bytes += sizeof(rab_release_req_t);
break;
case AS_RAB_RELEASE_IND:
/* Radio Access Bearer release indication */
bytes += sizeof(rab_release_ind_t);
break;
default:
LOG_TRACE(WARNING, "NET-API - AS message 0x%x is not valid",
msg->msgID);
bytes = length;
break;
}
if (length > bytes) {
/* Encode the AS message */
memcpy(buffer, (unsigned char*)msg, bytes);
if ( nas_msg && (nas_msg->length > 0) ) {
/* Copy the NAS message */
memcpy(buffer + bytes, nas_msg->data, nas_msg->length);
bytes += nas_msg->length;
/* Release NAS message memory */
free(nas_msg->data);
nas_msg->length = 0;
nas_msg->data = NULL;
}
LOG_FUNC_RETURN (bytes);
}
LOG_TRACE(WARNING, "NET-API - Failed to encode AS message 0x%x",
msg->msgID);
LOG_FUNC_RETURN (RETURNerror);
}
/****************************************************************************/
/********************* L O C A L F U N C T I O N S *********************/
/****************************************************************************/
+1
View File
@@ -0,0 +1 @@
../../../../../openair2/COMMON/as_message.h
@@ -0,0 +1,309 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 as_message.h
Version 0.1
Date 2012/10/18
Product NAS stack
Subsystem Application Programming Interface
Author Frederic Maurel
Description Defines the messages supported by the Access Stratum sublayer
protocol (usually RRC and S1AP for E-UTRAN) and functions used
to encode and decode
*****************************************************************************/
#ifndef __AS_MESSAGE_H__
#define __AS_MESSAGE_H__
#include "commonDef.h"
#include "networkDef.h"
/****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/
/****************************************************************************/
/* Access Stratum Message types */
#define AS_REQUEST 0x0100
#define AS_RESPONSE 0x0200
#define AS_INDICATION 0x0400
#define AS_CONFIRM 0x0800
/*
* Access Stratum Message identifiers
* ----------------------------------
*/
/* Cell information relevant for cell selection processing */
#define AS_CELL_INFO 0x01
#define AS_CELL_INFO_REQ (AS_CELL_INFO | AS_REQUEST)
#define AS_CELL_INFO_RSP (AS_CELL_INFO | AS_RESPONSE)
#define AS_CELL_INFO_IND (AS_CELL_INFO | AS_INDICATION)
/* Security mode control */
#define AS_SECURITY 0x02
#define AS_SECURITY_REQ (AS_SECURITY | AS_REQUEST)
#define AS_SECURITY_RSP (AS_SECURITY | AS_RESPONSE)
/* Paging information */
#define AS_PAGING 0x03
#define AS_PAGING_IND (AS_PAGING | AS_INDICATION)
/* NAS signalling connection establishment */
#define AS_NAS_ESTABLISH 0x04
#define AS_NAS_ESTABLISH_REQ (AS_NAS_ESTABLISH | AS_REQUEST)
#define AS_NAS_ESTABLISH_RSP (AS_NAS_ESTABLISH | AS_RESPONSE)
/* NAS signalling connection release */
#define AS_NAS_RELEASE 0x05
#define AS_NAS_RELEASE_REQ (AS_NAS_RELEASE | AS_REQUEST)
#define AS_NAS_RELEASE_IND (AS_NAS_RELEASE | AS_INDICATION)
/* NAS information transfer */
#define AS_INFO_TRANSFER 0x10
#define AS_UL_INFO_TRANSFER (AS_INFO_TRANSFER | AS_REQUEST)
#define AS_DL_INFO_TRANSFER (AS_INFO_TRANSFER | AS_INDICATION)
/****************************************************************************/
/************************ G L O B A L T Y P E S ************************/
/****************************************************************************/
/*
* --------------------------------------------------------------------------
* Available PLMNs and cell Information
* --------------------------------------------------------------------------
*/
/* Radio access technologies supported by the network */
#define AS_GSM (1 << NET_ACCESS_GSM)
#define AS_COMPACT (1 << NET_ACCESS_COMPACT)
#define AS_UTRAN (1 << NET_ACCESS_UTRAN)
#define AS_EGPRS (1 << NET_ACCESS_EGPRS)
#define AS_HSDPA (1 << NET_ACCESS_HSDPA)
#define AS_HSUPA (1 << NET_ACCESS_HSUPA)
#define AS_HSDUPA (1 << NET_ACCESS_HSDUPA)
#define AS_EUTRAN (1 << NET_ACCESS_EUTRAN)
/*
* NAS->AS - Cell Information request
* NAS request AS to search for a suitable cell belonging to the selected
* PLMN to camp on.
*/
typedef struct {
plmn_t plmnID; /* PLMN identifier */
Byte_t rat; /* Bitmap - set of radio access technologies */
} cell_info_req_t;
/*
* AS->NAS - Cell Information response
* AS search for a suitable cell and respond to NAS. If found, the cell
* is selected to camp on.
*/
typedef struct {
plmn_t plmnID; /* PLMN identifier */
TAC_t tac; /* identifies a tracking area the PLMN belongs to */
CI_t cellID; /* identifies a cell within a PLMN */
AcT_t rat; /* radio access technology supported by the cell */
} cell_info_rsp_t;
/*
* AS->NAS - Cell Information indication
* AS Reports available PLMNs with associated Radio Access Technologies
* to NAS on request from NAS or autonomously.
*/
typedef struct {
#define PLMN_LIST_MAX_SIZE 6
PLMN_LIST_T(PLMN_LIST_MAX_SIZE) plmnIDs; /* List of PLMN identifiers */
Byte_t rat[PLMN_LIST_MAX_SIZE]; /* Radio access technologies */
TAC_t tac; /* identifies a tracking area within a scope of PLMNs */
CI_t cellID; /* identifies a cell within a PLMN */
} cell_info_ind_t;
/*
* --------------------------------------------------------------------------
* Security mode control
* --------------------------------------------------------------------------
*/
/*
* TODO: NAS->AS - Security command request
*/
typedef struct {} security_req_t;
/*
* TODO: AS->NAS - Security command response
*/
typedef struct {} security_rsp_t;
/*
* --------------------------------------------------------------------------
* Paging information
* --------------------------------------------------------------------------
*/
/*
* TODO: AS->NAS - Paging Information indication
*/
typedef struct {} paging_ind_t;
/*
* --------------------------------------------------------------------------
* NAS signalling connection establishment
* --------------------------------------------------------------------------
*/
/* Cause of RRC connection establishment */
#define AS_CAUSE_EMERGENCY (NET_ESTABLISH_CAUSE_EMERGENCY)
#define AS_CAUSE_HIGH_PRIO (NET_ESTABLISH_CAUSE_HIGH_PRIO)
#define AS_CAUSE_MT_ACCESS (NET_ESTABLISH_CAUSE_MT_ACCESS)
#define AS_CAUSE_MO_SIGNAL (NET_ESTABLISH_CAUSE_MO_SIGNAL)
#define AS_CAUSE_MO_DATA (NET_ESTABLISH_CAUSE_MO_DATA)
#define AS_CAUSE_V1020 (NET_ESTABLISH_CAUSE_V1020)
/* Type of the call associated to the RRC connection establishment */
#define AS_TYPE_ORIGINATING_SIGNAL (NET_ESTABLISH_TYPE_ORIGINATING_SIGNAL)
#define AS_TYPE_EMERGENCY_CALLS (NET_ESTABLISH_TYPE_EMERGENCY_CALLS)
#define AS_TYPE_ORIGINATING_CALLS (NET_ESTABLISH_TYPE_ORIGINATING_CALLS)
#define AS_TYPE_TERMINATING_CALLS (NET_ESTABLISH_TYPE_TERMINATING_CALLS)
#define AS_TYPE_MO_CS_FALLBACK (NET_ESTABLISH_TYPE_MO_CS_FALLBACK)
/* 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 */
} as_stmsi_t;
/* Structure of the dedicated NAS information */
typedef struct {
UInt32_t length; /* Length of the NAS information data */
Byte_t* data; /* Dedicated NAS information data container */
} as_nas_info_t;
/*
* NAS->AS - NAS signalling connection establishment request
* NAS request AS to perform the RRC connection establishment procedure
* 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 */
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 */
} nas_establish_req_t;
/*
* TODO: AS->NAS - NAS signalling connection establishment response
*/
typedef struct {} nas_establish_rsp_t;
/*
* --------------------------------------------------------------------------
* NAS signalling connection release
* --------------------------------------------------------------------------
*/
/*
* TODO: NAS->AS - NAS signalling connection release request
*/
typedef struct {} nas_release_req_t;
/*
* TODO: AS->NAS - NAS signalling connection release indication
*/
typedef struct {} nas_release_ind_t;
/*
* --------------------------------------------------------------------------
* NAS information transfer
* --------------------------------------------------------------------------
*/
/*
* AS->NAS - Downlink data transfer
* AS notifies upper layer that NAS or non-3GPP dedicated downlink information
* has to be transfered to NAS.
*/
typedef as_nas_info_t dl_info_transfer_t;
/*
* NAS->AS - Uplink data transfer request
* NAS requests under layer to transfer NAS or non-3GPP dedicated uplink
* information to AS.
*/
typedef as_nas_info_t ul_info_transfer_t;
/*
* --------------------------------------------------------------------------
* Structure of the AS messages handled by the network sublayer
* --------------------------------------------------------------------------
*/
typedef struct {
UInt16_t msgID;
union {
cell_info_req_t cell_info_req;
cell_info_rsp_t cell_info_rsp;
cell_info_ind_t cell_info_ind;
security_req_t security_req;
security_rsp_t security_rsp;
paging_ind_t paging_ind;
nas_establish_req_t nas_establish_req;
nas_establish_rsp_t nas_establish_rsp;
nas_release_req_t nas_release_req;
nas_release_ind_t nas_release_ind;
ul_info_transfer_t ul_info_transfer;
dl_info_transfer_t dl_info_transfer;
} __attribute__((__packed__)) msg;
} as_message_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 ******************/
/****************************************************************************/
int as_message_decode(const char* buffer, int length, as_message_t* msg);
int as_message_encode(char* buffer, int length, const as_message_t* msg);
/* Implemented in the network_api.c body file */
int as_message_send(as_message_t* as_msg, const void* nas_msg);
#endif /* __AS_MESSAGE_H__*/
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,135 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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_message.h
Version 0.1
Date 2012/26/09
Product NAS stack
Subsystem Application Programming Interface
Author Frederic Maurel
Description Defines the layer 3 messages supported by the NAS sublayer
protocol and functions used to encode and decode
*****************************************************************************/
#ifndef __NAS_MESSAGE_H__
#define __NAS_MESSAGE_H__
#include "commonDef.h"
#include "emm_msg.h"
#if defined(NAS_BUILT_IN_EPC)
#include "emmData.h"
#endif
#include "esm_msg.h"
/****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/
/****************************************************************************/
#define NAS_MESSAGE_SECURITY_HEADER_SIZE 6
/****************************************************************************/
/************************ G L O B A L T Y P E S ************************/
/****************************************************************************/
/* Structure of security protected header */
typedef struct {
#ifdef __LITTLE_ENDIAN_BITFIELD
eps_protocol_discriminator_t protocol_discriminator:4;
UInt8_t security_header_type:4;
#endif
#ifdef __BIG_ENDIAN_BITFIELD
UInt8_t security_header_type:4;
UInt8_t protocol_discriminator:4;
#endif
UInt32_t message_authentication_code;
UInt8_t sequence_number;
} nas_message_security_header_t;
/* Structure of plain NAS message */
typedef union {
EMM_msg emm; /* EPS Mobility Management messages */
ESM_msg esm; /* EPS Session Management messages */
} nas_message_plain_t;
/* Structure of security protected NAS message */
typedef struct {
nas_message_security_header_t header;
nas_message_plain_t plain;
} nas_message_security_protected_t;
/*
* Structure of a layer 3 NAS message
*/
typedef union {
nas_message_security_header_t header;
nas_message_security_protected_t security_protected;
nas_message_plain_t plain;
} nas_message_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 ******************/
/****************************************************************************/
int nas_message_encrypt(
const char *inbuf,
char *outbuf,
const nas_message_security_header_t *header,
int length,
void *security);
int nas_message_decrypt(const char *inbuf,
char *outbuf,
nas_message_security_header_t *header,
int length,
void *security);
int nas_message_decode(
const char * const buffer,
nas_message_t *msg,
int length,
void *security);
int nas_message_encode(
char *buffer,
const nas_message_t * const msg,
int length,
void *security);
#endif /* __NAS_MESSAGE_H__*/
@@ -0,0 +1,447 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 network_api.c
Version 0.1
Date 2012/03/01
Product NAS stack
Subsystem Application Programming Interface
Author Frederic Maurel
Description Implements the API used by the NAS layer to send/receive
message to/from the network sublayer
*****************************************************************************/
#include "network_api.h"
#include "commonDef.h"
#include "nas_log.h"
#include "socket.h"
#include "as_message.h"
#include <string.h> // strerror, memset
#include <netdb.h> // gai_strerror
#include <errno.h> // errno
#include <unistd.h> // gethostname
/****************************************************************************/
/**************** 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 *******************/
/****************************************************************************/
/* -------------------
* Connection endpoint
* -------------------
* The connection endpoint is used to send/receive data to/from the
* network sublayer. Its definition depends on the underlaying mechanism
* chosen to communicate (network socket, I/O terminal device, async FIFO).
* A connection endpoint is handled using an identifier, and functions
* used to retreive the file descriptor actually allocated by the system,
* to receive data, to send data, and to perform clean up when connection
* is shut down.
* Only one single end to end connection with the network sublayer is
* managed at a time.
*/
static struct {
/* Connection endpoint reference */
void* endpoint;
/* Connection endpoint handlers */
void* (*open) (int, const char*, const char*);
int (*getfd)(const void*);
ssize_t (*recv) (void*, char*, size_t);
ssize_t (*send) (const void*, const char*, size_t);
void (*close)(void*);
} _network_api_id;
#define NETWORK_API_OPEN(a, b, c) _network_api_id.open(a, b, c)
#define NETWORK_API_GETFD() _network_api_id.getfd(_network_api_id.endpoint)
#define NETWORK_API_RECV(a, b) _network_api_id.recv(_network_api_id.endpoint, a, b)
#define NETWORK_API_SEND(a, b) _network_api_id.send(_network_api_id.endpoint, a, b)
#define NETWORK_API_CLOSE() _network_api_id.close(_network_api_id.endpoint)
/*
* The buffer used to receive data from the network sublayer
*/
#define NETWORK_API_RECV_BUFFER_SIZE 4096
static char _network_api_recv_buffer[NETWORK_API_RECV_BUFFER_SIZE];
/*
* The buffer used to send data to the network sublayer
*/
#define NETWORK_API_SEND_BUFFER_SIZE NETWORK_API_RECV_BUFFER_SIZE
static char _network_api_send_buffer[NETWORK_API_SEND_BUFFER_SIZE];
/*
* The decoded data received from the network sublayer
*/
static as_message_t _as_data = {}; /* Access Stratum message */
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
/****************************************************************************
** **
** Name: network_api_initialize() **
** **
** Description: Initializes the network API from which the NAS layer **
** will send/receive messages to/from the network sublayer **
** **
** Inputs: host: The name of the host from which the net- **
** work sublayer will connect **
** port: The local port number **
** Others: None **
** **
** Outputs: Return: RETURNerror, RETURNok **
** Others: _network_api_id **
** **
***************************************************************************/
int network_api_initialize(const char* host, const char* port)
{
LOG_FUNC_IN;
/* Initialize network socket handlers */
_network_api_id.open = socket_udp_open;
_network_api_id.getfd = socket_get_fd;
_network_api_id.recv = socket_recv;
_network_api_id.send = socket_send;
_network_api_id.close = socket_close;
/* Initialize UDP communication channel with the network layer */
#ifdef NAS_UE
_network_api_id.endpoint = NETWORK_API_OPEN(SOCKET_CLIENT, host, port);
#endif
#ifdef NAS_MME
_network_api_id.endpoint = NETWORK_API_OPEN(SOCKET_SERVER, NULL, port);
#endif
if (_network_api_id.endpoint == NULL) {
const char* error = ( (errno < 0) ?
gai_strerror(errno) : strerror(errno) );
LOG_TRACE(ERROR, "NET-API - Failed to open connection endpoint, %s",
error);
LOG_FUNC_RETURN (RETURNerror);
}
gethostname(_network_api_send_buffer, NETWORK_API_SEND_BUFFER_SIZE);
LOG_TRACE(INFO, "NET-API - Network's UDP socket %d is BOUND to %s/%s",
network_api_get_fd(), _network_api_send_buffer, port);
LOG_FUNC_RETURN (RETURNok);
}
/****************************************************************************
** **
** Name: network_api_get_fd() **
** **
** Description: Get the file descriptor of the connection endpoint used **
** to send/receive messages to/from the network sublayer **
** **
** Inputs: None **
** Others: _network_api_id **
** **
** Outputs: Return: The file descriptor of the connection end- **
** point used by the network sublayer **
** Others: None **
** **
***************************************************************************/
int network_api_get_fd(void)
{
LOG_FUNC_IN;
LOG_FUNC_RETURN (NETWORK_API_GETFD());
}
/****************************************************************************
** **
** Name: network_api_get_data() **
** **
** Description: Get a generic pointer to the network data structure. **
** Casting to the proper type is necessary before its usage. **
** **
** Inputs: None **
** Others: _as_data **
** **
** Outputs: Return: A generic pointer to the network data **
** structure **
** Others: None **
** **
***************************************************************************/
const void* network_api_get_data(void)
{
LOG_FUNC_IN;
LOG_FUNC_RETURN ((void*)(&_as_data));
}
/****************************************************************************
** **
** Name: network_api_read_data() **
** **
** Description: Read data received from the network sublayer **
** **
** Inputs: fd: File descriptor of the connection endpoint **
** from which data have been received **
** Others: _network_api_id **
** **
** Outputs: Return: The number of bytes read when success; **
** RETURNerror otherwise **
** Others: _network_api_recv_buffer, _network_api_id **
** **
***************************************************************************/
int network_api_read_data(int fd)
{
LOG_FUNC_IN;
int rbytes;
/* Sanity check */
int sfd = network_api_get_fd();
if (fd != sfd) {
LOG_TRACE(ERROR, "NET-API - Endpoint %d is not the one created for communication with the network sublayer (%d)", fd, sfd);
LOG_FUNC_RETURN (RETURNerror);
}
memset(_network_api_recv_buffer, 0, NETWORK_API_RECV_BUFFER_SIZE);
/* Receive data from the network sublayer */
rbytes = NETWORK_API_RECV(_network_api_recv_buffer,
NETWORK_API_RECV_BUFFER_SIZE);
if (rbytes == RETURNerror) {
LOG_TRACE(ERROR, "NET-API - recv() failed, %s", strerror(errno));
LOG_FUNC_RETURN (RETURNerror);
} else if (rbytes == 0) {
LOG_TRACE(WARNING, "NET-API - A signal was caught");
} else {
LOG_TRACE(INFO, "NET-API - %d bytes received from the network "
"sublayer", rbytes);
LOG_DUMP(_network_api_recv_buffer, rbytes);
}
LOG_FUNC_RETURN (rbytes);
}
/****************************************************************************
** **
** Name: network_api_send_data() **
** **
** Description: Send data to the network sublayer **
** **
** Inputs: fd: File descriptor of the connection endpoint **
** to which data have to be sent **
** length: Number of bytes to send **
** Others: _network_api_send_buffer, _network_api_id **
** **
** Outputs: Return: The number of bytes sent when success; **
** RETURNerror otherwise **
** Others: None **
** **
***************************************************************************/
int network_api_send_data(int fd, int length)
{
LOG_FUNC_IN;
int sbytes;
/* Sanity check */
int sfd = network_api_get_fd();
if (fd != sfd) {
LOG_TRACE(ERROR, "NET-API - Endpoint %d is not the one created for communication with the network sublayer (%d)", fd, sfd);
LOG_FUNC_RETURN (RETURNerror);
}
/* Send data to the network sublayer */
sbytes = NETWORK_API_SEND(_network_api_send_buffer, length);
if (sbytes == RETURNerror) {
LOG_TRACE(ERROR, "NET-API - send() failed, %s", strerror(errno));
LOG_FUNC_RETURN (RETURNerror);
} else if (sbytes == 0) {
LOG_TRACE(WARNING, "NET-API - A signal was caught");
} else {
LOG_TRACE(INFO, "NET-API - %d bytes sent to the network sublayer",
sbytes);
LOG_DUMP(_network_api_send_buffer, sbytes);
}
LOG_FUNC_RETURN (sbytes);
}
/****************************************************************************
** **
** Name: network_api_close() **
** **
** Description: Clean the network API from which the NAS layer sent/recei-**
** ved messages to/from the network sublayer **
** **
** Inputs: fd: File descriptor of the connection endpoint **
** allocated by the system to communicate **
** with the network sublayer **
** Others: None **
** **
** Outputs: Return: None **
** Others: _network_api_id **
** **
***************************************************************************/
void network_api_close(int fd)
{
LOG_FUNC_IN;
/* Sanity check */
int sfd = network_api_get_fd();
if (fd != sfd) {
LOG_TRACE(ERROR, "NET-API - Endpoint %d is not the one created for communication with the network sublayer (%d)", fd, sfd);
LOG_FUNC_OUT;
return;
}
/* Cleanup the connection endpoint */
NETWORK_API_CLOSE();
_network_api_id.endpoint = NULL;
LOG_FUNC_OUT;
}
/****************************************************************************
** **
** Name: network_api_decode_data() **
** **
** Description: Decodes the message received from the network and fills **
** the corresponding network data structure. **
** **
** Inputs: length: Number of bytes to decode **
** Others: _network_api_recv_buffer **
** **
** Outputs: Return: The identifier of the received AS **
** message when successfully decoded; **
** RETURNerror otherwise **
** Others: _as_data **
** **
***************************************************************************/
int network_api_decode_data(int length)
{
LOG_FUNC_IN;
/* Decode the Access Stratum message received from the network */
int as_id = as_message_decode(_network_api_recv_buffer, &_as_data, length);
if (as_id != RETURNerror) {
LOG_TRACE(INFO, "NET-API - AS message id=0x%x successfully decoded",
as_id);
}
LOG_FUNC_RETURN (as_id);
}
/****************************************************************************
** **
** Name: network_api_encode_data() **
** **
** Description: Encodes Access Stratum message to be sent to the network **
** **
** Inputs data: Generic pointer to the AS data to encode **
** Others: None **
** **
** Outputs: Return: The number of characters that have been **
** successfully encoded; **
** RETURNerror otherwise. **
** Others: _network_api_send_buffer **
** **
***************************************************************************/
int network_api_encode_data(void* data)
{
LOG_FUNC_IN;
/* Encode the Access Stratum message */
int bytes = as_message_encode(_network_api_send_buffer,
(as_message_t*)(data),
NETWORK_API_SEND_BUFFER_SIZE);
if (bytes != RETURNerror) {
LOG_TRACE(INFO, "NET-API - %d bytes encoded", bytes);
}
LOG_FUNC_RETURN (bytes);
}
/****************************************************************************
** **
** Name: as_message_send() **
** **
** Description: Service provided to the EPS Mobility Management protocol **
** at the EMMAS Access Point (EMMAS-SAP) to send AS messages **
** to the Access Stratum sublayer. **
** **
** Inputs: as_msg: The AS message to send **
** Others: _network_api_send_buffer, _network_api_id **
** **
** Outputs: Return: The number of bytes sent when success; **
** RETURNerror Otherwise **
** Others: _network_api_send_buffer **
** **
***************************************************************************/
int as_message_send(as_message_t* as_msg)
{
int bytes;
LOG_FUNC_IN;
LOG_TRACE(INFO, "NET-API - Send message 0x%.4x to the Access Stratum "
"layer", as_msg->msgID);
/* Encode the AS message */
bytes = network_api_encode_data(as_msg);
if (bytes > 0) {
/* Get the network file descriptor */
int fd = network_api_get_fd();
if (fd != RETURNerror) {
/* Send the AS message to the network */
bytes = network_api_send_data(fd, bytes);
}
}
LOG_FUNC_RETURN (bytes);
}
/****************************************************************************/
/********************* L O C A L F U N C T I O N S *********************/
/****************************************************************************/
@@ -0,0 +1,78 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 network_api.h
Version 0.1
Date 2012/03/01
Product NAS stack
Subsystem Application Programming Interface
Author Frederic Maurel
Description Implements the API used by the NAS layer to send/receive
message to/from the network layer
*****************************************************************************/
#ifndef __NETWORK_API_H__
#define __NETWORK_API_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 network_api_initialize(const char* host, const char* port);
int network_api_get_fd(void);
const void* network_api_get_data(void);
int network_api_read_data(int fd);
int network_api_send_data(int fd, int length);
void network_api_close(int fd);
int network_api_decode_data(int length);
int network_api_encode_data(void* data);
#endif /* __NETWORK_API_H__*/
+674
View File
@@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
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.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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 <http://www.gnu.org/licenses/>.
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:
<program> Copyright (C) <year> <name of author>
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
<http://www.gnu.org/licenses/>.
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
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
@@ -0,0 +1,373 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "AttachAccept.h"
int decode_attach_accept(attach_accept_msg *attach_accept, uint8_t *buffer, uint32_t len)
{
uint32_t decoded = 0;
int decoded_result = 0;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, ATTACH_ACCEPT_MINIMUM_LENGTH, len);
/* Decoding mandatory fields */
if ((decoded_result = decode_u8_eps_attach_result(&attach_accept->epsattachresult, 0, *(buffer + decoded), len - decoded)) < 0)
return decoded_result;
decoded++;
if ((decoded_result = decode_gprs_timer(&attach_accept->t3412value, 0, buffer + decoded, len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
if ((decoded_result = decode_tracking_area_identity_list(&attach_accept->tailist, 0, buffer + decoded, len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
if ((decoded_result = decode_esm_message_container(&attach_accept->esmmessagecontainer, 0, buffer + decoded, len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
/* Decoding optional fields */
while(len - decoded > 0) {
uint8_t ieiDecoded = *(buffer + decoded);
/* Type | value iei are below 0x80 so just return the first 4 bits */
if (ieiDecoded >= 0x80)
ieiDecoded = ieiDecoded & 0xf0;
switch(ieiDecoded) {
case ATTACH_ACCEPT_GUTI_IEI:
if ((decoded_result =
decode_eps_mobile_identity(&attach_accept->guti,
ATTACH_ACCEPT_GUTI_IEI, buffer + decoded, len - decoded))
<= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
attach_accept->presencemask |= ATTACH_ACCEPT_GUTI_PRESENT;
break;
case ATTACH_ACCEPT_LOCATION_AREA_IDENTIFICATION_IEI:
if ((decoded_result =
decode_location_area_identification(&attach_accept->locationareaidentification,
ATTACH_ACCEPT_LOCATION_AREA_IDENTIFICATION_IEI, buffer +
decoded, len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
attach_accept->presencemask |= ATTACH_ACCEPT_LOCATION_AREA_IDENTIFICATION_PRESENT;
break;
case ATTACH_ACCEPT_MS_IDENTITY_IEI:
if ((decoded_result =
decode_mobile_identity(&attach_accept->msidentity,
ATTACH_ACCEPT_MS_IDENTITY_IEI, buffer + decoded, len -
decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
attach_accept->presencemask |= ATTACH_ACCEPT_MS_IDENTITY_PRESENT;
break;
case ATTACH_ACCEPT_EMM_CAUSE_IEI:
if ((decoded_result = decode_emm_cause(&attach_accept->emmcause,
ATTACH_ACCEPT_EMM_CAUSE_IEI, buffer + decoded, len -
decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
attach_accept->presencemask |= ATTACH_ACCEPT_EMM_CAUSE_PRESENT;
break;
case ATTACH_ACCEPT_T3402_VALUE_IEI:
if ((decoded_result =
decode_gprs_timer(&attach_accept->t3402value,
ATTACH_ACCEPT_T3402_VALUE_IEI, buffer + decoded, len -
decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
attach_accept->presencemask |= ATTACH_ACCEPT_T3402_VALUE_PRESENT;
break;
case ATTACH_ACCEPT_T3423_VALUE_IEI:
if ((decoded_result =
decode_gprs_timer(&attach_accept->t3423value,
ATTACH_ACCEPT_T3423_VALUE_IEI, buffer + decoded, len -
decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
attach_accept->presencemask |= ATTACH_ACCEPT_T3423_VALUE_PRESENT;
break;
case ATTACH_ACCEPT_EQUIVALENT_PLMNS_IEI:
if ((decoded_result =
decode_plmn_list(&attach_accept->equivalentplmns,
ATTACH_ACCEPT_EQUIVALENT_PLMNS_IEI, buffer + decoded, len -
decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
attach_accept->presencemask |= ATTACH_ACCEPT_EQUIVALENT_PLMNS_PRESENT;
break;
case ATTACH_ACCEPT_EMERGENCY_NUMBER_LIST_IEI:
if ((decoded_result =
decode_emergency_number_list(&attach_accept->emergencynumberlist,
ATTACH_ACCEPT_EMERGENCY_NUMBER_LIST_IEI, buffer + decoded,
len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
attach_accept->presencemask |= ATTACH_ACCEPT_EMERGENCY_NUMBER_LIST_PRESENT;
break;
case ATTACH_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_IEI:
if ((decoded_result =
decode_eps_network_feature_support(&attach_accept->epsnetworkfeaturesupport,
ATTACH_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_IEI, buffer +
decoded, len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
attach_accept->presencemask |= ATTACH_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_PRESENT;
break;
case ATTACH_ACCEPT_ADDITIONAL_UPDATE_RESULT_IEI:
if ((decoded_result =
decode_additional_update_result(&attach_accept->additionalupdateresult,
ATTACH_ACCEPT_ADDITIONAL_UPDATE_RESULT_IEI, buffer +
decoded, len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
attach_accept->presencemask |= ATTACH_ACCEPT_ADDITIONAL_UPDATE_RESULT_PRESENT;
break;
default:
errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI;
return TLV_DECODE_UNEXPECTED_IEI;
}
}
return decoded;
}
int encode_attach_accept(attach_accept_msg *attach_accept, uint8_t *buffer, uint32_t len)
{
int encoded = 0;
int encode_result = 0;
LOG_FUNC_IN;
/* Checking IEI and pointer */
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, ATTACH_ACCEPT_MINIMUM_LENGTH, len);
*(buffer + encoded) = (encode_u8_eps_attach_result(&attach_accept->epsattachresult) & 0x0f);
encoded++;
#warning "LG TEST override t3412value"
attach_accept->t3412value.unit = GPRS_TIMER_UNIT_360S;
attach_accept->t3412value.timervalue = 10;
if ((encode_result = encode_gprs_timer(&attach_accept->t3412value, 0, buffer
+ encoded, len - encoded)) < 0) { //Return in case of error
LOG_TRACE(WARNING, "Failed encode_gprs_timer");
LOG_FUNC_RETURN(encode_result);
} else
encoded += encode_result;
if ((encode_result =
encode_tracking_area_identity_list(&attach_accept->tailist, 0, buffer
+ encoded, len - encoded)) < 0) { //Return in case of error
LOG_TRACE(WARNING, "Failed encode_tracking_area_identity_list");
LOG_FUNC_RETURN(encode_result);
} else
encoded += encode_result;
if ((encode_result =
encode_esm_message_container(&attach_accept->esmmessagecontainer, 0,
buffer + encoded, len - encoded)) < 0) { //Return in case of error
LOG_TRACE(WARNING, "Failed encode_esm_message_container");
LOG_FUNC_RETURN(encode_result);
} else
encoded += encode_result;
if ((attach_accept->presencemask & ATTACH_ACCEPT_GUTI_PRESENT)
== ATTACH_ACCEPT_GUTI_PRESENT) {
if ((encode_result = encode_eps_mobile_identity(&attach_accept->guti,
ATTACH_ACCEPT_GUTI_IEI, buffer + encoded, len - encoded)) < 0) {
// Return in case of error
LOG_TRACE(WARNING, "Failed encode_eps_mobile_identity");
LOG_FUNC_RETURN(encode_result);
} else
encoded += encode_result;
}
if ((attach_accept->presencemask & ATTACH_ACCEPT_LOCATION_AREA_IDENTIFICATION_PRESENT)
== ATTACH_ACCEPT_LOCATION_AREA_IDENTIFICATION_PRESENT) {
if ((encode_result =
encode_location_area_identification(&attach_accept->locationareaidentification,
ATTACH_ACCEPT_LOCATION_AREA_IDENTIFICATION_IEI, buffer + encoded,
len - encoded)) < 0) {
LOG_TRACE(WARNING, "Failed encode_location_area_identification");
// Return in case of error
LOG_FUNC_RETURN(encode_result);
} else
encoded += encode_result;
}
if ((attach_accept->presencemask & ATTACH_ACCEPT_MS_IDENTITY_PRESENT)
== ATTACH_ACCEPT_MS_IDENTITY_PRESENT) {
if ((encode_result = encode_mobile_identity(&attach_accept->msidentity,
ATTACH_ACCEPT_MS_IDENTITY_IEI, buffer + encoded, len - encoded)) <
0) {
LOG_TRACE(WARNING, "Failed encode_mobile_identity");
// Return in case of error
LOG_FUNC_RETURN(encode_result);
} else
encoded += encode_result;
}
if ((attach_accept->presencemask & ATTACH_ACCEPT_EMM_CAUSE_PRESENT)
== ATTACH_ACCEPT_EMM_CAUSE_PRESENT) {
if ((encode_result = encode_emm_cause(&attach_accept->emmcause,
ATTACH_ACCEPT_EMM_CAUSE_IEI, buffer + encoded, len - encoded)) <
0) {
// Return in case of error
LOG_FUNC_RETURN(encode_result);
} else
encoded += encode_result;
}
#warning "LG TEST override t3402value"
attach_accept->presencemask |= ATTACH_ACCEPT_T3402_VALUE_PRESENT;
attach_accept->t3402value.unit = GPRS_TIMER_UNIT_60S;
attach_accept->t3402value.timervalue = 12;
if ((attach_accept->presencemask & ATTACH_ACCEPT_T3402_VALUE_PRESENT)
== ATTACH_ACCEPT_T3402_VALUE_PRESENT) {
if ((encode_result = encode_gprs_timer(&attach_accept->t3402value,
ATTACH_ACCEPT_T3402_VALUE_IEI, buffer + encoded, len - encoded)) <
0) {
LOG_TRACE(WARNING, "Failed encode_gprs_timer");
// Return in case of error
LOG_FUNC_RETURN(encode_result);
} else
encoded += encode_result;
}
if ((attach_accept->presencemask & ATTACH_ACCEPT_T3423_VALUE_PRESENT)
== ATTACH_ACCEPT_T3423_VALUE_PRESENT) {
if ((encode_result = encode_gprs_timer(&attach_accept->t3423value,
ATTACH_ACCEPT_T3423_VALUE_IEI, buffer + encoded, len - encoded)) <
0) {
LOG_TRACE(WARNING, "Failed encode_gprs_timer");
// Return in case of error
LOG_FUNC_RETURN(encode_result);
} else
encoded += encode_result;
}
if ((attach_accept->presencemask & ATTACH_ACCEPT_EQUIVALENT_PLMNS_PRESENT)
== ATTACH_ACCEPT_EQUIVALENT_PLMNS_PRESENT) {
if ((encode_result = encode_plmn_list(&attach_accept->equivalentplmns,
ATTACH_ACCEPT_EQUIVALENT_PLMNS_IEI, buffer + encoded, len -
encoded)) < 0) {
LOG_TRACE(WARNING, "Failed encode_plmn_list");
// Return in case of error
LOG_FUNC_RETURN(encode_result);
} else
encoded += encode_result;
}
if ((attach_accept->presencemask & ATTACH_ACCEPT_EMERGENCY_NUMBER_LIST_PRESENT)
== ATTACH_ACCEPT_EMERGENCY_NUMBER_LIST_PRESENT) {
if ((encode_result =
encode_emergency_number_list(&attach_accept->emergencynumberlist,
ATTACH_ACCEPT_EMERGENCY_NUMBER_LIST_IEI, buffer + encoded, len -
encoded)) < 0) {
LOG_TRACE(WARNING, "Failed encode_emergency_number_list");
// Return in case of error
LOG_FUNC_RETURN(encode_result);
} else
encoded += encode_result;
}
if ((attach_accept->presencemask & ATTACH_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_PRESENT)
== ATTACH_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_PRESENT) {
if ((encode_result =
encode_eps_network_feature_support(&attach_accept->epsnetworkfeaturesupport,
ATTACH_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_IEI, buffer + encoded,
len - encoded)) < 0) {
LOG_TRACE(WARNING, "Failed encode_eps_network_feature_support");
// Return in case of error
LOG_FUNC_RETURN(encode_result);
} else
encoded += encode_result;
}
if ((attach_accept->presencemask & ATTACH_ACCEPT_ADDITIONAL_UPDATE_RESULT_PRESENT)
== ATTACH_ACCEPT_ADDITIONAL_UPDATE_RESULT_PRESENT) {
if ((encode_result =
encode_additional_update_result(&attach_accept->additionalupdateresult,
ATTACH_ACCEPT_ADDITIONAL_UPDATE_RESULT_IEI, buffer + encoded, len
- encoded)) < 0) {
LOG_TRACE(WARNING, "Failed encode_additional_update_result");
// Return in case of error
LOG_FUNC_RETURN(encode_result);
} else
encoded += encode_result;
}
LOG_FUNC_RETURN(encoded);
}
@@ -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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "ProtocolDiscriminator.h"
#include "SecurityHeaderType.h"
#include "MessageType.h"
#include "EpsAttachResult.h"
#include "GprsTimer.h"
#include "TrackingAreaIdentityList.h"
#include "EsmMessageContainer.h"
#include "EpsMobileIdentity.h"
#include "LocationAreaIdentification.h"
#include "MobileIdentity.h"
#include "EmmCause.h"
#include "PlmnList.h"
#include "EmergencyNumberList.h"
#include "EpsNetworkFeatureSupport.h"
#include "AdditionalUpdateResult.h"
#ifndef ATTACH_ACCEPT_H_
#define ATTACH_ACCEPT_H_
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define ATTACH_ACCEPT_MINIMUM_LENGTH ( \
EPS_ATTACH_RESULT_MINIMUM_LENGTH + \
GPRS_TIMER_MINIMUM_LENGTH + \
TRACKING_AREA_IDENTITY_LIST_MINIMUM_LENGTH + \
ESM_MESSAGE_CONTAINER_MINIMUM_LENGTH )
/* Maximum length macro. Formed by maximum length of each field */
#define ATTACH_ACCEPT_MAXIMUM_LENGTH ( \
EPS_ATTACH_RESULT_MAXIMUM_LENGTH + \
GPRS_TIMER_MAXIMUM_LENGTH + \
TRACKING_AREA_IDENTITY_LIST_MAXIMUM_LENGTH + \
ESM_MESSAGE_CONTAINER_MAXIMUM_LENGTH + \
EPS_MOBILE_IDENTITY_MAXIMUM_LENGTH + \
LOCATION_AREA_IDENTIFICATION_MAXIMUM_LENGTH + \
MOBILE_IDENTITY_MAXIMUM_LENGTH + \
EMM_CAUSE_MAXIMUM_LENGTH + \
GPRS_TIMER_MAXIMUM_LENGTH + \
GPRS_TIMER_MAXIMUM_LENGTH + \
PLMN_LIST_MAXIMUM_LENGTH + \
EMERGENCY_NUMBER_LIST_MAXIMUM_LENGTH + \
EPS_NETWORK_FEATURE_SUPPORT_MAXIMUM_LENGTH + \
ADDITIONAL_UPDATE_RESULT_MAXIMUM_LENGTH )
/* If an optional value is present and should be encoded, the corresponding
* Bit mask should be set to 1.
*/
# define ATTACH_ACCEPT_GUTI_PRESENT (1<<0)
# define ATTACH_ACCEPT_LOCATION_AREA_IDENTIFICATION_PRESENT (1<<1)
# define ATTACH_ACCEPT_MS_IDENTITY_PRESENT (1<<2)
# define ATTACH_ACCEPT_EMM_CAUSE_PRESENT (1<<3)
# define ATTACH_ACCEPT_T3402_VALUE_PRESENT (1<<4)
# define ATTACH_ACCEPT_T3423_VALUE_PRESENT (1<<5)
# define ATTACH_ACCEPT_EQUIVALENT_PLMNS_PRESENT (1<<6)
# define ATTACH_ACCEPT_EMERGENCY_NUMBER_LIST_PRESENT (1<<7)
# define ATTACH_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_PRESENT (1<<8)
# define ATTACH_ACCEPT_ADDITIONAL_UPDATE_RESULT_PRESENT (1<<9)
typedef enum attach_accept_iei_tag {
ATTACH_ACCEPT_GUTI_IEI = 0x50, /* 0x50 = 80 */
ATTACH_ACCEPT_LOCATION_AREA_IDENTIFICATION_IEI = 0x13, /* 0x13 = 19 */
ATTACH_ACCEPT_MS_IDENTITY_IEI = 0x23, /* 0x23 = 35 */
ATTACH_ACCEPT_EMM_CAUSE_IEI = 0x53, /* 0x53 = 83 */
ATTACH_ACCEPT_T3402_VALUE_IEI = 0x17, /* 0x17 = 23 */
ATTACH_ACCEPT_T3423_VALUE_IEI = 0x59, /* 0x59 = 89 */
ATTACH_ACCEPT_EQUIVALENT_PLMNS_IEI = 0x4A, /* 0x4A = 74 */
ATTACH_ACCEPT_EMERGENCY_NUMBER_LIST_IEI = 0x34, /* 0x34 = 52 */
ATTACH_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_IEI = 0x64, /* 0x64 = 100 */
ATTACH_ACCEPT_ADDITIONAL_UPDATE_RESULT_IEI = 0xF0, /* 0xF0 = 240 */
} attach_accept_iei;
/*
* Message name: Attach accept
* Description: This message is sent by the network to the UE to indicate that the corresponding attach request has been accepted. See table 8.2.1.1.
* Significance: dual
* Direction: network to UE
*/
typedef struct attach_accept_msg_tag {
/* Mandatory fields */
ProtocolDiscriminator protocoldiscriminator:4;
SecurityHeaderType securityheadertype:4;
MessageType messagetype;
EpsAttachResult epsattachresult;
GprsTimer t3412value;
TrackingAreaIdentityList tailist;
EsmMessageContainer esmmessagecontainer;
/* Optional fields */
uint32_t presencemask;
EpsMobileIdentity guti;
LocationAreaIdentification locationareaidentification;
MobileIdentity msidentity;
EmmCause emmcause;
GprsTimer t3402value;
GprsTimer t3423value;
PlmnList equivalentplmns;
EmergencyNumberList emergencynumberlist;
EpsNetworkFeatureSupport epsnetworkfeaturesupport;
AdditionalUpdateResult additionalupdateresult;
} attach_accept_msg;
int decode_attach_accept(attach_accept_msg *attachaccept, uint8_t *buffer, uint32_t len);
int encode_attach_accept(attach_accept_msg *attachaccept, uint8_t *buffer, uint32_t len);
#endif /* ! defined(ATTACH_ACCEPT_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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "AttachComplete.h"
int decode_attach_complete(attach_complete_msg *attach_complete, uint8_t *buffer, uint32_t len)
{
uint32_t decoded = 0;
int decoded_result = 0;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, ATTACH_COMPLETE_MINIMUM_LENGTH, len);
/* Decoding mandatory fields */
if ((decoded_result = decode_esm_message_container(&attach_complete->esmmessagecontainer, 0, buffer + decoded, len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
return decoded;
}
int encode_attach_complete(attach_complete_msg *attach_complete, uint8_t *buffer, uint32_t len)
{
int encoded = 0;
int encode_result = 0;
/* Checking IEI and pointer */
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, ATTACH_COMPLETE_MINIMUM_LENGTH, len);
if ((encode_result =
encode_esm_message_container(&attach_complete->esmmessagecontainer, 0,
buffer + encoded, len - encoded)) < 0) //Return in case of error
return encode_result;
else
encoded += encode_result;
return encoded;
}
@@ -0,0 +1,70 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "ProtocolDiscriminator.h"
#include "SecurityHeaderType.h"
#include "MessageType.h"
#include "EsmMessageContainer.h"
#ifndef ATTACH_COMPLETE_H_
#define ATTACH_COMPLETE_H_
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define ATTACH_COMPLETE_MINIMUM_LENGTH ( \
ESM_MESSAGE_CONTAINER_MINIMUM_LENGTH )
/* Maximum length macro. Formed by maximum length of each field */
#define ATTACH_COMPLETE_MAXIMUM_LENGTH ( \
ESM_MESSAGE_CONTAINER_MAXIMUM_LENGTH )
/*
* Message name: Attach complete
* Description: This message is sent by the UE to the network in response to an ATTACH ACCEPT message. See table 8.2.2.1.
* Significance: dual
* Direction: UE to network
*/
typedef struct attach_complete_msg_tag {
/* Mandatory fields */
ProtocolDiscriminator protocoldiscriminator:4;
SecurityHeaderType securityheadertype:4;
MessageType messagetype;
EsmMessageContainer esmmessagecontainer;
} attach_complete_msg;
int decode_attach_complete(attach_complete_msg *attachcomplete, uint8_t *buffer, uint32_t len);
int encode_attach_complete(attach_complete_msg *attachcomplete, uint8_t *buffer, uint32_t len);
#endif /* ! defined(ATTACH_COMPLETE_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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "AttachReject.h"
int decode_attach_reject(attach_reject_msg *attach_reject, uint8_t *buffer, uint32_t len)
{
uint32_t decoded = 0;
int decoded_result = 0;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, ATTACH_REJECT_MINIMUM_LENGTH, len);
/* Decoding mandatory fields */
if ((decoded_result = decode_emm_cause(&attach_reject->emmcause, 0, buffer + decoded, len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
/* Decoding optional fields */
while(len - decoded > 0) {
uint8_t ieiDecoded = *(buffer + decoded);
/* Type | value iei are below 0x80 so just return the first 4 bits */
if (ieiDecoded >= 0x80)
ieiDecoded = ieiDecoded & 0xf0;
switch(ieiDecoded) {
case ATTACH_REJECT_ESM_MESSAGE_CONTAINER_IEI:
if ((decoded_result =
decode_esm_message_container(&attach_reject->esmmessagecontainer,
ATTACH_REJECT_ESM_MESSAGE_CONTAINER_IEI, buffer + decoded,
len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
attach_reject->presencemask |= ATTACH_REJECT_ESM_MESSAGE_CONTAINER_PRESENT;
break;
default:
errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI;
return TLV_DECODE_UNEXPECTED_IEI;
}
}
return decoded;
}
int encode_attach_reject(attach_reject_msg *attach_reject, uint8_t *buffer, uint32_t len)
{
int encoded = 0;
int encode_result = 0;
/* Checking IEI and pointer */
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, ATTACH_REJECT_MINIMUM_LENGTH, len);
if ((encode_result = encode_emm_cause(&attach_reject->emmcause, 0, buffer +
encoded, len - encoded)) < 0) //Return in case of error
return encode_result;
else
encoded += encode_result;
if ((attach_reject->presencemask & ATTACH_REJECT_ESM_MESSAGE_CONTAINER_PRESENT)
== ATTACH_REJECT_ESM_MESSAGE_CONTAINER_PRESENT) {
if ((encode_result =
encode_esm_message_container(&attach_reject->esmmessagecontainer,
ATTACH_REJECT_ESM_MESSAGE_CONTAINER_IEI, buffer + encoded, len -
encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
return encoded;
}
@@ -0,0 +1,83 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "ProtocolDiscriminator.h"
#include "SecurityHeaderType.h"
#include "MessageType.h"
#include "EmmCause.h"
#include "EsmMessageContainer.h"
#ifndef ATTACH_REJECT_H_
#define ATTACH_REJECT_H_
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define ATTACH_REJECT_MINIMUM_LENGTH ( \
EMM_CAUSE_MINIMUM_LENGTH )
/* Maximum length macro. Formed by maximum length of each field */
#define ATTACH_REJECT_MAXIMUM_LENGTH ( \
EMM_CAUSE_MAXIMUM_LENGTH + \
ESM_MESSAGE_CONTAINER_MAXIMUM_LENGTH )
/* If an optional value is present and should be encoded, the corresponding
* Bit mask should be set to 1.
*/
# define ATTACH_REJECT_ESM_MESSAGE_CONTAINER_PRESENT (1<<0)
typedef enum attach_reject_iei_tag {
ATTACH_REJECT_ESM_MESSAGE_CONTAINER_IEI = 0x78, /* 0x78 = 120 */
} attach_reject_iei;
/*
* Message name: Attach reject
* Description: This message is sent by the network to the UE to indicate that the corresponding attach request has been rejected. See table 8.2.3.1.
* Significance: dual
* Direction: network to UE
*/
typedef struct attach_reject_msg_tag {
/* Mandatory fields */
ProtocolDiscriminator protocoldiscriminator:4;
SecurityHeaderType securityheadertype:4;
MessageType messagetype;
EmmCause emmcause;
/* Optional fields */
uint32_t presencemask;
EsmMessageContainer esmmessagecontainer;
} attach_reject_msg;
int decode_attach_reject(attach_reject_msg *attachreject, uint8_t *buffer, uint32_t len);
int encode_attach_reject(attach_reject_msg *attachreject, uint8_t *buffer, uint32_t len);
#endif /* ! defined(ATTACH_REJECT_H_) */
@@ -0,0 +1,474 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "nas_log.h"
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "AttachRequest.h"
int decode_attach_request(attach_request_msg *attach_request, uint8_t *buffer, uint32_t len)
{
uint32_t decoded = 0;
int decoded_result = 0;
LOG_FUNC_IN;
LOG_TRACE(INFO, "EMM - attach_request len = %d",
len);
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, ATTACH_REQUEST_MINIMUM_LENGTH, len);
/* Decoding mandatory fields */
if ((decoded_result = decode_u8_eps_attach_type(&attach_request->epsattachtype, 0, *(buffer + decoded) & 0x0f, len - decoded)) < 0) {
// return decoded_result;
LOG_FUNC_RETURN(decoded_result);
}
if ((decoded_result = decode_u8_nas_key_set_identifier(&attach_request->naskeysetidentifier, 0, *(buffer + decoded) >> 4, len - decoded)) < 0) {
// return decoded_result;
LOG_FUNC_RETURN(decoded_result);
}
decoded++;
if ((decoded_result = decode_eps_mobile_identity(&attach_request->oldgutiorimsi, 0, buffer + decoded, len - decoded)) < 0) {
// return decoded_result;
LOG_FUNC_RETURN(decoded_result);
} else
decoded += decoded_result;
if ((decoded_result = decode_ue_network_capability(&attach_request->uenetworkcapability, 0, buffer + decoded, len - decoded)) < 0) {
// return decoded_result;
LOG_FUNC_RETURN(decoded_result);
} else
decoded += decoded_result;
if ((decoded_result = decode_esm_message_container(&attach_request->esmmessagecontainer, 0, buffer + decoded, len - decoded)) < 0) {
// return decoded_result;
LOG_FUNC_RETURN(decoded_result);
} else
decoded += decoded_result;
/* Decoding optional fields */
while(len - decoded > 0) {
uint8_t ieiDecoded = *(buffer + decoded);
/* Type | value iei are below 0x80 so just return the first 4 bits */
if (ieiDecoded >= 0x80)
ieiDecoded = ieiDecoded & 0xf0;
switch(ieiDecoded) {
case ATTACH_REQUEST_OLD_PTMSI_SIGNATURE_IEI:
if ((decoded_result =
decode_p_tmsi_signature(&attach_request->oldptmsisignature,
ATTACH_REQUEST_OLD_PTMSI_SIGNATURE_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_OLD_PTMSI_SIGNATURE_PRESENT;
break;
case ATTACH_REQUEST_ADDITIONAL_GUTI_IEI:
if ((decoded_result =
decode_eps_mobile_identity(&attach_request->additionalguti,
ATTACH_REQUEST_ADDITIONAL_GUTI_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_ADDITIONAL_GUTI_PRESENT;
break;
case ATTACH_REQUEST_LAST_VISITED_REGISTERED_TAI_IEI:
if ((decoded_result =
decode_tracking_area_identity(&attach_request->lastvisitedregisteredtai,
ATTACH_REQUEST_LAST_VISITED_REGISTERED_TAI_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_LAST_VISITED_REGISTERED_TAI_PRESENT;
break;
case ATTACH_REQUEST_DRX_PARAMETER_IEI:
if ((decoded_result =
decode_drx_parameter(&attach_request->drxparameter,
ATTACH_REQUEST_DRX_PARAMETER_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_DRX_PARAMETER_PRESENT;
break;
case ATTACH_REQUEST_MS_NETWORK_CAPABILITY_IEI:
if ((decoded_result =
decode_ms_network_capability(&attach_request->msnetworkcapability,
ATTACH_REQUEST_MS_NETWORK_CAPABILITY_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_CAPABILITY_PRESENT;
break;
case ATTACH_REQUEST_OLD_LOCATION_AREA_IDENTIFICATION_IEI:
if ((decoded_result =
decode_location_area_identification(&attach_request->oldlocationareaidentification,
ATTACH_REQUEST_OLD_LOCATION_AREA_IDENTIFICATION_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_OLD_LOCATION_AREA_IDENTIFICATION_PRESENT;
break;
case ATTACH_REQUEST_TMSI_STATUS_IEI:
if ((decoded_result =
decode_tmsi_status(&attach_request->tmsistatus,
ATTACH_REQUEST_TMSI_STATUS_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_TMSI_STATUS_PRESENT;
break;
case ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_2_IEI:
if ((decoded_result =
decode_mobile_station_classmark_2(&attach_request->mobilestationclassmark2,
ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_2_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_MOBILE_STATION_CLASSMARK_2_PRESENT;
break;
case ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_3_IEI:
if ((decoded_result =
decode_mobile_station_classmark_3(&attach_request->mobilestationclassmark3,
ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_3_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_MOBILE_STATION_CLASSMARK_3_PRESENT;
break;
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) {
// return decoded_result;
LOG_FUNC_RETURN(decoded_result);
}
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
attach_request->presencemask |= ATTACH_REQUEST_SUPPORTED_CODECS_PRESENT;
break;
case ATTACH_REQUEST_ADDITIONAL_UPDATE_TYPE_IEI:
if ((decoded_result =
decode_additional_update_type(&attach_request->additionalupdatetype,
ATTACH_REQUEST_ADDITIONAL_UPDATE_TYPE_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_ADDITIONAL_UPDATE_TYPE_PRESENT;
break;
case ATTACH_REQUEST_OLD_GUTI_TYPE_IEI:
if ((decoded_result =
decode_guti_type(&attach_request->oldgutitype,
ATTACH_REQUEST_OLD_GUTI_TYPE_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_OLD_GUTI_TYPE_PRESENT;
break;
case ATTACH_REQUEST_VOICE_DOMAIN_PREFERENCE_AND_UE_USAGE_SETTING_IEI:
if ((decoded_result =
decode_voice_domain_preference_and_ue_usage_setting(&attach_request->voicedomainpreferenceandueusagesetting,
ATTACH_REQUEST_VOICE_DOMAIN_PREFERENCE_AND_UE_USAGE_SETTING_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_VOICE_DOMAIN_PREFERENCE_AND_UE_USAGE_SETTING_PRESENT;
break;
default:
errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI;
{
// return TLV_DECODE_UNEXPECTED_IEI;
LOG_FUNC_RETURN(TLV_DECODE_UNEXPECTED_IEI);
}
}
}
LOG_FUNC_RETURN(decoded);
}
int encode_attach_request(attach_request_msg *attach_request, uint8_t *buffer, uint32_t len)
{
int encoded = 0;
int encode_result = 0;
/* Checking IEI and pointer */
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, ATTACH_REQUEST_MINIMUM_LENGTH, len);
*(buffer + encoded) = ((encode_u8_nas_key_set_identifier(&attach_request->naskeysetidentifier) & 0x0f) << 4) | (encode_u8_eps_attach_type(&attach_request->epsattachtype) & 0x0f);
encoded++;
if ((encode_result =
encode_eps_mobile_identity(&attach_request->oldgutiorimsi, 0, buffer +
encoded, len - encoded)) < 0) //Return in case of error
return encode_result;
else
encoded += encode_result;
if ((encode_result =
encode_ue_network_capability(&attach_request->uenetworkcapability, 0,
buffer + encoded, len - encoded)) < 0) //Return in case of error
return encode_result;
else
encoded += encode_result;
if ((encode_result =
encode_esm_message_container(&attach_request->esmmessagecontainer, 0,
buffer + encoded, len - encoded)) < 0) //Return in case of error
return encode_result;
else
encoded += encode_result;
if ((attach_request->presencemask & ATTACH_REQUEST_OLD_PTMSI_SIGNATURE_PRESENT)
== ATTACH_REQUEST_OLD_PTMSI_SIGNATURE_PRESENT) {
if ((encode_result =
encode_p_tmsi_signature(&attach_request->oldptmsisignature,
ATTACH_REQUEST_OLD_PTMSI_SIGNATURE_IEI, buffer + encoded, len -
encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((attach_request->presencemask & ATTACH_REQUEST_ADDITIONAL_GUTI_PRESENT)
== ATTACH_REQUEST_ADDITIONAL_GUTI_PRESENT) {
if ((encode_result =
encode_eps_mobile_identity(&attach_request->additionalguti,
ATTACH_REQUEST_ADDITIONAL_GUTI_IEI, buffer + encoded, len -
encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((attach_request->presencemask & ATTACH_REQUEST_LAST_VISITED_REGISTERED_TAI_PRESENT)
== ATTACH_REQUEST_LAST_VISITED_REGISTERED_TAI_PRESENT) {
if ((encode_result =
encode_tracking_area_identity(&attach_request->lastvisitedregisteredtai,
ATTACH_REQUEST_LAST_VISITED_REGISTERED_TAI_IEI, buffer + encoded,
len - encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((attach_request->presencemask & ATTACH_REQUEST_DRX_PARAMETER_PRESENT)
== ATTACH_REQUEST_DRX_PARAMETER_PRESENT) {
if ((encode_result = encode_drx_parameter(&attach_request->drxparameter,
ATTACH_REQUEST_DRX_PARAMETER_IEI, buffer + encoded, len -
encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((attach_request->presencemask & ATTACH_REQUEST_MS_NETWORK_CAPABILITY_PRESENT)
== ATTACH_REQUEST_MS_NETWORK_CAPABILITY_PRESENT) {
if ((encode_result =
encode_ms_network_capability(&attach_request->msnetworkcapability,
ATTACH_REQUEST_MS_NETWORK_CAPABILITY_IEI, buffer + encoded, len -
encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((attach_request->presencemask & ATTACH_REQUEST_OLD_LOCATION_AREA_IDENTIFICATION_PRESENT)
== ATTACH_REQUEST_OLD_LOCATION_AREA_IDENTIFICATION_PRESENT) {
if ((encode_result =
encode_location_area_identification(&attach_request->oldlocationareaidentification,
ATTACH_REQUEST_OLD_LOCATION_AREA_IDENTIFICATION_IEI, buffer +
encoded, len - encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((attach_request->presencemask & ATTACH_REQUEST_TMSI_STATUS_PRESENT)
== ATTACH_REQUEST_TMSI_STATUS_PRESENT) {
if ((encode_result = encode_tmsi_status(&attach_request->tmsistatus,
ATTACH_REQUEST_TMSI_STATUS_IEI, buffer + encoded, len - encoded))
< 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((attach_request->presencemask & ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_2_PRESENT)
== ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_2_PRESENT) {
if ((encode_result =
encode_mobile_station_classmark_2(&attach_request->mobilestationclassmark2,
ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_2_IEI, buffer + encoded,
len - encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((attach_request->presencemask & ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_3_PRESENT)
== ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_3_PRESENT) {
if ((encode_result =
encode_mobile_station_classmark_3(&attach_request->mobilestationclassmark3,
ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_3_IEI, buffer + encoded,
len - encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((attach_request->presencemask & ATTACH_REQUEST_SUPPORTED_CODECS_PRESENT)
== ATTACH_REQUEST_SUPPORTED_CODECS_PRESENT) {
if ((encode_result =
encode_supported_codec_list(&attach_request->supportedcodecs,
ATTACH_REQUEST_SUPPORTED_CODECS_IEI, buffer + encoded, len -
encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((attach_request->presencemask & ATTACH_REQUEST_ADDITIONAL_UPDATE_TYPE_PRESENT)
== ATTACH_REQUEST_ADDITIONAL_UPDATE_TYPE_PRESENT) {
if ((encode_result =
encode_additional_update_type(&attach_request->additionalupdatetype,
ATTACH_REQUEST_ADDITIONAL_UPDATE_TYPE_IEI, buffer + encoded, len -
encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((attach_request->presencemask & ATTACH_REQUEST_OLD_GUTI_TYPE_PRESENT)
== ATTACH_REQUEST_OLD_GUTI_TYPE_PRESENT) {
if ((encode_result =
encode_guti_type(&attach_request->oldgutitype,
ATTACH_REQUEST_OLD_GUTI_TYPE_IEI,
buffer + encoded, len - encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((attach_request->presencemask & ATTACH_REQUEST_VOICE_DOMAIN_PREFERENCE_AND_UE_USAGE_SETTING_PRESENT)
== ATTACH_REQUEST_VOICE_DOMAIN_PREFERENCE_AND_UE_USAGE_SETTING_PRESENT) {
if ((encode_result =
encode_voice_domain_preference_and_ue_usage_setting(&attach_request->voicedomainpreferenceandueusagesetting,
ATTACH_REQUEST_VOICE_DOMAIN_PREFERENCE_AND_UE_USAGE_SETTING_IEI,
buffer + encoded, len - encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
return encoded;
}
@@ -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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "ProtocolDiscriminator.h"
#include "SecurityHeaderType.h"
#include "MessageType.h"
#include "EpsAttachType.h"
#include "NasKeySetIdentifier.h"
#include "EpsMobileIdentity.h"
#include "UeNetworkCapability.h"
#include "EsmMessageContainer.h"
#include "PTmsiSignature.h"
#include "TrackingAreaIdentity.h"
#include "DrxParameter.h"
#include "MsNetworkCapability.h"
#include "LocationAreaIdentification.h"
#include "TmsiStatus.h"
#include "MobileStationClassmark2.h"
#include "MobileStationClassmark3.h"
#include "SupportedCodecList.h"
#include "AdditionalUpdateType.h"
#include "GutiType.h"
#include "VoiceDomainPreferenceAndUeUsageSetting.h"
#ifndef ATTACH_REQUEST_H_
#define ATTACH_REQUEST_H_
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define ATTACH_REQUEST_MINIMUM_LENGTH ( \
EPS_ATTACH_TYPE_MINIMUM_LENGTH + \
NAS_KEY_SET_IDENTIFIER_MINIMUM_LENGTH + \
EPS_MOBILE_IDENTITY_MINIMUM_LENGTH + \
UE_NETWORK_CAPABILITY_MINIMUM_LENGTH + \
ESM_MESSAGE_CONTAINER_MINIMUM_LENGTH )
/* Maximum length macro. Formed by maximum length of each field */
#define ATTACH_REQUEST_MAXIMUM_LENGTH ( \
EPS_ATTACH_TYPE_MAXIMUM_LENGTH + \
NAS_KEY_SET_IDENTIFIER_MAXIMUM_LENGTH + \
EPS_MOBILE_IDENTITY_MAXIMUM_LENGTH + \
UE_NETWORK_CAPABILITY_MAXIMUM_LENGTH + \
ESM_MESSAGE_CONTAINER_MAXIMUM_LENGTH + \
P_TMSI_SIGNATURE_MAXIMUM_LENGTH + \
EPS_MOBILE_IDENTITY_MAXIMUM_LENGTH + \
TRACKING_AREA_IDENTITY_MAXIMUM_LENGTH + \
DRX_PARAMETER_MAXIMUM_LENGTH + \
MS_NETWORK_CAPABILITY_MAXIMUM_LENGTH + \
LOCATION_AREA_IDENTIFICATION_MAXIMUM_LENGTH + \
TMSI_STATUS_MAXIMUM_LENGTH + \
MOBILE_STATION_CLASSMARK_2_MAXIMUM_LENGTH + \
MOBILE_STATION_CLASSMARK_3_MAXIMUM_LENGTH + \
SUPPORTED_CODEC_LIST_MAXIMUM_LENGTH + \
ADDITIONAL_UPDATE_TYPE_MAXIMUM_LENGTH + \
GUTI_TYPE_MAXIMUM_LENGTH )
/* If an optional value is present and should be encoded, the corresponding
* Bit mask should be set to 1.
*/
# define ATTACH_REQUEST_OLD_PTMSI_SIGNATURE_PRESENT (1<<0)
# define ATTACH_REQUEST_ADDITIONAL_GUTI_PRESENT (1<<1)
# define ATTACH_REQUEST_LAST_VISITED_REGISTERED_TAI_PRESENT (1<<2)
# define ATTACH_REQUEST_DRX_PARAMETER_PRESENT (1<<3)
# define ATTACH_REQUEST_MS_NETWORK_CAPABILITY_PRESENT (1<<4)
# define ATTACH_REQUEST_OLD_LOCATION_AREA_IDENTIFICATION_PRESENT (1<<5)
# define ATTACH_REQUEST_TMSI_STATUS_PRESENT (1<<6)
# define ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_2_PRESENT (1<<7)
# define ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_3_PRESENT (1<<8)
# define ATTACH_REQUEST_SUPPORTED_CODECS_PRESENT (1<<9)
# 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)
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_CAPABILITY_IEI = 0x31, /* 0x31 = 49 */
ATTACH_REQUEST_OLD_LOCATION_AREA_IDENTIFICATION_IEI = 0x13, /* 0x13 = 19 */
ATTACH_REQUEST_TMSI_STATUS_IEI = 0x90, /* 0x90 = 144 */
ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_2_IEI = 0x11, /* 0x11 = 17 */
ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_3_IEI = 0x20, /* 0x20 = 32 */
ATTACH_REQUEST_SUPPORTED_CODECS_IEI = 0x40, /* 0x40 = 64 */
ATTACH_REQUEST_ADDITIONAL_UPDATE_TYPE_IEI = 0xF0, /* 0xF0 = 240 */
ATTACH_REQUEST_OLD_GUTI_TYPE_IEI = 0xE0, /* 0xE0 = 224 */
ATTACH_REQUEST_VOICE_DOMAIN_PREFERENCE_AND_UE_USAGE_SETTING_IEI = 0x5D, /* 0x5D = 93 */
} attach_request_iei;
/*
* Message name: Attach request
* Description: This message is sent by the UE to the network in order to perform an attach procedure. See table 8.2.4.1.
* Significance: dual
* Direction: UE to network
*/
typedef struct attach_request_msg_tag {
/* Mandatory fields */
ProtocolDiscriminator protocoldiscriminator:4;
SecurityHeaderType securityheadertype:4;
MessageType messagetype;
EpsAttachType epsattachtype;
NasKeySetIdentifier naskeysetidentifier;
EpsMobileIdentity oldgutiorimsi;
UeNetworkCapability uenetworkcapability;
EsmMessageContainer esmmessagecontainer;
/* Optional fields */
uint32_t presencemask;
PTmsiSignature oldptmsisignature;
EpsMobileIdentity additionalguti;
TrackingAreaIdentity lastvisitedregisteredtai;
DrxParameter drxparameter;
MsNetworkCapability msnetworkcapability;
LocationAreaIdentification oldlocationareaidentification;
TmsiStatus tmsistatus;
MobileStationClassmark2 mobilestationclassmark2;
MobileStationClassmark3 mobilestationclassmark3;
SupportedCodecList supportedcodecs;
AdditionalUpdateType additionalupdatetype;
GutiType oldgutitype;
VoiceDomainPreferenceAndUeUsageSetting voicedomainpreferenceandueusagesetting;
} attach_request_msg;
int decode_attach_request(attach_request_msg *attachrequest, uint8_t *buffer, uint32_t len);
int encode_attach_request(attach_request_msg *attachrequest, uint8_t *buffer, uint32_t len);
#endif /* ! defined(ATTACH_REQUEST_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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "AuthenticationFailure.h"
int decode_authentication_failure(authentication_failure_msg *authentication_failure, uint8_t *buffer, uint32_t len)
{
uint32_t decoded = 0;
int decoded_result = 0;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, AUTHENTICATION_FAILURE_MINIMUM_LENGTH, len);
/* Decoding mandatory fields */
if ((decoded_result = decode_emm_cause(&authentication_failure->emmcause, 0, buffer + decoded, len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
/* Decoding optional fields */
while(len - decoded > 0) {
uint8_t ieiDecoded = *(buffer + decoded);
/* Type | value iei are below 0x80 so just return the first 4 bits */
if (ieiDecoded >= 0x80)
ieiDecoded = ieiDecoded & 0xf0;
switch(ieiDecoded) {
case AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_IEI:
if ((decoded_result =
decode_authentication_failure_parameter(&authentication_failure->authenticationfailureparameter,
AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_IEI,
buffer + decoded, len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
authentication_failure->presencemask |= AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_PRESENT;
break;
default:
errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI;
return TLV_DECODE_UNEXPECTED_IEI;
}
}
return decoded;
}
int encode_authentication_failure(authentication_failure_msg *authentication_failure, uint8_t *buffer, uint32_t len)
{
int encoded = 0;
int encode_result = 0;
/* Checking IEI and pointer */
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, AUTHENTICATION_FAILURE_MINIMUM_LENGTH, len);
if ((encode_result = encode_emm_cause(&authentication_failure->emmcause, 0,
buffer + encoded, len - encoded)) < 0) //Return in case of error
return encode_result;
else
encoded += encode_result;
if ((authentication_failure->presencemask & AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_PRESENT)
== AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_PRESENT) {
if ((encode_result =
encode_authentication_failure_parameter(&authentication_failure->authenticationfailureparameter,
AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_IEI,
buffer + encoded, len - encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
return encoded;
}
@@ -0,0 +1,83 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "ProtocolDiscriminator.h"
#include "SecurityHeaderType.h"
#include "MessageType.h"
#include "EmmCause.h"
#include "AuthenticationFailureParameter.h"
#ifndef AUTHENTICATION_FAILURE_H_
#define AUTHENTICATION_FAILURE_H_
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define AUTHENTICATION_FAILURE_MINIMUM_LENGTH ( \
EMM_CAUSE_MINIMUM_LENGTH )
/* Maximum length macro. Formed by maximum length of each field */
#define AUTHENTICATION_FAILURE_MAXIMUM_LENGTH ( \
EMM_CAUSE_MAXIMUM_LENGTH + \
AUTHENTICATION_FAILURE_PARAMETER_MAXIMUM_LENGTH )
/* If an optional value is present and should be encoded, the corresponding
* Bit mask should be set to 1.
*/
# define AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_PRESENT (1<<0)
typedef enum authentication_failure_iei_tag {
AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_IEI = 0x30, /* 0x30 = 48 */
} authentication_failure_iei;
/*
* Message name: Authentication failure
* Description: This message is sent by the UE to the network to indicate that authentication of the network has failed. See table 8.2.5.1.
* Significance: dual
* Direction: UE to network
*/
typedef struct authentication_failure_msg_tag {
/* Mandatory fields */
ProtocolDiscriminator protocoldiscriminator:4;
SecurityHeaderType securityheadertype:4;
MessageType messagetype;
EmmCause emmcause;
/* Optional fields */
uint32_t presencemask;
AuthenticationFailureParameter authenticationfailureparameter;
} authentication_failure_msg;
int decode_authentication_failure(authentication_failure_msg *authenticationfailure, uint8_t *buffer, uint32_t len);
int encode_authentication_failure(authentication_failure_msg *authenticationfailure, uint8_t *buffer, uint32_t len);
#endif /* ! defined(AUTHENTICATION_FAILURE_H_) */
@@ -0,0 +1,57 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "AuthenticationReject.h"
int decode_authentication_reject(authentication_reject_msg *authentication_reject, uint8_t *buffer, uint32_t len)
{
uint32_t decoded = 0;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, AUTHENTICATION_REJECT_MINIMUM_LENGTH, len);
/* Decoding mandatory fields */
return decoded;
}
int encode_authentication_reject(authentication_reject_msg *authentication_reject, uint8_t *buffer, uint32_t len)
{
int encoded = 0;
/* Checking IEI and pointer */
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, AUTHENTICATION_REJECT_MINIMUM_LENGTH, len);
return encoded;
}
@@ -0,0 +1,65 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "ProtocolDiscriminator.h"
#include "SecurityHeaderType.h"
#include "MessageType.h"
#ifndef AUTHENTICATION_REJECT_H_
#define AUTHENTICATION_REJECT_H_
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define AUTHENTICATION_REJECT_MINIMUM_LENGTH (0)
/* Maximum length macro. Formed by maximum length of each field */
#define AUTHENTICATION_REJECT_MAXIMUM_LENGTH (0)
/*
* Message name: Authentication reject
* Description: This 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. See table 8.2.6.1.
* Significance: dual
* Direction: network to UE
*/
typedef struct authentication_reject_msg_tag {
/* Mandatory fields */
ProtocolDiscriminator protocoldiscriminator:4;
SecurityHeaderType securityheadertype:4;
MessageType messagetype;
} authentication_reject_msg;
int decode_authentication_reject(authentication_reject_msg *authenticationreject, uint8_t *buffer, uint32_t len);
int encode_authentication_reject(authentication_reject_msg *authenticationreject, uint8_t *buffer, uint32_t len);
#endif /* ! defined(AUTHENTICATION_REJECT_H_) */
@@ -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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "AuthenticationRequest.h"
int decode_authentication_request(authentication_request_msg *authentication_request, uint8_t *buffer, uint32_t len)
{
uint32_t decoded = 0;
int decoded_result = 0;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, AUTHENTICATION_REQUEST_MINIMUM_LENGTH, len);
/* Decoding mandatory fields */
if ((decoded_result = decode_u8_nas_key_set_identifier(&authentication_request->naskeysetidentifierasme, 0, *(buffer + decoded) >> 4, len - decoded)) < 0)
return decoded_result;
decoded++;
if ((decoded_result = decode_authentication_parameter_rand(&authentication_request->authenticationparameterrand, 0, buffer + decoded, len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
if ((decoded_result = decode_authentication_parameter_autn(&authentication_request->authenticationparameterautn, 0, buffer + decoded, len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
return decoded;
}
int encode_authentication_request(authentication_request_msg *authentication_request, uint8_t *buffer, uint32_t len)
{
int encoded = 0;
int encode_result = 0;
/* Checking IEI and pointer */
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, AUTHENTICATION_REQUEST_MINIMUM_LENGTH, len);
*(buffer + encoded) = ((encode_u8_nas_key_set_identifier(&authentication_request->naskeysetidentifierasme) & 0x0f) << 4) | 0x00;
encoded++;
if ((encode_result =
encode_authentication_parameter_rand(&authentication_request->authenticationparameterrand,
0, buffer + encoded, len - encoded)) < 0) //Return in case of error
return encode_result;
else
encoded += encode_result;
if ((encode_result =
encode_authentication_parameter_autn(&authentication_request->authenticationparameterautn,
0, buffer + encoded, len - encoded)) < 0) //Return in case of error
return encode_result;
else
encoded += encode_result;
return encoded;
}
@@ -0,0 +1,78 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "ProtocolDiscriminator.h"
#include "SecurityHeaderType.h"
#include "MessageType.h"
#include "NasKeySetIdentifier.h"
#include "AuthenticationParameterRand.h"
#include "AuthenticationParameterAutn.h"
#ifndef AUTHENTICATION_REQUEST_H_
#define AUTHENTICATION_REQUEST_H_
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define AUTHENTICATION_REQUEST_MINIMUM_LENGTH ( \
NAS_KEY_SET_IDENTIFIER_MINIMUM_LENGTH + \
AUTHENTICATION_PARAMETER_RAND_MINIMUM_LENGTH + \
AUTHENTICATION_PARAMETER_AUTN_MINIMUM_LENGTH )
/* Maximum length macro. Formed by maximum length of each field */
#define AUTHENTICATION_REQUEST_MAXIMUM_LENGTH ( \
NAS_KEY_SET_IDENTIFIER_MAXIMUM_LENGTH + \
AUTHENTICATION_PARAMETER_RAND_MAXIMUM_LENGTH + \
AUTHENTICATION_PARAMETER_AUTN_MAXIMUM_LENGTH )
/*
* Message name: Authentication request
* Description: This message is sent by the network to the UE to initiate authentication of the UE identity. See table 8.2.7.1.
* Significance: dual
* Direction: network to UE
*/
typedef struct authentication_request_msg_tag {
/* Mandatory fields */
ProtocolDiscriminator protocoldiscriminator:4;
SecurityHeaderType securityheadertype:4;
MessageType messagetype;
NasKeySetIdentifier naskeysetidentifierasme;
AuthenticationParameterRand authenticationparameterrand;
AuthenticationParameterAutn authenticationparameterautn;
} authentication_request_msg;
int decode_authentication_request(authentication_request_msg *authenticationrequest, uint8_t *buffer, uint32_t len);
int encode_authentication_request(authentication_request_msg *authenticationrequest, uint8_t *buffer, uint32_t len);
#endif /* ! defined(AUTHENTICATION_REQUEST_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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "AuthenticationResponse.h"
int decode_authentication_response(authentication_response_msg *authentication_response, uint8_t *buffer, uint32_t len)
{
uint32_t decoded = 0;
int decoded_result = 0;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, AUTHENTICATION_RESPONSE_MINIMUM_LENGTH, len);
/* Decoding mandatory fields */
if ((decoded_result = decode_authentication_response_parameter(&authentication_response->authenticationresponseparameter, 0, buffer + decoded, len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
return decoded;
}
int encode_authentication_response(authentication_response_msg *authentication_response, uint8_t *buffer, uint32_t len)
{
int encoded = 0;
int encode_result = 0;
/* Checking IEI and pointer */
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, AUTHENTICATION_RESPONSE_MINIMUM_LENGTH, len);
if ((encode_result =
encode_authentication_response_parameter(&authentication_response->authenticationresponseparameter,
0, buffer + encoded, len - encoded)) < 0) //Return in case of error
return encode_result;
else
encoded += encode_result;
return encoded;
}
@@ -0,0 +1,70 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "ProtocolDiscriminator.h"
#include "SecurityHeaderType.h"
#include "MessageType.h"
#include "AuthenticationResponseParameter.h"
#ifndef AUTHENTICATION_RESPONSE_H_
#define AUTHENTICATION_RESPONSE_H_
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define AUTHENTICATION_RESPONSE_MINIMUM_LENGTH ( \
AUTHENTICATION_RESPONSE_PARAMETER_MINIMUM_LENGTH )
/* Maximum length macro. Formed by maximum length of each field */
#define AUTHENTICATION_RESPONSE_MAXIMUM_LENGTH ( \
AUTHENTICATION_RESPONSE_PARAMETER_MAXIMUM_LENGTH )
/*
* Message name: Authentication response
* Description: This message is sent by the UE to the network to deliver a calculated authentication response to the network. See table 8.2.8.1.
* Significance: dual
* Direction: UE to network
*/
typedef struct authentication_response_msg_tag {
/* Mandatory fields */
ProtocolDiscriminator protocoldiscriminator:4;
SecurityHeaderType securityheadertype:4;
MessageType messagetype;
AuthenticationResponseParameter authenticationresponseparameter;
} authentication_response_msg;
int decode_authentication_response(authentication_response_msg *authenticationresponse, uint8_t *buffer, uint32_t len);
int encode_authentication_response(authentication_response_msg *authenticationresponse, uint8_t *buffer, uint32_t len);
#endif /* ! defined(AUTHENTICATION_RESPONSE_H_) */
+674
View File
@@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
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.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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 <http://www.gnu.org/licenses/>.
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:
<program> Copyright (C) <year> <name of author>
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
<http://www.gnu.org/licenses/>.
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
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
@@ -0,0 +1,181 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "CsServiceNotification.h"
int decode_cs_service_notification(cs_service_notification_msg *cs_service_notification, uint8_t *buffer, uint32_t len)
{
uint32_t decoded = 0;
int decoded_result = 0;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, CS_SERVICE_NOTIFICATION_MINIMUM_LENGTH, len);
/* Decoding mandatory fields */
if ((decoded_result = decode_paging_identity(&cs_service_notification->pagingidentity, 0, buffer + decoded, len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
/* Decoding optional fields */
while(len - decoded > 0) {
uint8_t ieiDecoded = *(buffer + decoded);
/* Type | value iei are below 0x80 so just return the first 4 bits */
if (ieiDecoded >= 0x80)
ieiDecoded = ieiDecoded & 0xf0;
switch(ieiDecoded) {
case CS_SERVICE_NOTIFICATION_CLI_IEI:
if ((decoded_result = decode_cli(&cs_service_notification->cli,
CS_SERVICE_NOTIFICATION_CLI_IEI, buffer + decoded, len -
decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
cs_service_notification->presencemask |= CS_SERVICE_NOTIFICATION_CLI_PRESENT;
break;
case CS_SERVICE_NOTIFICATION_SS_CODE_IEI:
if ((decoded_result =
decode_ss_code(&cs_service_notification->sscode,
CS_SERVICE_NOTIFICATION_SS_CODE_IEI, buffer + decoded, len
- decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
cs_service_notification->presencemask |= CS_SERVICE_NOTIFICATION_SS_CODE_PRESENT;
break;
case CS_SERVICE_NOTIFICATION_LCS_INDICATOR_IEI:
if ((decoded_result =
decode_lcs_indicator(&cs_service_notification->lcsindicator,
CS_SERVICE_NOTIFICATION_LCS_INDICATOR_IEI, buffer +
decoded, len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
cs_service_notification->presencemask |= CS_SERVICE_NOTIFICATION_LCS_INDICATOR_PRESENT;
break;
case CS_SERVICE_NOTIFICATION_LCS_CLIENT_IDENTITY_IEI:
if ((decoded_result =
decode_lcs_client_identity(&cs_service_notification->lcsclientidentity,
CS_SERVICE_NOTIFICATION_LCS_CLIENT_IDENTITY_IEI, buffer +
decoded, len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
cs_service_notification->presencemask |= CS_SERVICE_NOTIFICATION_LCS_CLIENT_IDENTITY_PRESENT;
break;
default:
errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI;
return TLV_DECODE_UNEXPECTED_IEI;
}
}
return decoded;
}
int encode_cs_service_notification(cs_service_notification_msg *cs_service_notification, uint8_t *buffer, uint32_t len)
{
int encoded = 0;
int encode_result = 0;
/* Checking IEI and pointer */
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, CS_SERVICE_NOTIFICATION_MINIMUM_LENGTH, len);
if ((encode_result =
encode_paging_identity(&cs_service_notification->pagingidentity, 0,
buffer + encoded, len - encoded)) < 0) //Return in case of error
return encode_result;
else
encoded += encode_result;
if ((cs_service_notification->presencemask & CS_SERVICE_NOTIFICATION_CLI_PRESENT)
== CS_SERVICE_NOTIFICATION_CLI_PRESENT) {
if ((encode_result = encode_cli(&cs_service_notification->cli,
CS_SERVICE_NOTIFICATION_CLI_IEI, buffer + encoded, len - encoded))
< 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((cs_service_notification->presencemask & CS_SERVICE_NOTIFICATION_SS_CODE_PRESENT)
== CS_SERVICE_NOTIFICATION_SS_CODE_PRESENT) {
if ((encode_result = encode_ss_code(&cs_service_notification->sscode,
CS_SERVICE_NOTIFICATION_SS_CODE_IEI, buffer + encoded, len -
encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((cs_service_notification->presencemask & CS_SERVICE_NOTIFICATION_LCS_INDICATOR_PRESENT)
== CS_SERVICE_NOTIFICATION_LCS_INDICATOR_PRESENT) {
if ((encode_result =
encode_lcs_indicator(&cs_service_notification->lcsindicator,
CS_SERVICE_NOTIFICATION_LCS_INDICATOR_IEI, buffer + encoded, len -
encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((cs_service_notification->presencemask & CS_SERVICE_NOTIFICATION_LCS_CLIENT_IDENTITY_PRESENT)
== CS_SERVICE_NOTIFICATION_LCS_CLIENT_IDENTITY_PRESENT) {
if ((encode_result =
encode_lcs_client_identity(&cs_service_notification->lcsclientidentity,
CS_SERVICE_NOTIFICATION_LCS_CLIENT_IDENTITY_IEI, buffer + encoded,
len - encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
return encoded;
}
@@ -0,0 +1,98 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "ProtocolDiscriminator.h"
#include "SecurityHeaderType.h"
#include "MessageType.h"
#include "PagingIdentity.h"
#include "Cli.h"
#include "SsCode.h"
#include "LcsIndicator.h"
#include "LcsClientIdentity.h"
#ifndef CS_SERVICE_NOTIFICATION_H_
#define CS_SERVICE_NOTIFICATION_H_
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define CS_SERVICE_NOTIFICATION_MINIMUM_LENGTH ( \
PAGING_IDENTITY_MINIMUM_LENGTH )
/* Maximum length macro. Formed by maximum length of each field */
#define CS_SERVICE_NOTIFICATION_MAXIMUM_LENGTH ( \
PAGING_IDENTITY_MAXIMUM_LENGTH + \
CLI_MAXIMUM_LENGTH + \
SS_CODE_MAXIMUM_LENGTH + \
LCS_INDICATOR_MAXIMUM_LENGTH + \
LCS_CLIENT_IDENTITY_MAXIMUM_LENGTH )
/* If an optional value is present and should be encoded, the corresponding
* Bit mask should be set to 1.
*/
# define CS_SERVICE_NOTIFICATION_CLI_PRESENT (1<<0)
# define CS_SERVICE_NOTIFICATION_SS_CODE_PRESENT (1<<1)
# define CS_SERVICE_NOTIFICATION_LCS_INDICATOR_PRESENT (1<<2)
# define CS_SERVICE_NOTIFICATION_LCS_CLIENT_IDENTITY_PRESENT (1<<3)
typedef enum cs_service_notification_iei_tag {
CS_SERVICE_NOTIFICATION_CLI_IEI = 0x60, /* 0x60 = 96 */
CS_SERVICE_NOTIFICATION_SS_CODE_IEI = 0x61, /* 0x61 = 97 */
CS_SERVICE_NOTIFICATION_LCS_INDICATOR_IEI = 0x62, /* 0x62 = 98 */
CS_SERVICE_NOTIFICATION_LCS_CLIENT_IDENTITY_IEI = 0x63, /* 0x63 = 99 */
} cs_service_notification_iei;
/*
* Message name: CS service notification
* Description: This message is sent by the network when a paging request with CS call indicator was received via SGs for a UE, and a NAS signalling connection is already established for the UE. See table 8.2.9.1.
* Significance: dual
* Direction: network to UE
*/
typedef struct cs_service_notification_msg_tag {
/* Mandatory fields */
ProtocolDiscriminator protocoldiscriminator:4;
SecurityHeaderType securityheadertype:4;
MessageType messagetype;
PagingIdentity pagingidentity;
/* Optional fields */
uint32_t presencemask;
Cli cli;
SsCode sscode;
LcsIndicator lcsindicator;
LcsClientIdentity lcsclientidentity;
} cs_service_notification_msg;
int decode_cs_service_notification(cs_service_notification_msg *csservicenotification, uint8_t *buffer, uint32_t len);
int encode_cs_service_notification(cs_service_notification_msg *csservicenotification, uint8_t *buffer, uint32_t len);
#endif /* ! defined(CS_SERVICE_NOTIFICATION_H_) */
@@ -0,0 +1,57 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "DetachAccept.h"
int decode_detach_accept(detach_accept_msg *detach_accept, uint8_t *buffer, uint32_t len)
{
uint32_t decoded = 0;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, DETACH_ACCEPT_MINIMUM_LENGTH, len);
/* Decoding mandatory fields */
return decoded;
}
int encode_detach_accept(detach_accept_msg *detach_accept, uint8_t *buffer, uint32_t len)
{
int encoded = 0;
/* Checking IEI and pointer */
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, DETACH_ACCEPT_MINIMUM_LENGTH, len);
return encoded;
}
@@ -0,0 +1,65 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "ProtocolDiscriminator.h"
#include "SecurityHeaderType.h"
#include "MessageType.h"
#ifndef DETACH_ACCEPT_H_
#define DETACH_ACCEPT_H_
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define DETACH_ACCEPT_MINIMUM_LENGTH (0)
/* Maximum length macro. Formed by maximum length of each field */
#define DETACH_ACCEPT_MAXIMUM_LENGTH (0)
/*
* Message name: Detach accept
* Description: This message is sent by the network to indicate that the detach procedure has been completed. See table 8.2.10.1.1.
* Significance: dual
* Direction: network to UE
*/
typedef struct detach_accept_msg_tag {
/* Mandatory fields */
ProtocolDiscriminator protocoldiscriminator:4;
SecurityHeaderType securityheadertype:4;
MessageType messagetype;
} detach_accept_msg;
int decode_detach_accept(detach_accept_msg *detachaccept, uint8_t *buffer, uint32_t len);
int encode_detach_accept(detach_accept_msg *detachaccept, uint8_t *buffer, uint32_t len);
#endif /* ! defined(DETACH_ACCEPT_H_) */
@@ -0,0 +1,83 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "DetachRequest.h"
int decode_detach_request(detach_request_msg *detach_request, uint8_t *buffer, uint32_t len)
{
uint32_t decoded = 0;
int decoded_result = 0;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, DETACH_REQUEST_MINIMUM_LENGTH, len);
/* Decoding mandatory fields */
if ((decoded_result = decode_u8_detach_type(&detach_request->detachtype, 0, *(buffer + decoded) & 0x0f, len - decoded)) < 0)
return decoded_result;
if ((decoded_result = decode_u8_nas_key_set_identifier(&detach_request->naskeysetidentifier, 0, *(buffer + decoded) >> 4, len - decoded)) < 0)
return decoded_result;
decoded++;
if ((decoded_result = decode_eps_mobile_identity(&detach_request->gutiorimsi, 0, buffer + decoded, len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
return decoded;
}
int encode_detach_request(detach_request_msg *detach_request, uint8_t *buffer, uint32_t len)
{
int encoded = 0;
int encode_result = 0;
/* Checking IEI and pointer */
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, DETACH_REQUEST_MINIMUM_LENGTH, len);
*(buffer + encoded) = ((encode_u8_nas_key_set_identifier(&detach_request->naskeysetidentifier) << 4) | (encode_u8_detach_type(&detach_request->detachtype) & 0x0f));
encoded++;
if ((encode_result = encode_eps_mobile_identity(&detach_request->gutiorimsi,
0, buffer + encoded, len - encoded)) < 0) //Return in case of error
return encode_result;
else
encoded += encode_result;
return encoded;
}
@@ -0,0 +1,78 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "ProtocolDiscriminator.h"
#include "SecurityHeaderType.h"
#include "MessageType.h"
#include "DetachType.h"
#include "NasKeySetIdentifier.h"
#include "EpsMobileIdentity.h"
#ifndef DETACH_REQUEST_H_
#define DETACH_REQUEST_H_
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define DETACH_REQUEST_MINIMUM_LENGTH ( \
DETACH_TYPE_MINIMUM_LENGTH + \
NAS_KEY_SET_IDENTIFIER_MINIMUM_LENGTH + \
EPS_MOBILE_IDENTITY_MINIMUM_LENGTH )
/* Maximum length macro. Formed by maximum length of each field */
#define DETACH_REQUEST_MAXIMUM_LENGTH ( \
DETACH_TYPE_MAXIMUM_LENGTH + \
NAS_KEY_SET_IDENTIFIER_MAXIMUM_LENGTH + \
EPS_MOBILE_IDENTITY_MAXIMUM_LENGTH )
/*
* Message name: Detach request
* Description: This message is sent by the UE to request the release of an EMM context. See table 8.2.11.1.1.
* Significance: dual
* Direction: UE to network
*/
typedef struct detach_request_msg_tag {
/* Mandatory fields */
ProtocolDiscriminator protocoldiscriminator:4;
SecurityHeaderType securityheadertype:4;
MessageType messagetype;
DetachType detachtype;
NasKeySetIdentifier naskeysetidentifier;
EpsMobileIdentity gutiorimsi;
} detach_request_msg;
int decode_detach_request(detach_request_msg *detachrequest, uint8_t *buffer, uint32_t len);
int encode_detach_request(detach_request_msg *detachrequest, uint8_t *buffer, uint32_t len);
#endif /* ! defined(DETACH_REQUEST_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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "DownlinkNasTransport.h"
int decode_downlink_nas_transport(downlink_nas_transport_msg *downlink_nas_transport, uint8_t *buffer, uint32_t len)
{
uint32_t decoded = 0;
int decoded_result = 0;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, DOWNLINK_NAS_TRANSPORT_MINIMUM_LENGTH, len);
/* Decoding mandatory fields */
if ((decoded_result = decode_nas_message_container(&downlink_nas_transport->nasmessagecontainer, 0, buffer + decoded, len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
return decoded;
}
int encode_downlink_nas_transport(downlink_nas_transport_msg *downlink_nas_transport, uint8_t *buffer, uint32_t len)
{
int encoded = 0;
int encode_result = 0;
/* Checking IEI and pointer */
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, DOWNLINK_NAS_TRANSPORT_MINIMUM_LENGTH, len);
if ((encode_result =
encode_nas_message_container(&downlink_nas_transport->nasmessagecontainer,
0, buffer + encoded, len - encoded)) < 0) //Return in case of error
return encode_result;
else
encoded += encode_result;
return encoded;
}
@@ -0,0 +1,70 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "ProtocolDiscriminator.h"
#include "SecurityHeaderType.h"
#include "MessageType.h"
#include "NasMessageContainer.h"
#ifndef DOWNLINK_NAS_TRANSPORT_H_
#define DOWNLINK_NAS_TRANSPORT_H_
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define DOWNLINK_NAS_TRANSPORT_MINIMUM_LENGTH ( \
NAS_MESSAGE_CONTAINER_MINIMUM_LENGTH )
/* Maximum length macro. Formed by maximum length of each field */
#define DOWNLINK_NAS_TRANSPORT_MAXIMUM_LENGTH ( \
NAS_MESSAGE_CONTAINER_MAXIMUM_LENGTH )
/*
* Message name: Downlink NAS Transport
* Description: This message is sent by the network to the UE in order to carry an SMS message in encapsulated format. See table 8.2.12.1.
* Significance: dual
* Direction: network to UE
*/
typedef struct downlink_nas_transport_msg_tag {
/* Mandatory fields */
ProtocolDiscriminator protocoldiscriminator:4;
SecurityHeaderType securityheadertype:4;
MessageType messagetype;
NasMessageContainer nasmessagecontainer;
} downlink_nas_transport_msg;
int decode_downlink_nas_transport(downlink_nas_transport_msg *downlinknastransport, uint8_t *buffer, uint32_t len);
int encode_downlink_nas_transport(downlink_nas_transport_msg *downlinknastransport, uint8_t *buffer, uint32_t len);
#endif /* ! defined(DOWNLINK_NAS_TRANSPORT_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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "EmmInformation.h"
int decode_emm_information(emm_information_msg *emm_information, uint8_t *buffer, uint32_t len)
{
uint32_t decoded = 0;
int decoded_result = 0;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, EMM_INFORMATION_MINIMUM_LENGTH, len);
/* Decoding mandatory fields */
/* Decoding optional fields */
while(len - decoded > 0) {
uint8_t ieiDecoded = *(buffer + decoded);
/* Type | value iei are below 0x80 so just return the first 4 bits */
if (ieiDecoded >= 0x80)
ieiDecoded = ieiDecoded & 0xf0;
switch(ieiDecoded) {
case EMM_INFORMATION_FULL_NAME_FOR_NETWORK_IEI:
if ((decoded_result =
decode_network_name(&emm_information->fullnamefornetwork,
EMM_INFORMATION_FULL_NAME_FOR_NETWORK_IEI, buffer +
decoded, len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
emm_information->presencemask |= EMM_INFORMATION_FULL_NAME_FOR_NETWORK_PRESENT;
break;
case EMM_INFORMATION_SHORT_NAME_FOR_NETWORK_IEI:
if ((decoded_result =
decode_network_name(&emm_information->shortnamefornetwork,
EMM_INFORMATION_SHORT_NAME_FOR_NETWORK_IEI, buffer +
decoded, len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
emm_information->presencemask |= EMM_INFORMATION_SHORT_NAME_FOR_NETWORK_PRESENT;
break;
case EMM_INFORMATION_LOCAL_TIME_ZONE_IEI:
if ((decoded_result =
decode_time_zone(&emm_information->localtimezone,
EMM_INFORMATION_LOCAL_TIME_ZONE_IEI, buffer + decoded, len
- decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
emm_information->presencemask |= EMM_INFORMATION_LOCAL_TIME_ZONE_PRESENT;
break;
case EMM_INFORMATION_UNIVERSAL_TIME_AND_LOCAL_TIME_ZONE_IEI:
if ((decoded_result =
decode_time_zone_and_time(&emm_information->universaltimeandlocaltimezone,
EMM_INFORMATION_UNIVERSAL_TIME_AND_LOCAL_TIME_ZONE_IEI,
buffer + decoded, len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
emm_information->presencemask |= EMM_INFORMATION_UNIVERSAL_TIME_AND_LOCAL_TIME_ZONE_PRESENT;
break;
case EMM_INFORMATION_NETWORK_DAYLIGHT_SAVING_TIME_IEI:
if ((decoded_result =
decode_daylight_saving_time(&emm_information->networkdaylightsavingtime,
EMM_INFORMATION_NETWORK_DAYLIGHT_SAVING_TIME_IEI, buffer +
decoded, len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
emm_information->presencemask |= EMM_INFORMATION_NETWORK_DAYLIGHT_SAVING_TIME_PRESENT;
break;
default:
errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI;
return TLV_DECODE_UNEXPECTED_IEI;
}
}
return decoded;
}
int encode_emm_information(emm_information_msg *emm_information, uint8_t *buffer, uint32_t len)
{
int encoded = 0;
int encode_result = 0;
/* Checking IEI and pointer */
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, EMM_INFORMATION_MINIMUM_LENGTH, len);
if ((emm_information->presencemask & EMM_INFORMATION_FULL_NAME_FOR_NETWORK_PRESENT)
== EMM_INFORMATION_FULL_NAME_FOR_NETWORK_PRESENT) {
if ((encode_result =
encode_network_name(&emm_information->fullnamefornetwork,
EMM_INFORMATION_FULL_NAME_FOR_NETWORK_IEI, buffer + encoded, len -
encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((emm_information->presencemask & EMM_INFORMATION_SHORT_NAME_FOR_NETWORK_PRESENT)
== EMM_INFORMATION_SHORT_NAME_FOR_NETWORK_PRESENT) {
if ((encode_result =
encode_network_name(&emm_information->shortnamefornetwork,
EMM_INFORMATION_SHORT_NAME_FOR_NETWORK_IEI, buffer + encoded, len
- encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((emm_information->presencemask & EMM_INFORMATION_LOCAL_TIME_ZONE_PRESENT)
== EMM_INFORMATION_LOCAL_TIME_ZONE_PRESENT) {
if ((encode_result = encode_time_zone(&emm_information->localtimezone,
EMM_INFORMATION_LOCAL_TIME_ZONE_IEI, buffer + encoded, len -
encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((emm_information->presencemask & EMM_INFORMATION_UNIVERSAL_TIME_AND_LOCAL_TIME_ZONE_PRESENT)
== EMM_INFORMATION_UNIVERSAL_TIME_AND_LOCAL_TIME_ZONE_PRESENT) {
if ((encode_result =
encode_time_zone_and_time(&emm_information->universaltimeandlocaltimezone,
EMM_INFORMATION_UNIVERSAL_TIME_AND_LOCAL_TIME_ZONE_IEI, buffer +
encoded, len - encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((emm_information->presencemask & EMM_INFORMATION_NETWORK_DAYLIGHT_SAVING_TIME_PRESENT)
== EMM_INFORMATION_NETWORK_DAYLIGHT_SAVING_TIME_PRESENT) {
if ((encode_result =
encode_daylight_saving_time(&emm_information->networkdaylightsavingtime,
EMM_INFORMATION_NETWORK_DAYLIGHT_SAVING_TIME_IEI, buffer +
encoded, len - encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
return encoded;
}
@@ -0,0 +1,98 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "ProtocolDiscriminator.h"
#include "SecurityHeaderType.h"
#include "MessageType.h"
#include "NetworkName.h"
#include "TimeZone.h"
#include "TimeZoneAndTime.h"
#include "DaylightSavingTime.h"
#ifndef EMM_INFORMATION_H_
#define EMM_INFORMATION_H_
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define EMM_INFORMATION_MINIMUM_LENGTH (0)
/* Maximum length macro. Formed by maximum length of each field */
#define EMM_INFORMATION_MAXIMUM_LENGTH ( \
NETWORK_NAME_MAXIMUM_LENGTH + \
NETWORK_NAME_MAXIMUM_LENGTH + \
TIME_ZONE_MAXIMUM_LENGTH + \
TIME_ZONE_AND_TIME_MAXIMUM_LENGTH + \
DAYLIGHT_SAVING_TIME_MAXIMUM_LENGTH )
/* If an optional value is present and should be encoded, the corresponding
* Bit mask should be set to 1.
*/
# define EMM_INFORMATION_FULL_NAME_FOR_NETWORK_PRESENT (1<<0)
# define EMM_INFORMATION_SHORT_NAME_FOR_NETWORK_PRESENT (1<<1)
# define EMM_INFORMATION_LOCAL_TIME_ZONE_PRESENT (1<<2)
# define EMM_INFORMATION_UNIVERSAL_TIME_AND_LOCAL_TIME_ZONE_PRESENT (1<<3)
# define EMM_INFORMATION_NETWORK_DAYLIGHT_SAVING_TIME_PRESENT (1<<4)
typedef enum emm_information_iei_tag {
EMM_INFORMATION_FULL_NAME_FOR_NETWORK_IEI = 0x43, /* 0x43 = 67 */
EMM_INFORMATION_SHORT_NAME_FOR_NETWORK_IEI = 0x45, /* 0x45 = 69 */
EMM_INFORMATION_LOCAL_TIME_ZONE_IEI = 0x46, /* 0x46 = 70 */
EMM_INFORMATION_UNIVERSAL_TIME_AND_LOCAL_TIME_ZONE_IEI = 0x47, /* 0x47 = 71 */
EMM_INFORMATION_NETWORK_DAYLIGHT_SAVING_TIME_IEI = 0x49, /* 0x49 = 73 */
} emm_information_iei;
/*
* Message name: EMM information
* Description: This message is sent by the network at any time during EMM context is established to send certain information to the UE. See table 8.2.13.1.
* Significance: local
* Direction: network to UE
*/
typedef struct emm_information_msg_tag {
/* Mandatory fields */
ProtocolDiscriminator protocoldiscriminator:4;
SecurityHeaderType securityheadertype:4;
MessageType messagetype;
/* Optional fields */
uint32_t presencemask;
NetworkName fullnamefornetwork;
NetworkName shortnamefornetwork;
TimeZone localtimezone;
TimeZoneAndTime universaltimeandlocaltimezone;
DaylightSavingTime networkdaylightsavingtime;
} emm_information_msg;
int decode_emm_information(emm_information_msg *emminformation, uint8_t *buffer, uint32_t len);
int encode_emm_information(emm_information_msg *emminformation, uint8_t *buffer, uint32_t len);
#endif /* ! defined(EMM_INFORMATION_H_) */
+72
View File
@@ -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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "EmmStatus.h"
int decode_emm_status(emm_status_msg *emm_status, uint8_t *buffer, uint32_t len)
{
uint32_t decoded = 0;
int decoded_result = 0;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, EMM_STATUS_MINIMUM_LENGTH, len);
/* Decoding mandatory fields */
if ((decoded_result = decode_emm_cause(&emm_status->emmcause, 0, buffer + decoded, len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
return decoded;
}
int encode_emm_status(emm_status_msg *emm_status, uint8_t *buffer, uint32_t len)
{
int encoded = 0;
int encode_result = 0;
/* Checking IEI and pointer */
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, EMM_STATUS_MINIMUM_LENGTH, len);
if ((encode_result = encode_emm_cause(&emm_status->emmcause, 0, buffer +
encoded, len - encoded)) < 0) //Return in case of error
return encode_result;
else
encoded += encode_result;
return encoded;
}
+70
View File
@@ -0,0 +1,70 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "ProtocolDiscriminator.h"
#include "SecurityHeaderType.h"
#include "MessageType.h"
#include "EmmCause.h"
#ifndef EMM_STATUS_H_
#define EMM_STATUS_H_
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define EMM_STATUS_MINIMUM_LENGTH ( \
EMM_CAUSE_MINIMUM_LENGTH )
/* Maximum length macro. Formed by maximum length of each field */
#define EMM_STATUS_MAXIMUM_LENGTH ( \
EMM_CAUSE_MAXIMUM_LENGTH )
/*
* Message name: EMM status
* Description: This message is sent by the UE or by the network at any time to report certain error conditions listed in clause 7. See table 8.2.14.1.
* Significance: local
* Direction: both
*/
typedef struct emm_status_msg_tag {
/* Mandatory fields */
ProtocolDiscriminator protocoldiscriminator:4;
SecurityHeaderType securityheadertype:4;
MessageType messagetype;
EmmCause emmcause;
} emm_status_msg;
int decode_emm_status(emm_status_msg *emmstatus, uint8_t *buffer, uint32_t len);
int encode_emm_status(emm_status_msg *emmstatus, uint8_t *buffer, uint32_t len);
#endif /* ! defined(EMM_STATUS_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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "ExtendedServiceRequest.h"
int decode_extended_service_request(extended_service_request_msg *extended_service_request, uint8_t *buffer, uint32_t len)
{
uint32_t decoded = 0;
int decoded_result = 0;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, EXTENDED_SERVICE_REQUEST_MINIMUM_LENGTH, len);
/* Decoding mandatory fields */
if ((decoded_result = decode_u8_service_type(&extended_service_request->servicetype, 0, *(buffer + decoded) >> 4, len - decoded)) < 0)
return decoded_result;
if ((decoded_result = decode_u8_nas_key_set_identifier(&extended_service_request->naskeysetidentifier, 0, *(buffer + decoded) & 0x0f, len - decoded)) < 0)
return decoded_result;
decoded++;
if ((decoded_result = decode_mobile_identity(&extended_service_request->mtmsi, 0, buffer + decoded, len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
return decoded;
}
int encode_extended_service_request(extended_service_request_msg *extended_service_request, uint8_t *buffer, uint32_t len)
{
int encoded = 0;
int encode_result = 0;
/* Checking IEI and pointer */
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, EXTENDED_SERVICE_REQUEST_MINIMUM_LENGTH, len);
*(buffer + encoded) = ((encode_u8_service_type(&extended_service_request->servicetype) & 0x0f) << 4) | (encode_u8_nas_key_set_identifier(&extended_service_request->naskeysetidentifier) & 0x0f);
encoded++;
if ((encode_result =
encode_mobile_identity(&extended_service_request->mtmsi, 0, buffer +
encoded, len - encoded)) < 0) //Return in case of error
return encode_result;
else
encoded += encode_result;
if ((encode_result =
encode_csfb_response(&extended_service_request->csfbresponse, 0,
buffer + encoded, len - encoded)) < 0) //Return in case of error
return encode_result;
else
encoded += encode_result;
return encoded;
}
@@ -0,0 +1,83 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "ProtocolDiscriminator.h"
#include "SecurityHeaderType.h"
#include "MessageType.h"
#include "ServiceType.h"
#include "NasKeySetIdentifier.h"
#include "MobileIdentity.h"
#include "CsfbResponse.h"
#ifndef EXTENDED_SERVICE_REQUEST_H_
#define EXTENDED_SERVICE_REQUEST_H_
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define EXTENDED_SERVICE_REQUEST_MINIMUM_LENGTH ( \
SERVICE_TYPE_MINIMUM_LENGTH + \
NAS_KEY_SET_IDENTIFIER_MINIMUM_LENGTH + \
MOBILE_IDENTITY_MINIMUM_LENGTH )
/* Maximum length macro. Formed by maximum length of each field */
#define EXTENDED_SERVICE_REQUEST_MAXIMUM_LENGTH ( \
SERVICE_TYPE_MAXIMUM_LENGTH + \
NAS_KEY_SET_IDENTIFIER_MAXIMUM_LENGTH + \
MOBILE_IDENTITY_MAXIMUM_LENGTH + \
CSFB_RESPONSE_MAXIMUM_LENGTH )
/*
* Message name: Extended service request
* Description: This message is sent by the UE to the network to initiate a CS fallback call or respond to a mobile terminated CS fallback request from the network. See table 8.2.15.1.
* Significance: dual
* Direction: UE to network
*/
typedef struct extended_service_request_msg_tag {
/* Mandatory fields */
ProtocolDiscriminator protocoldiscriminator:4;
SecurityHeaderType securityheadertype:4;
MessageType messagetype;
ServiceType servicetype;
NasKeySetIdentifier naskeysetidentifier;
MobileIdentity mtmsi;
/* Optional fields */
uint32_t presencemask;
CsfbResponse csfbresponse;
} extended_service_request_msg;
int decode_extended_service_request(extended_service_request_msg *extendedservicerequest, uint8_t *buffer, uint32_t len);
int encode_extended_service_request(extended_service_request_msg *extendedservicerequest, uint8_t *buffer, uint32_t len);
#endif /* ! defined(EXTENDED_SERVICE_REQUEST_H_) */
@@ -0,0 +1,112 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "GutiReallocationCommand.h"
int decode_guti_reallocation_command(guti_reallocation_command_msg *guti_reallocation_command, uint8_t *buffer, uint32_t len)
{
uint32_t decoded = 0;
int decoded_result = 0;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, GUTI_REALLOCATION_COMMAND_MINIMUM_LENGTH, len);
/* Decoding mandatory fields */
if ((decoded_result = decode_eps_mobile_identity(&guti_reallocation_command->guti, 0, buffer + decoded, len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
/* Decoding optional fields */
while(len - decoded > 0) {
uint8_t ieiDecoded = *(buffer + decoded);
/* Type | value iei are below 0x80 so just return the first 4 bits */
if (ieiDecoded >= 0x80)
ieiDecoded = ieiDecoded & 0xf0;
switch(ieiDecoded) {
case GUTI_REALLOCATION_COMMAND_TAI_LIST_IEI:
if ((decoded_result =
decode_tracking_area_identity_list(&guti_reallocation_command->tailist,
GUTI_REALLOCATION_COMMAND_TAI_LIST_IEI, buffer + decoded,
len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
guti_reallocation_command->presencemask |= GUTI_REALLOCATION_COMMAND_TAI_LIST_PRESENT;
break;
default:
errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI;
return TLV_DECODE_UNEXPECTED_IEI;
}
}
return decoded;
}
int encode_guti_reallocation_command(guti_reallocation_command_msg *guti_reallocation_command, uint8_t *buffer, uint32_t len)
{
int encoded = 0;
int encode_result = 0;
/* Checking IEI and pointer */
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, GUTI_REALLOCATION_COMMAND_MINIMUM_LENGTH, len);
if ((encode_result =
encode_eps_mobile_identity(&guti_reallocation_command->guti, 0, buffer
+ encoded, len - encoded)) < 0) //Return in case of error
return encode_result;
else
encoded += encode_result;
if ((guti_reallocation_command->presencemask & GUTI_REALLOCATION_COMMAND_TAI_LIST_PRESENT)
== GUTI_REALLOCATION_COMMAND_TAI_LIST_PRESENT) {
if ((encode_result =
encode_tracking_area_identity_list(&guti_reallocation_command->tailist,
GUTI_REALLOCATION_COMMAND_TAI_LIST_IEI, buffer + encoded, len -
encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
return encoded;
}
@@ -0,0 +1,83 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "ProtocolDiscriminator.h"
#include "SecurityHeaderType.h"
#include "MessageType.h"
#include "EpsMobileIdentity.h"
#include "TrackingAreaIdentityList.h"
#ifndef GUTI_REALLOCATION_COMMAND_H_
#define GUTI_REALLOCATION_COMMAND_H_
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define GUTI_REALLOCATION_COMMAND_MINIMUM_LENGTH ( \
EPS_MOBILE_IDENTITY_MINIMUM_LENGTH )
/* Maximum length macro. Formed by maximum length of each field */
#define GUTI_REALLOCATION_COMMAND_MAXIMUM_LENGTH ( \
EPS_MOBILE_IDENTITY_MAXIMUM_LENGTH + \
TRACKING_AREA_IDENTITY_LIST_MAXIMUM_LENGTH )
/* If an optional value is present and should be encoded, the corresponding
* Bit mask should be set to 1.
*/
# define GUTI_REALLOCATION_COMMAND_TAI_LIST_PRESENT (1<<0)
typedef enum guti_reallocation_command_iei_tag {
GUTI_REALLOCATION_COMMAND_TAI_LIST_IEI = 0x54, /* 0x54 = 84 */
} guti_reallocation_command_iei;
/*
* Message name: GUTI reallocation command
* Description: This message is sent by the network to the UE to reallocate a GUTI and optionally to provide a new TAI list. See table 8.2.16.1.
* Significance: dual
* Direction: network to UE
*/
typedef struct guti_reallocation_command_msg_tag {
/* Mandatory fields */
ProtocolDiscriminator protocoldiscriminator:4;
SecurityHeaderType securityheadertype:4;
MessageType messagetype;
EpsMobileIdentity guti;
/* Optional fields */
uint32_t presencemask;
TrackingAreaIdentityList tailist;
} guti_reallocation_command_msg;
int decode_guti_reallocation_command(guti_reallocation_command_msg *gutireallocationcommand, uint8_t *buffer, uint32_t len);
int encode_guti_reallocation_command(guti_reallocation_command_msg *gutireallocationcommand, uint8_t *buffer, uint32_t len);
#endif /* ! defined(GUTI_REALLOCATION_COMMAND_H_) */
@@ -0,0 +1,57 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "GutiReallocationComplete.h"
int decode_guti_reallocation_complete(guti_reallocation_complete_msg *guti_reallocation_complete, uint8_t *buffer, uint32_t len)
{
uint32_t decoded = 0;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, GUTI_REALLOCATION_COMPLETE_MINIMUM_LENGTH, len);
/* Decoding mandatory fields */
return decoded;
}
int encode_guti_reallocation_complete(guti_reallocation_complete_msg *guti_reallocation_complete, uint8_t *buffer, uint32_t len)
{
int encoded = 0;
/* Checking IEI and pointer */
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, GUTI_REALLOCATION_COMPLETE_MINIMUM_LENGTH, len);
return encoded;
}
@@ -0,0 +1,65 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "ProtocolDiscriminator.h"
#include "SecurityHeaderType.h"
#include "MessageType.h"
#ifndef GUTI_REALLOCATION_COMPLETE_H_
#define GUTI_REALLOCATION_COMPLETE_H_
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define GUTI_REALLOCATION_COMPLETE_MINIMUM_LENGTH (0)
/* Maximum length macro. Formed by maximum length of each field */
#define GUTI_REALLOCATION_COMPLETE_MAXIMUM_LENGTH (0)
/*
* Message name: GUTI reallocation complete
* Description: This message is sent by the UE to the network to indicate that reallocation of a GUTI has taken place. See table 8.2.17.1.
* Significance: dual
* Direction: UE to network
*/
typedef struct guti_reallocation_complete_msg_tag {
/* Mandatory fields */
ProtocolDiscriminator protocoldiscriminator:4;
SecurityHeaderType securityheadertype:4;
MessageType messagetype;
} guti_reallocation_complete_msg;
int decode_guti_reallocation_complete(guti_reallocation_complete_msg *gutireallocationcomplete, uint8_t *buffer, uint32_t len);
int encode_guti_reallocation_complete(guti_reallocation_complete_msg *gutireallocationcomplete, uint8_t *buffer, uint32_t len);
#endif /* ! defined(GUTI_REALLOCATION_COMPLETE_H_) */
@@ -0,0 +1,66 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "IdentityRequest.h"
int decode_identity_request(identity_request_msg *identity_request, uint8_t *buffer, uint32_t len)
{
uint32_t decoded = 0;
int decoded_result = 0;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, IDENTITY_REQUEST_MINIMUM_LENGTH, len);
/* Decoding mandatory fields */
if ((decoded_result = decode_u8_identity_type_2(&identity_request->identitytype, 0, *(buffer + decoded) >> 4, len - decoded)) < 0)
return decoded_result;
decoded++;
return decoded;
}
int encode_identity_request(identity_request_msg *identity_request, uint8_t *buffer, uint32_t len)
{
int encoded = 0;
/* Checking IEI and pointer */
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, IDENTITY_REQUEST_MINIMUM_LENGTH, len);
*(buffer + encoded) = encode_u8_identity_type_2(&identity_request->identitytype) & 0x0f;
encoded++;
return encoded;
}
@@ -0,0 +1,70 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "ProtocolDiscriminator.h"
#include "SecurityHeaderType.h"
#include "MessageType.h"
#include "IdentityType2.h"
#ifndef IDENTITY_REQUEST_H_
#define IDENTITY_REQUEST_H_
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define IDENTITY_REQUEST_MINIMUM_LENGTH ( \
IDENTITY_TYPE_2_MINIMUM_LENGTH )
/* Maximum length macro. Formed by maximum length of each field */
#define IDENTITY_REQUEST_MAXIMUM_LENGTH ( \
IDENTITY_TYPE_2_MAXIMUM_LENGTH )
/*
* Message name: Identity request
* Description: This message is sent by the network to the UE to request the UE to provide the specified identity. See table 8.2.18.1.
* Significance: dual
* Direction: network to UE
*/
typedef struct identity_request_msg_tag {
/* Mandatory fields */
ProtocolDiscriminator protocoldiscriminator:4;
SecurityHeaderType securityheadertype:4;
MessageType messagetype;
IdentityType2 identitytype;
} identity_request_msg;
int decode_identity_request(identity_request_msg *identityrequest, uint8_t *buffer, uint32_t len);
int encode_identity_request(identity_request_msg *identityrequest, uint8_t *buffer, uint32_t len);
#endif /* ! defined(IDENTITY_REQUEST_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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "IdentityResponse.h"
int decode_identity_response(identity_response_msg *identity_response, uint8_t *buffer, uint32_t len)
{
uint32_t decoded = 0;
int decoded_result = 0;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, IDENTITY_RESPONSE_MINIMUM_LENGTH, len);
/* Decoding mandatory fields */
if ((decoded_result = decode_mobile_identity(&identity_response->mobileidentity, 0, buffer + decoded, len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
return decoded;
}
int encode_identity_response(identity_response_msg *identity_response, uint8_t *buffer, uint32_t len)
{
int encoded = 0;
int encode_result = 0;
/* Checking IEI and pointer */
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, IDENTITY_RESPONSE_MINIMUM_LENGTH, len);
if ((encode_result =
encode_mobile_identity(&identity_response->mobileidentity, 0, buffer +
encoded, len - encoded)) < 0) //Return in case of error
return encode_result;
else
encoded += encode_result;
return encoded;
}
@@ -0,0 +1,70 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "ProtocolDiscriminator.h"
#include "SecurityHeaderType.h"
#include "MessageType.h"
#include "MobileIdentity.h"
#ifndef IDENTITY_RESPONSE_H_
#define IDENTITY_RESPONSE_H_
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define IDENTITY_RESPONSE_MINIMUM_LENGTH ( \
MOBILE_IDENTITY_MINIMUM_LENGTH )
/* Maximum length macro. Formed by maximum length of each field */
#define IDENTITY_RESPONSE_MAXIMUM_LENGTH ( \
MOBILE_IDENTITY_MAXIMUM_LENGTH )
/*
* Message name: Identity response
* Description: This message is sent by the UE to the network in response to an IDENTITY REQUEST message and provides the requested identity. See table 8.2.19.1.
* Significance: dual
* Direction: UE to network
*/
typedef struct identity_response_msg_tag {
/* Mandatory fields */
ProtocolDiscriminator protocoldiscriminator:4;
SecurityHeaderType securityheadertype:4;
MessageType messagetype;
MobileIdentity mobileidentity;
} identity_response_msg;
int decode_identity_response(identity_response_msg *identityresponse, uint8_t *buffer, uint32_t len);
int encode_identity_response(identity_response_msg *identityresponse, uint8_t *buffer, uint32_t len);
#endif /* ! defined(IDENTITY_RESPONSE_H_) */
+69
View File
@@ -0,0 +1,69 @@
################################################################################
# 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 <http://www.gnu.org/licenses/>.
#
# 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
INCLUDES = -I. -I$(INCDIR) -I$(UTILDIR) -I$(IESDIR)
TARGET = $(LIBEMMMSG)
TARGETS = $(TARGET).a $(TARGET).so
all: $(TARGETS)
%.o: %.c %.h Makefile $(LIBDIR)/$(LIBIES).a $(UTILDIR)/TLVEncoder.h $(UTILDIR)/TLVDecoder.h
@echo Compiling $<
@$(CC) $(CFLAGS) -c $< -o $@
$(TARGET).a: $(OBJS)
@$(RM) $@
@$(AR) $(ARFLAGS) $@ $(OBJS)
@echo Replacing $@ to $(LIBDIR)
@$(RM) $(LIBDIR)/$@
@$(CP) $@ $(LIBDIR)
$(TARGET).so: $(OBJS)
@$(LD) -G -o $@ $(OBJS)
@echo Replacing $@ to $(LIBDIR)
@$(RM) $(LIBDIR)/$@
@$(CP) $@ $(LIBDIR)
clean:
$(RM) $(OBJS) .bak *~
veryclean: clean
$(RM) $(TARGETS)
depend:
makedepend -- ${CFLAGS} -- ${SRCS}
# DO NOT DELETE THIS LINE -- make depend depends on it.
@@ -0,0 +1,100 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "ProtocolDiscriminator.h"
#include "SecurityHeaderType.h"
#include "MessageType.h"
#include "NasSecurityAlgorithms.h"
#include "NasKeySetIdentifier.h"
#include "UeSecurityCapability.h"
#include "ImeisvRequest.h"
#include "Nonce.h"
#ifndef NAS_SECURITY_MODE_COMMAND_H_
#define NAS_SECURITY_MODE_COMMAND_H_
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define SECURITY_MODE_COMMAND_MINIMUM_LENGTH ( \
NAS_SECURITY_ALGORITHMS_MINIMUM_LENGTH + \
NAS_KEY_SET_IDENTIFIER_MINIMUM_LENGTH + \
UE_SECURITY_CAPABILITY_MINIMUM_LENGTH )
/* Maximum length macro. Formed by maximum length of each field */
#define SECURITY_MODE_COMMAND_MAXIMUM_LENGTH ( \
NAS_SECURITY_ALGORITHMS_MAXIMUM_LENGTH + \
NAS_KEY_SET_IDENTIFIER_MAXIMUM_LENGTH + \
UE_SECURITY_CAPABILITY_MAXIMUM_LENGTH + \
IMEISV_REQUEST_MAXIMUM_LENGTH + \
NONCE_MAXIMUM_LENGTH + \
NONCE_MAXIMUM_LENGTH )
/* If an optional value is present and should be encoded, the corresponding
* Bit mask should be set to 1.
*/
# define SECURITY_MODE_COMMAND_IMEISV_REQUEST_PRESENT (1<<0)
# define SECURITY_MODE_COMMAND_REPLAYED_NONCEUE_PRESENT (1<<1)
# define SECURITY_MODE_COMMAND_NONCEMME_PRESENT (1<<2)
typedef enum security_mode_command_iei_tag {
SECURITY_MODE_COMMAND_IMEISV_REQUEST_IEI = 0xC0, /* 0xC0 = 192 */
SECURITY_MODE_COMMAND_REPLAYED_NONCEUE_IEI = 0x55, /* 0x55 = 85 */
SECURITY_MODE_COMMAND_NONCEMME_IEI = 0x56, /* 0x56 = 86 */
} security_mode_command_iei;
/*
* Message name: Security mode command
* Description: This message is sent by the network to the UE to establish NAS signalling security. See table 8.2.20.1.
* Significance: dual
* Direction: network to UE
*/
typedef struct security_mode_command_msg_tag {
/* Mandatory fields */
ProtocolDiscriminator protocoldiscriminator:4;
SecurityHeaderType securityheadertype:4;
MessageType messagetype;
NasSecurityAlgorithms selectednassecurityalgorithms;
NasKeySetIdentifier naskeysetidentifier;
UeSecurityCapability replayeduesecuritycapabilities;
/* Optional fields */
uint32_t presencemask;
ImeisvRequest imeisvrequest;
Nonce replayednonceue;
Nonce noncemme;
} security_mode_command_msg;
int decode_security_mode_command(security_mode_command_msg *securitymodecommand, uint8_t *buffer, uint32_t len);
int encode_security_mode_command(security_mode_command_msg *securitymodecommand, uint8_t *buffer, uint32_t len);
#endif /* ! defined(NAS_SECURITY_MODE_COMMAND_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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "ProtocolDiscriminator.h"
#include "SecurityHeaderType.h"
#include "MessageType.h"
#include "MobileIdentity.h"
#ifndef SECURITY_MODE_COMPLETE_H_
#define SECURITY_MODE_COMPLETE_H_
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define SECURITY_MODE_COMPLETE_MINIMUM_LENGTH (0)
/* Maximum length macro. Formed by maximum length of each field */
#define SECURITY_MODE_COMPLETE_MAXIMUM_LENGTH ( \
MOBILE_IDENTITY_MAXIMUM_LENGTH )
/* If an optional value is present and should be encoded, the corresponding
* Bit mask should be set to 1.
*/
# define SECURITY_MODE_COMPLETE_IMEISV_PRESENT (1<<0)
typedef enum security_mode_complete_iei_tag {
SECURITY_MODE_COMPLETE_IMEISV_IEI = 0x23, /* 0x23 = 35 */
} security_mode_complete_iei;
/*
* Message name: Security mode complete
* Description: This message is sent by the UE to the network in response to a SECURITY MODE COMMAND message. See table 8.2.21.1.
* Significance: dual
* Direction: UE to network
*/
typedef struct security_mode_complete_msg_tag {
/* Mandatory fields */
ProtocolDiscriminator protocoldiscriminator:4;
SecurityHeaderType securityheadertype:4;
MessageType messagetype;
/* Optional fields */
uint32_t presencemask;
MobileIdentity imeisv;
} security_mode_complete_msg;
int decode_security_mode_complete(security_mode_complete_msg *securitymodecomplete, uint8_t *buffer, uint32_t len);
int encode_security_mode_complete(security_mode_complete_msg *securitymodecomplete, uint8_t *buffer, uint32_t len);
#endif /* ! defined(SECURITY_MODE_COMPLETE_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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "NASSecurityModeCommand.h"
int decode_security_mode_command(security_mode_command_msg *security_mode_command, uint8_t *buffer, uint32_t len)
{
uint32_t decoded = 0;
int decoded_result = 0;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, SECURITY_MODE_COMMAND_MINIMUM_LENGTH, len);
/* Decoding mandatory fields */
if ((decoded_result = decode_nas_security_algorithms(&security_mode_command->selectednassecurityalgorithms, 0, buffer + decoded, len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
if ((decoded_result = decode_u8_nas_key_set_identifier(&security_mode_command->naskeysetidentifier, 0, *(buffer + decoded) & 0x0f, len - decoded)) < 0)
return decoded_result;
decoded++;
if ((decoded_result = decode_ue_security_capability(&security_mode_command->replayeduesecuritycapabilities, 0, buffer + decoded, len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
/* Decoding optional fields */
while(len - decoded > 0) {
uint8_t ieiDecoded = *(buffer + decoded);
/* Type | value iei are below 0x80 so just return the first 4 bits */
if (ieiDecoded >= 0x80)
ieiDecoded = ieiDecoded & 0xf0;
switch(ieiDecoded) {
case SECURITY_MODE_COMMAND_IMEISV_REQUEST_IEI:
if ((decoded_result =
decode_imeisv_request(&security_mode_command->imeisvrequest,
SECURITY_MODE_COMMAND_IMEISV_REQUEST_IEI, buffer + decoded,
len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
security_mode_command->presencemask |= SECURITY_MODE_COMMAND_IMEISV_REQUEST_PRESENT;
break;
case SECURITY_MODE_COMMAND_REPLAYED_NONCEUE_IEI:
if ((decoded_result =
decode_nonce(&security_mode_command->replayednonceue,
SECURITY_MODE_COMMAND_REPLAYED_NONCEUE_IEI, buffer +
decoded, len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
security_mode_command->presencemask |= SECURITY_MODE_COMMAND_REPLAYED_NONCEUE_PRESENT;
break;
case SECURITY_MODE_COMMAND_NONCEMME_IEI:
if ((decoded_result =
decode_nonce(&security_mode_command->noncemme,
SECURITY_MODE_COMMAND_NONCEMME_IEI, buffer + decoded, len -
decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
security_mode_command->presencemask |= SECURITY_MODE_COMMAND_NONCEMME_PRESENT;
break;
default:
errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI;
return TLV_DECODE_UNEXPECTED_IEI;
}
}
return decoded;
}
int encode_security_mode_command(security_mode_command_msg *security_mode_command, uint8_t *buffer, uint32_t len)
{
int encoded = 0;
int encode_result = 0;
/* Checking IEI and pointer */
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, SECURITY_MODE_COMMAND_MINIMUM_LENGTH, len);
if ((encode_result =
encode_nas_security_algorithms(&security_mode_command->selectednassecurityalgorithms,
0, buffer + encoded, len - encoded)) < 0) //Return in case of error
return encode_result;
else
encoded += encode_result;
*(buffer + encoded) = (encode_u8_nas_key_set_identifier(&security_mode_command->naskeysetidentifier) & 0x0f);
encoded++;
if ((encode_result =
encode_ue_security_capability(&security_mode_command->replayeduesecuritycapabilities,
0, buffer + encoded, len - encoded)) < 0) //Return in case of error
return encode_result;
else
encoded += encode_result;
if ((security_mode_command->presencemask & SECURITY_MODE_COMMAND_IMEISV_REQUEST_PRESENT)
== SECURITY_MODE_COMMAND_IMEISV_REQUEST_PRESENT) {
if ((encode_result =
encode_imeisv_request(&security_mode_command->imeisvrequest,
SECURITY_MODE_COMMAND_IMEISV_REQUEST_IEI, buffer + encoded, len -
encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((security_mode_command->presencemask & SECURITY_MODE_COMMAND_REPLAYED_NONCEUE_PRESENT)
== SECURITY_MODE_COMMAND_REPLAYED_NONCEUE_PRESENT) {
if ((encode_result =
encode_nonce(&security_mode_command->replayednonceue,
SECURITY_MODE_COMMAND_REPLAYED_NONCEUE_IEI, buffer + encoded, len
- encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((security_mode_command->presencemask & SECURITY_MODE_COMMAND_NONCEMME_PRESENT)
== SECURITY_MODE_COMMAND_NONCEMME_PRESENT) {
if ((encode_result = encode_nonce(&security_mode_command->noncemme,
SECURITY_MODE_COMMAND_NONCEMME_IEI, buffer + encoded, len -
encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
return encoded;
}
@@ -0,0 +1,100 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "NASSecurityModeComplete.h"
int decode_security_mode_complete(security_mode_complete_msg *security_mode_complete, uint8_t *buffer, uint32_t len)
{
uint32_t decoded = 0;
int decoded_result = 0;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, SECURITY_MODE_COMPLETE_MINIMUM_LENGTH, len);
/* Decoding mandatory fields */
/* Decoding optional fields */
while(len - decoded > 0) {
uint8_t ieiDecoded = *(buffer + decoded);
/* Type | value iei are below 0x80 so just return the first 4 bits */
if (ieiDecoded >= 0x80)
ieiDecoded = ieiDecoded & 0xf0;
switch(ieiDecoded) {
case SECURITY_MODE_COMPLETE_IMEISV_IEI:
if ((decoded_result =
decode_mobile_identity(&security_mode_complete->imeisv,
SECURITY_MODE_COMPLETE_IMEISV_IEI, buffer + decoded, len -
decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
security_mode_complete->presencemask |= SECURITY_MODE_COMPLETE_IMEISV_PRESENT;
break;
default:
errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI;
return TLV_DECODE_UNEXPECTED_IEI;
}
}
return decoded;
}
int encode_security_mode_complete(security_mode_complete_msg *security_mode_complete, uint8_t *buffer, uint32_t len)
{
int encoded = 0;
int encode_result = 0;
/* Checking IEI and pointer */
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, SECURITY_MODE_COMPLETE_MINIMUM_LENGTH, len);
if ((security_mode_complete->presencemask & SECURITY_MODE_COMPLETE_IMEISV_PRESENT)
== SECURITY_MODE_COMPLETE_IMEISV_PRESENT) {
if ((encode_result =
encode_mobile_identity(&security_mode_complete->imeisv,
SECURITY_MODE_COMPLETE_IMEISV_IEI, buffer + encoded, len -
encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
return encoded;
}
@@ -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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "SecurityModeReject.h"
int decode_security_mode_reject(security_mode_reject_msg *security_mode_reject, uint8_t *buffer, uint32_t len)
{
uint32_t decoded = 0;
int decoded_result = 0;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, SECURITY_MODE_REJECT_MINIMUM_LENGTH, len);
/* Decoding mandatory fields */
if ((decoded_result = decode_emm_cause(&security_mode_reject->emmcause, 0, buffer + decoded, len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
return decoded;
}
int encode_security_mode_reject(security_mode_reject_msg *security_mode_reject, uint8_t *buffer, uint32_t len)
{
int encoded = 0;
int encode_result = 0;
/* Checking IEI and pointer */
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, SECURITY_MODE_REJECT_MINIMUM_LENGTH, len);
if ((encode_result = encode_emm_cause(&security_mode_reject->emmcause, 0,
buffer + encoded, len - encoded)) < 0) //Return in case of error
return encode_result;
else
encoded += encode_result;
return encoded;
}
@@ -0,0 +1,70 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "ProtocolDiscriminator.h"
#include "SecurityHeaderType.h"
#include "MessageType.h"
#include "EmmCause.h"
#ifndef SECURITY_MODE_REJECT_H_
#define SECURITY_MODE_REJECT_H_
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define SECURITY_MODE_REJECT_MINIMUM_LENGTH ( \
EMM_CAUSE_MINIMUM_LENGTH )
/* Maximum length macro. Formed by maximum length of each field */
#define SECURITY_MODE_REJECT_MAXIMUM_LENGTH ( \
EMM_CAUSE_MAXIMUM_LENGTH )
/*
* Message name: Security mode reject
* Description: This message is sent by the UE to the network to indicate that the corresponding security mode command has been rejected. See table 8.2.22.1.
* Significance: dual
* Direction: UE to network
*/
typedef struct security_mode_reject_msg_tag {
/* Mandatory fields */
ProtocolDiscriminator protocoldiscriminator:4;
SecurityHeaderType securityheadertype:4;
MessageType messagetype;
EmmCause emmcause;
} security_mode_reject_msg;
int decode_security_mode_reject(security_mode_reject_msg *securitymodereject, uint8_t *buffer, uint32_t len);
int encode_security_mode_reject(security_mode_reject_msg *securitymodereject, uint8_t *buffer, uint32_t len);
#endif /* ! defined(SECURITY_MODE_REJECT_H_) */
@@ -0,0 +1,78 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "ServiceReject.h"
int decode_service_reject(service_reject_msg *service_reject, uint8_t *buffer, uint32_t len)
{
uint32_t decoded = 0;
int decoded_result = 0;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, SERVICE_REJECT_MINIMUM_LENGTH, len);
/* Decoding mandatory fields */
if ((decoded_result = decode_emm_cause(&service_reject->emmcause, 0, buffer + decoded, len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
return decoded;
}
int encode_service_reject(service_reject_msg *service_reject, uint8_t *buffer, uint32_t len)
{
int encoded = 0;
int encode_result = 0;
/* Checking IEI and pointer */
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, SERVICE_REJECT_MINIMUM_LENGTH, len);
if ((encode_result = encode_emm_cause(&service_reject->emmcause, 0, buffer +
encoded, len - encoded)) < 0) //Return in case of error
return encode_result;
else
encoded += encode_result;
if ((encode_result = encode_gprs_timer(&service_reject->t3442value, 0,
buffer + encoded, len - encoded)) < 0) //Return in case of error
return encode_result;
else
encoded += encode_result;
return encoded;
}
@@ -0,0 +1,75 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "ProtocolDiscriminator.h"
#include "SecurityHeaderType.h"
#include "MessageType.h"
#include "EmmCause.h"
#include "GprsTimer.h"
#ifndef SERVICE_REJECT_H_
#define SERVICE_REJECT_H_
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define SERVICE_REJECT_MINIMUM_LENGTH ( \
EMM_CAUSE_MINIMUM_LENGTH )
/* Maximum length macro. Formed by maximum length of each field */
#define SERVICE_REJECT_MAXIMUM_LENGTH ( \
EMM_CAUSE_MAXIMUM_LENGTH + \
GPRS_TIMER_MAXIMUM_LENGTH )
/*
* Message name: Service reject
* Description: This message is sent by the network to the UE in order to reject the service request procedure. See table 8.2.24.1.
* Significance: dual
* Direction: network to UE
*/
typedef struct service_reject_msg_tag {
/* Mandatory fields */
ProtocolDiscriminator protocoldiscriminator:4;
SecurityHeaderType securityheadertype:4;
MessageType messagetype;
EmmCause emmcause;
/* Optional fields */
uint32_t presencemask;
GprsTimer t3442value;
} service_reject_msg;
int decode_service_reject(service_reject_msg *servicereject, uint8_t *buffer, uint32_t len);
int encode_service_reject(service_reject_msg *servicereject, uint8_t *buffer, uint32_t len);
#endif /* ! defined(SERVICE_REJECT_H_) */
@@ -0,0 +1,87 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "ServiceRequest.h"
int decode_service_request(service_request_msg *service_request, uint8_t *buffer, uint32_t len)
{
uint32_t decoded = 0;
int decoded_result = 0;
LOG_FUNC_IN;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, SERVICE_REQUEST_MINIMUM_LENGTH, len);
/* Decoding mandatory fields */
if ((decoded_result = decode_ksi_and_sequence_number(&service_request->ksiandsequencenumber, 0, buffer + decoded, len - decoded)) < 0)
LOG_FUNC_RETURN(decoded_result);
else
decoded += decoded_result;
if ((decoded_result = decode_short_mac(&service_request->messageauthenticationcode, 0, buffer + decoded, len - decoded)) < 0)
LOG_FUNC_RETURN(decoded_result);
else
decoded += decoded_result;
LOG_FUNC_RETURN(decoded);
}
int encode_service_request(service_request_msg *service_request, uint8_t *buffer, uint32_t len)
{
int encoded = 0;
int encode_result = 0;
LOG_FUNC_IN;
/* Checking IEI and pointer */
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, SERVICE_REQUEST_MINIMUM_LENGTH, len);
if ((encode_result =
encode_ksi_and_sequence_number(&service_request->ksiandsequencenumber,
0, buffer + encoded, len - encoded)) < 0) //Return in case of error
LOG_FUNC_RETURN(encode_result);
else
encoded += encode_result;
if ((encode_result =
encode_short_mac(&service_request->messageauthenticationcode, 0,
buffer + encoded, len - encoded)) < 0) //Return in case of error
LOG_FUNC_RETURN(encode_result);
else
encoded += encode_result;
LOG_FUNC_RETURN(encoded);
}
@@ -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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "ProtocolDiscriminator.h"
#include "SecurityHeaderType.h"
#include "KsiAndSequenceNumber.h"
#include "ShortMac.h"
#ifndef SERVICE_REQUEST_H_
#define SERVICE_REQUEST_H_
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define SERVICE_REQUEST_MINIMUM_LENGTH ( \
KSI_AND_SEQUENCE_NUMBER_MINIMUM_LENGTH + \
SHORT_MAC_MINIMUM_LENGTH )
/* Maximum length macro. Formed by maximum length of each field */
#define SERVICE_REQUEST_MAXIMUM_LENGTH ( \
KSI_AND_SEQUENCE_NUMBER_MAXIMUM_LENGTH + \
SHORT_MAC_MAXIMUM_LENGTH )
/*
* Message name: Service request
* Description: This message is sent by the UE to the network to request the establishment of a NAS signalling connection and of the radio and S1 bearers. Its structure does not follow the structure of a standard layer 3 message. See table 8.2.25.1.
* Significance: dual
* Direction: UE to network
*/
typedef struct service_request_msg_tag {
/* Mandatory fields */
ProtocolDiscriminator protocoldiscriminator:4;
SecurityHeaderType securityheadertype:4;
KsiAndSequenceNumber ksiandsequencenumber;
ShortMac messageauthenticationcode;
} service_request_msg;
int decode_service_request(service_request_msg *servicerequest, uint8_t *buffer, uint32_t len);
int encode_service_request(service_request_msg *servicerequest, uint8_t *buffer, uint32_t len);
#endif /* ! defined(SERVICE_REQUEST_H_) */
@@ -0,0 +1,396 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "TrackingAreaUpdateAccept.h"
int decode_tracking_area_update_accept(tracking_area_update_accept_msg *tracking_area_update_accept, uint8_t *buffer, uint32_t len)
{
uint32_t decoded = 0;
int decoded_result = 0;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, TRACKING_AREA_UPDATE_ACCEPT_MINIMUM_LENGTH, len);
/* Decoding mandatory fields */
if ((decoded_result = decode_u8_eps_update_result(&tracking_area_update_accept->epsupdateresult, 0, *(buffer + decoded) >> 4, len - decoded)) < 0)
return decoded_result;
decoded++;
/* Decoding optional fields */
while(len - decoded > 0) {
uint8_t ieiDecoded = *(buffer + decoded);
/* Type | value iei are below 0x80 so just return the first 4 bits */
if (ieiDecoded >= 0x80)
ieiDecoded = ieiDecoded & 0xf0;
switch(ieiDecoded) {
case TRACKING_AREA_UPDATE_ACCEPT_T3412_VALUE_IEI:
if ((decoded_result =
decode_gprs_timer(&tracking_area_update_accept->t3412value,
TRACKING_AREA_UPDATE_ACCEPT_T3412_VALUE_IEI, buffer +
decoded, len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
tracking_area_update_accept->presencemask |= TRACKING_AREA_UPDATE_ACCEPT_T3412_VALUE_PRESENT;
break;
case TRACKING_AREA_UPDATE_ACCEPT_GUTI_IEI:
if ((decoded_result =
decode_eps_mobile_identity(&tracking_area_update_accept->guti,
TRACKING_AREA_UPDATE_ACCEPT_GUTI_IEI, buffer + decoded, len
- decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
tracking_area_update_accept->presencemask |= TRACKING_AREA_UPDATE_ACCEPT_GUTI_PRESENT;
break;
case TRACKING_AREA_UPDATE_ACCEPT_TAI_LIST_IEI:
if ((decoded_result =
decode_tracking_area_identity_list(&tracking_area_update_accept->tailist,
TRACKING_AREA_UPDATE_ACCEPT_TAI_LIST_IEI, buffer + decoded,
len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
tracking_area_update_accept->presencemask |= TRACKING_AREA_UPDATE_ACCEPT_TAI_LIST_PRESENT;
break;
case TRACKING_AREA_UPDATE_ACCEPT_EPS_BEARER_CONTEXT_STATUS_IEI:
if ((decoded_result =
decode_eps_bearer_context_status(&tracking_area_update_accept->epsbearercontextstatus,
TRACKING_AREA_UPDATE_ACCEPT_EPS_BEARER_CONTEXT_STATUS_IEI,
buffer + decoded, len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
tracking_area_update_accept->presencemask |= TRACKING_AREA_UPDATE_ACCEPT_EPS_BEARER_CONTEXT_STATUS_PRESENT;
break;
case TRACKING_AREA_UPDATE_ACCEPT_LOCATION_AREA_IDENTIFICATION_IEI:
if ((decoded_result =
decode_location_area_identification(&tracking_area_update_accept->locationareaidentification,
TRACKING_AREA_UPDATE_ACCEPT_LOCATION_AREA_IDENTIFICATION_IEI,
buffer + decoded, len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
tracking_area_update_accept->presencemask |= TRACKING_AREA_UPDATE_ACCEPT_LOCATION_AREA_IDENTIFICATION_PRESENT;
break;
case TRACKING_AREA_UPDATE_ACCEPT_MS_IDENTITY_IEI:
if ((decoded_result =
decode_mobile_identity(&tracking_area_update_accept->msidentity,
TRACKING_AREA_UPDATE_ACCEPT_MS_IDENTITY_IEI, buffer +
decoded, len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
tracking_area_update_accept->presencemask |= TRACKING_AREA_UPDATE_ACCEPT_MS_IDENTITY_PRESENT;
break;
case TRACKING_AREA_UPDATE_ACCEPT_EMM_CAUSE_IEI:
if ((decoded_result =
decode_emm_cause(&tracking_area_update_accept->emmcause,
TRACKING_AREA_UPDATE_ACCEPT_EMM_CAUSE_IEI, buffer +
decoded, len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
tracking_area_update_accept->presencemask |= TRACKING_AREA_UPDATE_ACCEPT_EMM_CAUSE_PRESENT;
break;
case TRACKING_AREA_UPDATE_ACCEPT_T3402_VALUE_IEI:
if ((decoded_result =
decode_gprs_timer(&tracking_area_update_accept->t3402value,
TRACKING_AREA_UPDATE_ACCEPT_T3402_VALUE_IEI, buffer +
decoded, len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
tracking_area_update_accept->presencemask |= TRACKING_AREA_UPDATE_ACCEPT_T3402_VALUE_PRESENT;
break;
case TRACKING_AREA_UPDATE_ACCEPT_T3423_VALUE_IEI:
if ((decoded_result =
decode_gprs_timer(&tracking_area_update_accept->t3423value,
TRACKING_AREA_UPDATE_ACCEPT_T3423_VALUE_IEI, buffer +
decoded, len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
tracking_area_update_accept->presencemask |= TRACKING_AREA_UPDATE_ACCEPT_T3423_VALUE_PRESENT;
break;
case TRACKING_AREA_UPDATE_ACCEPT_EQUIVALENT_PLMNS_IEI:
if ((decoded_result =
decode_plmn_list(&tracking_area_update_accept->equivalentplmns,
TRACKING_AREA_UPDATE_ACCEPT_EQUIVALENT_PLMNS_IEI, buffer +
decoded, len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
tracking_area_update_accept->presencemask |= TRACKING_AREA_UPDATE_ACCEPT_EQUIVALENT_PLMNS_PRESENT;
break;
case TRACKING_AREA_UPDATE_ACCEPT_EMERGENCY_NUMBER_LIST_IEI:
if ((decoded_result =
decode_emergency_number_list(&tracking_area_update_accept->emergencynumberlist,
TRACKING_AREA_UPDATE_ACCEPT_EMERGENCY_NUMBER_LIST_IEI,
buffer + decoded, len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
tracking_area_update_accept->presencemask |= TRACKING_AREA_UPDATE_ACCEPT_EMERGENCY_NUMBER_LIST_PRESENT;
break;
case TRACKING_AREA_UPDATE_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_IEI:
if ((decoded_result =
decode_eps_network_feature_support(&tracking_area_update_accept->epsnetworkfeaturesupport,
TRACKING_AREA_UPDATE_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_IEI,
buffer + decoded, len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
tracking_area_update_accept->presencemask |= TRACKING_AREA_UPDATE_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_PRESENT;
break;
case TRACKING_AREA_UPDATE_ACCEPT_ADDITIONAL_UPDATE_RESULT_IEI:
if ((decoded_result =
decode_additional_update_result(&tracking_area_update_accept->additionalupdateresult,
TRACKING_AREA_UPDATE_ACCEPT_ADDITIONAL_UPDATE_RESULT_IEI,
buffer + decoded, len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
tracking_area_update_accept->presencemask |= TRACKING_AREA_UPDATE_ACCEPT_ADDITIONAL_UPDATE_RESULT_PRESENT;
break;
default:
errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI;
return TLV_DECODE_UNEXPECTED_IEI;
}
}
return decoded;
}
int encode_tracking_area_update_accept(tracking_area_update_accept_msg *tracking_area_update_accept, uint8_t *buffer, uint32_t len)
{
int encoded = 0;
int encode_result = 0;
/* Checking IEI and pointer */
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, TRACKING_AREA_UPDATE_ACCEPT_MINIMUM_LENGTH, len);
*(buffer + encoded) = ((encode_u8_eps_update_result(&tracking_area_update_accept->epsupdateresult) & 0x0f) << 4) | 0x00;
encoded++;
if ((tracking_area_update_accept->presencemask & TRACKING_AREA_UPDATE_ACCEPT_T3412_VALUE_PRESENT)
== TRACKING_AREA_UPDATE_ACCEPT_T3412_VALUE_PRESENT) {
if ((encode_result =
encode_gprs_timer(&tracking_area_update_accept->t3412value,
TRACKING_AREA_UPDATE_ACCEPT_T3412_VALUE_IEI, buffer + encoded, len
- encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((tracking_area_update_accept->presencemask & TRACKING_AREA_UPDATE_ACCEPT_GUTI_PRESENT)
== TRACKING_AREA_UPDATE_ACCEPT_GUTI_PRESENT) {
if ((encode_result =
encode_eps_mobile_identity(&tracking_area_update_accept->guti,
TRACKING_AREA_UPDATE_ACCEPT_GUTI_IEI, buffer + encoded, len -
encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((tracking_area_update_accept->presencemask & TRACKING_AREA_UPDATE_ACCEPT_TAI_LIST_PRESENT)
== TRACKING_AREA_UPDATE_ACCEPT_TAI_LIST_PRESENT) {
if ((encode_result =
encode_tracking_area_identity_list(&tracking_area_update_accept->tailist,
TRACKING_AREA_UPDATE_ACCEPT_TAI_LIST_IEI, buffer + encoded, len -
encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((tracking_area_update_accept->presencemask & TRACKING_AREA_UPDATE_ACCEPT_EPS_BEARER_CONTEXT_STATUS_PRESENT)
== TRACKING_AREA_UPDATE_ACCEPT_EPS_BEARER_CONTEXT_STATUS_PRESENT) {
if ((encode_result =
encode_eps_bearer_context_status(&tracking_area_update_accept->epsbearercontextstatus,
TRACKING_AREA_UPDATE_ACCEPT_EPS_BEARER_CONTEXT_STATUS_IEI, buffer
+ encoded, len - encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((tracking_area_update_accept->presencemask & TRACKING_AREA_UPDATE_ACCEPT_LOCATION_AREA_IDENTIFICATION_PRESENT)
== TRACKING_AREA_UPDATE_ACCEPT_LOCATION_AREA_IDENTIFICATION_PRESENT) {
if ((encode_result =
encode_location_area_identification(&tracking_area_update_accept->locationareaidentification,
TRACKING_AREA_UPDATE_ACCEPT_LOCATION_AREA_IDENTIFICATION_IEI,
buffer + encoded, len - encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((tracking_area_update_accept->presencemask & TRACKING_AREA_UPDATE_ACCEPT_MS_IDENTITY_PRESENT)
== TRACKING_AREA_UPDATE_ACCEPT_MS_IDENTITY_PRESENT) {
if ((encode_result =
encode_mobile_identity(&tracking_area_update_accept->msidentity,
TRACKING_AREA_UPDATE_ACCEPT_MS_IDENTITY_IEI, buffer + encoded, len
- encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((tracking_area_update_accept->presencemask & TRACKING_AREA_UPDATE_ACCEPT_EMM_CAUSE_PRESENT)
== TRACKING_AREA_UPDATE_ACCEPT_EMM_CAUSE_PRESENT) {
if ((encode_result =
encode_emm_cause(&tracking_area_update_accept->emmcause,
TRACKING_AREA_UPDATE_ACCEPT_EMM_CAUSE_IEI, buffer + encoded, len -
encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((tracking_area_update_accept->presencemask & TRACKING_AREA_UPDATE_ACCEPT_T3402_VALUE_PRESENT)
== TRACKING_AREA_UPDATE_ACCEPT_T3402_VALUE_PRESENT) {
if ((encode_result =
encode_gprs_timer(&tracking_area_update_accept->t3402value,
TRACKING_AREA_UPDATE_ACCEPT_T3402_VALUE_IEI, buffer + encoded, len
- encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((tracking_area_update_accept->presencemask & TRACKING_AREA_UPDATE_ACCEPT_T3423_VALUE_PRESENT)
== TRACKING_AREA_UPDATE_ACCEPT_T3423_VALUE_PRESENT) {
if ((encode_result =
encode_gprs_timer(&tracking_area_update_accept->t3423value,
TRACKING_AREA_UPDATE_ACCEPT_T3423_VALUE_IEI, buffer + encoded, len
- encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((tracking_area_update_accept->presencemask & TRACKING_AREA_UPDATE_ACCEPT_EQUIVALENT_PLMNS_PRESENT)
== TRACKING_AREA_UPDATE_ACCEPT_EQUIVALENT_PLMNS_PRESENT) {
if ((encode_result =
encode_plmn_list(&tracking_area_update_accept->equivalentplmns,
TRACKING_AREA_UPDATE_ACCEPT_EQUIVALENT_PLMNS_IEI, buffer +
encoded, len - encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((tracking_area_update_accept->presencemask & TRACKING_AREA_UPDATE_ACCEPT_EMERGENCY_NUMBER_LIST_PRESENT)
== TRACKING_AREA_UPDATE_ACCEPT_EMERGENCY_NUMBER_LIST_PRESENT) {
if ((encode_result =
encode_emergency_number_list(&tracking_area_update_accept->emergencynumberlist,
TRACKING_AREA_UPDATE_ACCEPT_EMERGENCY_NUMBER_LIST_IEI, buffer +
encoded, len - encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((tracking_area_update_accept->presencemask & TRACKING_AREA_UPDATE_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_PRESENT)
== TRACKING_AREA_UPDATE_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_PRESENT) {
if ((encode_result =
encode_eps_network_feature_support(&tracking_area_update_accept->epsnetworkfeaturesupport,
TRACKING_AREA_UPDATE_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_IEI,
buffer + encoded, len - encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((tracking_area_update_accept->presencemask & TRACKING_AREA_UPDATE_ACCEPT_ADDITIONAL_UPDATE_RESULT_PRESENT)
== TRACKING_AREA_UPDATE_ACCEPT_ADDITIONAL_UPDATE_RESULT_PRESENT) {
if ((encode_result =
encode_additional_update_result(&tracking_area_update_accept->additionalupdateresult,
TRACKING_AREA_UPDATE_ACCEPT_ADDITIONAL_UPDATE_RESULT_IEI, buffer +
encoded, len - encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
return encoded;
}
@@ -0,0 +1,141 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "ProtocolDiscriminator.h"
#include "SecurityHeaderType.h"
#include "MessageType.h"
#include "EpsUpdateResult.h"
#include "GprsTimer.h"
#include "EpsMobileIdentity.h"
#include "TrackingAreaIdentityList.h"
#include "EpsBearerContextStatus.h"
#include "LocationAreaIdentification.h"
#include "MobileIdentity.h"
#include "EmmCause.h"
#include "PlmnList.h"
#include "EmergencyNumberList.h"
#include "EpsNetworkFeatureSupport.h"
#include "AdditionalUpdateResult.h"
#ifndef TRACKING_AREA_UPDATE_ACCEPT_H_
#define TRACKING_AREA_UPDATE_ACCEPT_H_
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define TRACKING_AREA_UPDATE_ACCEPT_MINIMUM_LENGTH ( \
EPS_UPDATE_RESULT_MINIMUM_LENGTH )
/* Maximum length macro. Formed by maximum length of each field */
#define TRACKING_AREA_UPDATE_ACCEPT_MAXIMUM_LENGTH ( \
EPS_UPDATE_RESULT_MAXIMUM_LENGTH + \
GPRS_TIMER_MAXIMUM_LENGTH + \
EPS_MOBILE_IDENTITY_MAXIMUM_LENGTH + \
TRACKING_AREA_IDENTITY_LIST_MAXIMUM_LENGTH + \
EPS_BEARER_CONTEXT_STATUS_MAXIMUM_LENGTH + \
LOCATION_AREA_IDENTIFICATION_MAXIMUM_LENGTH + \
MOBILE_IDENTITY_MAXIMUM_LENGTH + \
EMM_CAUSE_MAXIMUM_LENGTH + \
GPRS_TIMER_MAXIMUM_LENGTH + \
GPRS_TIMER_MAXIMUM_LENGTH + \
PLMN_LIST_MAXIMUM_LENGTH + \
EMERGENCY_NUMBER_LIST_MAXIMUM_LENGTH + \
EPS_NETWORK_FEATURE_SUPPORT_MAXIMUM_LENGTH + \
ADDITIONAL_UPDATE_RESULT_MAXIMUM_LENGTH )
/* If an optional value is present and should be encoded, the corresponding
* Bit mask should be set to 1.
*/
# define TRACKING_AREA_UPDATE_ACCEPT_T3412_VALUE_PRESENT (1<<0)
# define TRACKING_AREA_UPDATE_ACCEPT_GUTI_PRESENT (1<<1)
# define TRACKING_AREA_UPDATE_ACCEPT_TAI_LIST_PRESENT (1<<2)
# define TRACKING_AREA_UPDATE_ACCEPT_EPS_BEARER_CONTEXT_STATUS_PRESENT (1<<3)
# define TRACKING_AREA_UPDATE_ACCEPT_LOCATION_AREA_IDENTIFICATION_PRESENT (1<<4)
# define TRACKING_AREA_UPDATE_ACCEPT_MS_IDENTITY_PRESENT (1<<5)
# define TRACKING_AREA_UPDATE_ACCEPT_EMM_CAUSE_PRESENT (1<<6)
# define TRACKING_AREA_UPDATE_ACCEPT_T3402_VALUE_PRESENT (1<<7)
# define TRACKING_AREA_UPDATE_ACCEPT_T3423_VALUE_PRESENT (1<<8)
# define TRACKING_AREA_UPDATE_ACCEPT_EQUIVALENT_PLMNS_PRESENT (1<<9)
# define TRACKING_AREA_UPDATE_ACCEPT_EMERGENCY_NUMBER_LIST_PRESENT (1<<10)
# define TRACKING_AREA_UPDATE_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_PRESENT (1<<11)
# define TRACKING_AREA_UPDATE_ACCEPT_ADDITIONAL_UPDATE_RESULT_PRESENT (1<<12)
typedef enum tracking_area_update_accept_iei_tag {
TRACKING_AREA_UPDATE_ACCEPT_T3412_VALUE_IEI = 0x5A, /* 0x5A = 90 */
TRACKING_AREA_UPDATE_ACCEPT_GUTI_IEI = 0x50, /* 0x50 = 80 */
TRACKING_AREA_UPDATE_ACCEPT_TAI_LIST_IEI = 0x54, /* 0x54 = 84 */
TRACKING_AREA_UPDATE_ACCEPT_EPS_BEARER_CONTEXT_STATUS_IEI = 0x57, /* 0x57 = 87 */
TRACKING_AREA_UPDATE_ACCEPT_LOCATION_AREA_IDENTIFICATION_IEI = 0x13, /* 0x13 = 19 */
TRACKING_AREA_UPDATE_ACCEPT_MS_IDENTITY_IEI = 0x23, /* 0x23 = 35 */
TRACKING_AREA_UPDATE_ACCEPT_EMM_CAUSE_IEI = 0x53, /* 0x53 = 83 */
TRACKING_AREA_UPDATE_ACCEPT_T3402_VALUE_IEI = 0x17, /* 0x17 = 23 */
TRACKING_AREA_UPDATE_ACCEPT_T3423_VALUE_IEI = 0x59, /* 0x59 = 89 */
TRACKING_AREA_UPDATE_ACCEPT_EQUIVALENT_PLMNS_IEI = 0x4A, /* 0x4A = 74 */
TRACKING_AREA_UPDATE_ACCEPT_EMERGENCY_NUMBER_LIST_IEI = 0x34, /* 0x34 = 52 */
TRACKING_AREA_UPDATE_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_IEI = 0x64, /* 0x64 = 100 */
TRACKING_AREA_UPDATE_ACCEPT_ADDITIONAL_UPDATE_RESULT_IEI = 0xF0, /* 0xF0 = 240 */
} tracking_area_update_accept_iei;
/*
* Message name: Tracking area update accept
* Description: This message is sent by the network to the UE to provide the UE with EPS mobility management related data in response to a tracking area update request message. See table 8.2.26.1.
* Significance: dual
* Direction: network to UE
*/
typedef struct tracking_area_update_accept_msg_tag {
/* Mandatory fields */
ProtocolDiscriminator protocoldiscriminator:4;
SecurityHeaderType securityheadertype:4;
MessageType messagetype;
EpsUpdateResult epsupdateresult;
/* Optional fields */
uint32_t presencemask;
GprsTimer t3412value;
EpsMobileIdentity guti;
TrackingAreaIdentityList tailist;
EpsBearerContextStatus epsbearercontextstatus;
LocationAreaIdentification locationareaidentification;
MobileIdentity msidentity;
EmmCause emmcause;
GprsTimer t3402value;
GprsTimer t3423value;
PlmnList equivalentplmns;
EmergencyNumberList emergencynumberlist;
EpsNetworkFeatureSupport epsnetworkfeaturesupport;
AdditionalUpdateResult additionalupdateresult;
} tracking_area_update_accept_msg;
int decode_tracking_area_update_accept(tracking_area_update_accept_msg *trackingareaupdateaccept, uint8_t *buffer, uint32_t len);
int encode_tracking_area_update_accept(tracking_area_update_accept_msg *trackingareaupdateaccept, uint8_t *buffer, uint32_t len);
#endif /* ! defined(TRACKING_AREA_UPDATE_ACCEPT_H_) */
@@ -0,0 +1,57 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "TrackingAreaUpdateComplete.h"
int decode_tracking_area_update_complete(tracking_area_update_complete_msg *tracking_area_update_complete, uint8_t *buffer, uint32_t len)
{
uint32_t decoded = 0;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, TRACKING_AREA_UPDATE_COMPLETE_MINIMUM_LENGTH, len);
/* Decoding mandatory fields */
return decoded;
}
int encode_tracking_area_update_complete(tracking_area_update_complete_msg *tracking_area_update_complete, uint8_t *buffer, uint32_t len)
{
int encoded = 0;
/* Checking IEI and pointer */
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, TRACKING_AREA_UPDATE_COMPLETE_MINIMUM_LENGTH, len);
return encoded;
}
@@ -0,0 +1,65 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "ProtocolDiscriminator.h"
#include "SecurityHeaderType.h"
#include "MessageType.h"
#ifndef TRACKING_AREA_UPDATE_COMPLETE_H_
#define TRACKING_AREA_UPDATE_COMPLETE_H_
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define TRACKING_AREA_UPDATE_COMPLETE_MINIMUM_LENGTH (0)
/* Maximum length macro. Formed by maximum length of each field */
#define TRACKING_AREA_UPDATE_COMPLETE_MAXIMUM_LENGTH (0)
/*
* Message name: Tracking area update complete
* Description: This message shall be sent by the UE to the network in response to a tracking area update accept message if a GUTI has been changed or a new TMSI has been assigned. See table 8.2.27.1.
* Significance: dual
* Direction: UE to network
*/
typedef struct tracking_area_update_complete_msg_tag {
/* Mandatory fields */
ProtocolDiscriminator protocoldiscriminator:4;
SecurityHeaderType securityheadertype:4;
MessageType messagetype;
} tracking_area_update_complete_msg;
int decode_tracking_area_update_complete(tracking_area_update_complete_msg *trackingareaupdatecomplete, uint8_t *buffer, uint32_t len);
int encode_tracking_area_update_complete(tracking_area_update_complete_msg *trackingareaupdatecomplete, uint8_t *buffer, uint32_t len);
#endif /* ! defined(TRACKING_AREA_UPDATE_COMPLETE_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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "TrackingAreaUpdateReject.h"
int decode_tracking_area_update_reject(tracking_area_update_reject_msg *tracking_area_update_reject, uint8_t *buffer, uint32_t len)
{
uint32_t decoded = 0;
int decoded_result = 0;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, TRACKING_AREA_UPDATE_REJECT_MINIMUM_LENGTH, len);
/* Decoding mandatory fields */
if ((decoded_result = decode_emm_cause(&tracking_area_update_reject->emmcause, 0, buffer + decoded, len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
return decoded;
}
int encode_tracking_area_update_reject(tracking_area_update_reject_msg *tracking_area_update_reject, uint8_t *buffer, uint32_t len)
{
int encoded = 0;
int encode_result = 0;
/* Checking IEI and pointer */
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, TRACKING_AREA_UPDATE_REJECT_MINIMUM_LENGTH, len);
if ((encode_result =
encode_emm_cause(&tracking_area_update_reject->emmcause, 0, buffer +
encoded, len - encoded)) < 0) //Return in case of error
return encode_result;
else
encoded += encode_result;
return encoded;
}
@@ -0,0 +1,70 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "ProtocolDiscriminator.h"
#include "SecurityHeaderType.h"
#include "MessageType.h"
#include "EmmCause.h"
#ifndef TRACKING_AREA_UPDATE_REJECT_H_
#define TRACKING_AREA_UPDATE_REJECT_H_
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define TRACKING_AREA_UPDATE_REJECT_MINIMUM_LENGTH ( \
EMM_CAUSE_MINIMUM_LENGTH )
/* Maximum length macro. Formed by maximum length of each field */
#define TRACKING_AREA_UPDATE_REJECT_MAXIMUM_LENGTH ( \
EMM_CAUSE_MAXIMUM_LENGTH )
/*
* Message name: Tracking area update reject
* Description: This message is sent by the network to the UE in order to reject the tracking area updating procedure. See table 8.2.28.1.
* Significance: dual
* Direction: network to UE
*/
typedef struct tracking_area_update_reject_msg_tag {
/* Mandatory fields */
ProtocolDiscriminator protocoldiscriminator:4;
SecurityHeaderType securityheadertype:4;
MessageType messagetype;
EmmCause emmcause;
} tracking_area_update_reject_msg;
int decode_tracking_area_update_reject(tracking_area_update_reject_msg *trackingareaupdatereject, uint8_t *buffer, uint32_t len);
int encode_tracking_area_update_reject(tracking_area_update_reject_msg *trackingareaupdatereject, uint8_t *buffer, uint32_t len);
#endif /* ! defined(TRACKING_AREA_UPDATE_REJECT_H_) */
@@ -0,0 +1,532 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "TrackingAreaUpdateRequest.h"
int decode_tracking_area_update_request(tracking_area_update_request_msg *tracking_area_update_request, uint8_t *buffer, uint32_t len)
{
uint32_t decoded = 0;
int decoded_result = 0;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, TRACKING_AREA_UPDATE_REQUEST_MINIMUM_LENGTH, len);
/* Decoding mandatory fields */
if ((decoded_result = decode_u8_eps_update_type(&tracking_area_update_request->epsupdatetype, 0, *(buffer + decoded) >> 4, len - decoded)) < 0)
return decoded_result;
if ((decoded_result = decode_u8_nas_key_set_identifier(&tracking_area_update_request->naskeysetidentifier, 0, *(buffer + decoded) & 0x0f, len - decoded)) < 0)
return decoded_result;
decoded++;
if ((decoded_result = decode_eps_mobile_identity(&tracking_area_update_request->oldguti, 0, buffer + decoded, len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
/* Decoding optional fields */
while(len - decoded > 0) {
uint8_t ieiDecoded = *(buffer + decoded);
/* Type | value iei are below 0x80 so just return the first 4 bits */
if (ieiDecoded >= 0x80)
ieiDecoded = ieiDecoded & 0xf0;
switch(ieiDecoded) {
case TRACKING_AREA_UPDATE_REQUEST_NONCURRENT_NATIVE_NAS_KEY_SET_IDENTIFIER_IEI:
if ((decoded_result =
decode_nas_key_set_identifier(&tracking_area_update_request->noncurrentnativenaskeysetidentifier,
TRACKING_AREA_UPDATE_REQUEST_NONCURRENT_NATIVE_NAS_KEY_SET_IDENTIFIER_IEI,
buffer + decoded, len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
tracking_area_update_request->presencemask |= TRACKING_AREA_UPDATE_REQUEST_NONCURRENT_NATIVE_NAS_KEY_SET_IDENTIFIER_PRESENT;
break;
case TRACKING_AREA_UPDATE_REQUEST_GPRS_CIPHERING_KEY_SEQUENCE_NUMBER_IEI:
if ((decoded_result =
decode_ciphering_key_sequence_number(&tracking_area_update_request->gprscipheringkeysequencenumber,
TRACKING_AREA_UPDATE_REQUEST_GPRS_CIPHERING_KEY_SEQUENCE_NUMBER_IEI,
buffer + decoded, len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
tracking_area_update_request->presencemask |= TRACKING_AREA_UPDATE_REQUEST_GPRS_CIPHERING_KEY_SEQUENCE_NUMBER_PRESENT;
break;
case TRACKING_AREA_UPDATE_REQUEST_OLD_PTMSI_SIGNATURE_IEI:
if ((decoded_result =
decode_p_tmsi_signature(&tracking_area_update_request->oldptmsisignature,
TRACKING_AREA_UPDATE_REQUEST_OLD_PTMSI_SIGNATURE_IEI,
buffer + decoded, len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
tracking_area_update_request->presencemask |= TRACKING_AREA_UPDATE_REQUEST_OLD_PTMSI_SIGNATURE_PRESENT;
break;
case TRACKING_AREA_UPDATE_REQUEST_ADDITIONAL_GUTI_IEI:
if ((decoded_result =
decode_eps_mobile_identity(&tracking_area_update_request->additionalguti,
TRACKING_AREA_UPDATE_REQUEST_ADDITIONAL_GUTI_IEI, buffer +
decoded, len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
tracking_area_update_request->presencemask |= TRACKING_AREA_UPDATE_REQUEST_ADDITIONAL_GUTI_PRESENT;
break;
case TRACKING_AREA_UPDATE_REQUEST_NONCEUE_IEI:
if ((decoded_result =
decode_nonce(&tracking_area_update_request->nonceue,
TRACKING_AREA_UPDATE_REQUEST_NONCEUE_IEI, buffer + decoded,
len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
tracking_area_update_request->presencemask |= TRACKING_AREA_UPDATE_REQUEST_NONCEUE_PRESENT;
break;
case TRACKING_AREA_UPDATE_REQUEST_UE_NETWORK_CAPABILITY_IEI:
if ((decoded_result =
decode_ue_network_capability(&tracking_area_update_request->uenetworkcapability,
TRACKING_AREA_UPDATE_REQUEST_UE_NETWORK_CAPABILITY_IEI,
buffer + decoded, len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
tracking_area_update_request->presencemask |= TRACKING_AREA_UPDATE_REQUEST_UE_NETWORK_CAPABILITY_PRESENT;
break;
case TRACKING_AREA_UPDATE_REQUEST_LAST_VISITED_REGISTERED_TAI_IEI:
if ((decoded_result =
decode_tracking_area_identity(&tracking_area_update_request->lastvisitedregisteredtai,
TRACKING_AREA_UPDATE_REQUEST_LAST_VISITED_REGISTERED_TAI_IEI,
buffer + decoded, len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
tracking_area_update_request->presencemask |= TRACKING_AREA_UPDATE_REQUEST_LAST_VISITED_REGISTERED_TAI_PRESENT;
break;
case TRACKING_AREA_UPDATE_REQUEST_DRX_PARAMETER_IEI:
if ((decoded_result =
decode_drx_parameter(&tracking_area_update_request->drxparameter,
TRACKING_AREA_UPDATE_REQUEST_DRX_PARAMETER_IEI, buffer +
decoded, len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
tracking_area_update_request->presencemask |= TRACKING_AREA_UPDATE_REQUEST_DRX_PARAMETER_PRESENT;
break;
case TRACKING_AREA_UPDATE_REQUEST_UE_RADIO_CAPABILITY_INFORMATION_UPDATE_NEEDED_IEI:
if ((decoded_result =
decode_ue_radio_capability_information_update_needed(&tracking_area_update_request->ueradiocapabilityinformationupdateneeded,
TRACKING_AREA_UPDATE_REQUEST_UE_RADIO_CAPABILITY_INFORMATION_UPDATE_NEEDED_IEI,
buffer + decoded, len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
tracking_area_update_request->presencemask |= TRACKING_AREA_UPDATE_REQUEST_UE_RADIO_CAPABILITY_INFORMATION_UPDATE_NEEDED_PRESENT;
break;
case TRACKING_AREA_UPDATE_REQUEST_EPS_BEARER_CONTEXT_STATUS_IEI:
if ((decoded_result =
decode_eps_bearer_context_status(&tracking_area_update_request->epsbearercontextstatus,
TRACKING_AREA_UPDATE_REQUEST_EPS_BEARER_CONTEXT_STATUS_IEI,
buffer + decoded, len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
tracking_area_update_request->presencemask |= TRACKING_AREA_UPDATE_REQUEST_EPS_BEARER_CONTEXT_STATUS_PRESENT;
break;
case TRACKING_AREA_UPDATE_REQUEST_MS_NETWORK_CAPABILITY_IEI:
if ((decoded_result =
decode_ms_network_capability(&tracking_area_update_request->msnetworkcapability,
TRACKING_AREA_UPDATE_REQUEST_MS_NETWORK_CAPABILITY_IEI,
buffer + decoded, len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
tracking_area_update_request->presencemask |= TRACKING_AREA_UPDATE_REQUEST_MS_NETWORK_CAPABILITY_PRESENT;
break;
case TRACKING_AREA_UPDATE_REQUEST_OLD_LOCATION_AREA_IDENTIFICATION_IEI:
if ((decoded_result =
decode_location_area_identification(&tracking_area_update_request->oldlocationareaidentification,
TRACKING_AREA_UPDATE_REQUEST_OLD_LOCATION_AREA_IDENTIFICATION_IEI,
buffer + decoded, len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
tracking_area_update_request->presencemask |= TRACKING_AREA_UPDATE_REQUEST_OLD_LOCATION_AREA_IDENTIFICATION_PRESENT;
break;
case TRACKING_AREA_UPDATE_REQUEST_TMSI_STATUS_IEI:
if ((decoded_result =
decode_tmsi_status(&tracking_area_update_request->tmsistatus,
TRACKING_AREA_UPDATE_REQUEST_TMSI_STATUS_IEI, buffer +
decoded, len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
tracking_area_update_request->presencemask |= TRACKING_AREA_UPDATE_REQUEST_TMSI_STATUS_PRESENT;
break;
case TRACKING_AREA_UPDATE_REQUEST_MOBILE_STATION_CLASSMARK_2_IEI:
if ((decoded_result =
decode_mobile_station_classmark_2(&tracking_area_update_request->mobilestationclassmark2,
TRACKING_AREA_UPDATE_REQUEST_MOBILE_STATION_CLASSMARK_2_IEI,
buffer + decoded, len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
tracking_area_update_request->presencemask |= TRACKING_AREA_UPDATE_REQUEST_MOBILE_STATION_CLASSMARK_2_PRESENT;
break;
case TRACKING_AREA_UPDATE_REQUEST_MOBILE_STATION_CLASSMARK_3_IEI:
if ((decoded_result =
decode_mobile_station_classmark_3(&tracking_area_update_request->mobilestationclassmark3,
TRACKING_AREA_UPDATE_REQUEST_MOBILE_STATION_CLASSMARK_3_IEI,
buffer + decoded, len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
tracking_area_update_request->presencemask |= TRACKING_AREA_UPDATE_REQUEST_MOBILE_STATION_CLASSMARK_3_PRESENT;
break;
case TRACKING_AREA_UPDATE_REQUEST_SUPPORTED_CODECS_IEI:
if ((decoded_result =
decode_supported_codec_list(&tracking_area_update_request->supportedcodecs,
TRACKING_AREA_UPDATE_REQUEST_SUPPORTED_CODECS_IEI, buffer +
decoded, len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
tracking_area_update_request->presencemask |= TRACKING_AREA_UPDATE_REQUEST_SUPPORTED_CODECS_PRESENT;
break;
case TRACKING_AREA_UPDATE_REQUEST_ADDITIONAL_UPDATE_TYPE_IEI:
if ((decoded_result =
decode_additional_update_type(&tracking_area_update_request->additionalupdatetype,
TRACKING_AREA_UPDATE_REQUEST_ADDITIONAL_UPDATE_TYPE_IEI,
buffer + decoded, len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
tracking_area_update_request->presencemask |= TRACKING_AREA_UPDATE_REQUEST_ADDITIONAL_UPDATE_TYPE_PRESENT;
break;
case TRACKING_AREA_UPDATE_REQUEST_OLD_GUTI_TYPE_IEI:
if ((decoded_result =
decode_guti_type(&tracking_area_update_request->oldgutitype,
TRACKING_AREA_UPDATE_REQUEST_OLD_GUTI_TYPE_IEI,
buffer + decoded, len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
tracking_area_update_request->presencemask |= TRACKING_AREA_UPDATE_REQUEST_OLD_GUTI_TYPE_PRESENT;
break;
default:
errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI;
return TLV_DECODE_UNEXPECTED_IEI;
}
}
return decoded;
}
int encode_tracking_area_update_request(tracking_area_update_request_msg *tracking_area_update_request, uint8_t *buffer, uint32_t len)
{
int encoded = 0;
int encode_result = 0;
/* Checking IEI and pointer */
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, TRACKING_AREA_UPDATE_REQUEST_MINIMUM_LENGTH, len);
*(buffer + encoded) = ((encode_u8_eps_update_type(&tracking_area_update_request->epsupdatetype) & 0x0f) << 4) | (encode_u8_nas_key_set_identifier(
&tracking_area_update_request->naskeysetidentifier) & 0x0f);
encoded++;
if ((encode_result =
encode_eps_mobile_identity(&tracking_area_update_request->oldguti, 0,
buffer + encoded, len - encoded)) < 0) //Return in case of error
return encode_result;
else
encoded += encode_result;
if ((tracking_area_update_request->presencemask & TRACKING_AREA_UPDATE_REQUEST_NONCURRENT_NATIVE_NAS_KEY_SET_IDENTIFIER_PRESENT)
== TRACKING_AREA_UPDATE_REQUEST_NONCURRENT_NATIVE_NAS_KEY_SET_IDENTIFIER_PRESENT) {
if ((encode_result =
encode_nas_key_set_identifier(&tracking_area_update_request->noncurrentnativenaskeysetidentifier,
TRACKING_AREA_UPDATE_REQUEST_NONCURRENT_NATIVE_NAS_KEY_SET_IDENTIFIER_IEI,
buffer + encoded, len - encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((tracking_area_update_request->presencemask & TRACKING_AREA_UPDATE_REQUEST_GPRS_CIPHERING_KEY_SEQUENCE_NUMBER_PRESENT)
== TRACKING_AREA_UPDATE_REQUEST_GPRS_CIPHERING_KEY_SEQUENCE_NUMBER_PRESENT) {
if ((encode_result =
encode_ciphering_key_sequence_number(&tracking_area_update_request->gprscipheringkeysequencenumber,
TRACKING_AREA_UPDATE_REQUEST_GPRS_CIPHERING_KEY_SEQUENCE_NUMBER_IEI,
buffer + encoded, len - encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((tracking_area_update_request->presencemask & TRACKING_AREA_UPDATE_REQUEST_OLD_PTMSI_SIGNATURE_PRESENT)
== TRACKING_AREA_UPDATE_REQUEST_OLD_PTMSI_SIGNATURE_PRESENT) {
if ((encode_result =
encode_p_tmsi_signature(&tracking_area_update_request->oldptmsisignature,
TRACKING_AREA_UPDATE_REQUEST_OLD_PTMSI_SIGNATURE_IEI, buffer +
encoded, len - encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((tracking_area_update_request->presencemask & TRACKING_AREA_UPDATE_REQUEST_ADDITIONAL_GUTI_PRESENT)
== TRACKING_AREA_UPDATE_REQUEST_ADDITIONAL_GUTI_PRESENT) {
if ((encode_result =
encode_eps_mobile_identity(&tracking_area_update_request->additionalguti,
TRACKING_AREA_UPDATE_REQUEST_ADDITIONAL_GUTI_IEI, buffer +
encoded, len - encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((tracking_area_update_request->presencemask & TRACKING_AREA_UPDATE_REQUEST_NONCEUE_PRESENT)
== TRACKING_AREA_UPDATE_REQUEST_NONCEUE_PRESENT) {
if ((encode_result =
encode_nonce(&tracking_area_update_request->nonceue,
TRACKING_AREA_UPDATE_REQUEST_NONCEUE_IEI, buffer + encoded, len -
encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((tracking_area_update_request->presencemask & TRACKING_AREA_UPDATE_REQUEST_UE_NETWORK_CAPABILITY_PRESENT)
== TRACKING_AREA_UPDATE_REQUEST_UE_NETWORK_CAPABILITY_PRESENT) {
if ((encode_result =
encode_ue_network_capability(&tracking_area_update_request->uenetworkcapability,
TRACKING_AREA_UPDATE_REQUEST_UE_NETWORK_CAPABILITY_IEI, buffer +
encoded, len - encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((tracking_area_update_request->presencemask & TRACKING_AREA_UPDATE_REQUEST_LAST_VISITED_REGISTERED_TAI_PRESENT)
== TRACKING_AREA_UPDATE_REQUEST_LAST_VISITED_REGISTERED_TAI_PRESENT) {
if ((encode_result =
encode_tracking_area_identity(&tracking_area_update_request->lastvisitedregisteredtai,
TRACKING_AREA_UPDATE_REQUEST_LAST_VISITED_REGISTERED_TAI_IEI,
buffer + encoded, len - encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((tracking_area_update_request->presencemask & TRACKING_AREA_UPDATE_REQUEST_DRX_PARAMETER_PRESENT)
== TRACKING_AREA_UPDATE_REQUEST_DRX_PARAMETER_PRESENT) {
if ((encode_result =
encode_drx_parameter(&tracking_area_update_request->drxparameter,
TRACKING_AREA_UPDATE_REQUEST_DRX_PARAMETER_IEI, buffer + encoded,
len - encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((tracking_area_update_request->presencemask & TRACKING_AREA_UPDATE_REQUEST_UE_RADIO_CAPABILITY_INFORMATION_UPDATE_NEEDED_PRESENT)
== TRACKING_AREA_UPDATE_REQUEST_UE_RADIO_CAPABILITY_INFORMATION_UPDATE_NEEDED_PRESENT) {
if ((encode_result =
encode_ue_radio_capability_information_update_needed(&tracking_area_update_request->ueradiocapabilityinformationupdateneeded,
TRACKING_AREA_UPDATE_REQUEST_UE_RADIO_CAPABILITY_INFORMATION_UPDATE_NEEDED_IEI,
buffer + encoded, len - encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((tracking_area_update_request->presencemask & TRACKING_AREA_UPDATE_REQUEST_EPS_BEARER_CONTEXT_STATUS_PRESENT)
== TRACKING_AREA_UPDATE_REQUEST_EPS_BEARER_CONTEXT_STATUS_PRESENT) {
if ((encode_result =
encode_eps_bearer_context_status(&tracking_area_update_request->epsbearercontextstatus,
TRACKING_AREA_UPDATE_REQUEST_EPS_BEARER_CONTEXT_STATUS_IEI, buffer
+ encoded, len - encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((tracking_area_update_request->presencemask & TRACKING_AREA_UPDATE_REQUEST_MS_NETWORK_CAPABILITY_PRESENT)
== TRACKING_AREA_UPDATE_REQUEST_MS_NETWORK_CAPABILITY_PRESENT) {
if ((encode_result =
encode_ms_network_capability(&tracking_area_update_request->msnetworkcapability,
TRACKING_AREA_UPDATE_REQUEST_MS_NETWORK_CAPABILITY_IEI, buffer +
encoded, len - encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((tracking_area_update_request->presencemask & TRACKING_AREA_UPDATE_REQUEST_OLD_LOCATION_AREA_IDENTIFICATION_PRESENT)
== TRACKING_AREA_UPDATE_REQUEST_OLD_LOCATION_AREA_IDENTIFICATION_PRESENT) {
if ((encode_result =
encode_location_area_identification(&tracking_area_update_request->oldlocationareaidentification,
TRACKING_AREA_UPDATE_REQUEST_OLD_LOCATION_AREA_IDENTIFICATION_IEI,
buffer + encoded, len - encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((tracking_area_update_request->presencemask & TRACKING_AREA_UPDATE_REQUEST_TMSI_STATUS_PRESENT)
== TRACKING_AREA_UPDATE_REQUEST_TMSI_STATUS_PRESENT) {
if ((encode_result =
encode_tmsi_status(&tracking_area_update_request->tmsistatus,
TRACKING_AREA_UPDATE_REQUEST_TMSI_STATUS_IEI, buffer + encoded,
len - encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((tracking_area_update_request->presencemask & TRACKING_AREA_UPDATE_REQUEST_MOBILE_STATION_CLASSMARK_2_PRESENT)
== TRACKING_AREA_UPDATE_REQUEST_MOBILE_STATION_CLASSMARK_2_PRESENT) {
if ((encode_result =
encode_mobile_station_classmark_2(&tracking_area_update_request->mobilestationclassmark2,
TRACKING_AREA_UPDATE_REQUEST_MOBILE_STATION_CLASSMARK_2_IEI,
buffer + encoded, len - encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((tracking_area_update_request->presencemask & TRACKING_AREA_UPDATE_REQUEST_MOBILE_STATION_CLASSMARK_3_PRESENT)
== TRACKING_AREA_UPDATE_REQUEST_MOBILE_STATION_CLASSMARK_3_PRESENT) {
if ((encode_result =
encode_mobile_station_classmark_3(&tracking_area_update_request->mobilestationclassmark3,
TRACKING_AREA_UPDATE_REQUEST_MOBILE_STATION_CLASSMARK_3_IEI,
buffer + encoded, len - encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((tracking_area_update_request->presencemask & TRACKING_AREA_UPDATE_REQUEST_SUPPORTED_CODECS_PRESENT)
== TRACKING_AREA_UPDATE_REQUEST_SUPPORTED_CODECS_PRESENT) {
if ((encode_result =
encode_supported_codec_list(&tracking_area_update_request->supportedcodecs,
TRACKING_AREA_UPDATE_REQUEST_SUPPORTED_CODECS_IEI, buffer +
encoded, len - encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((tracking_area_update_request->presencemask & TRACKING_AREA_UPDATE_REQUEST_ADDITIONAL_UPDATE_TYPE_PRESENT)
== TRACKING_AREA_UPDATE_REQUEST_ADDITIONAL_UPDATE_TYPE_PRESENT) {
if ((encode_result =
encode_additional_update_type(&tracking_area_update_request->additionalupdatetype,
TRACKING_AREA_UPDATE_REQUEST_ADDITIONAL_UPDATE_TYPE_IEI, buffer +
encoded, len - encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
if ((tracking_area_update_request->presencemask & TRACKING_AREA_UPDATE_REQUEST_OLD_GUTI_TYPE_PRESENT)
== TRACKING_AREA_UPDATE_REQUEST_OLD_GUTI_TYPE_PRESENT) {
if ((encode_result =
encode_guti_type(&tracking_area_update_request->oldgutitype,
TRACKING_AREA_UPDATE_REQUEST_OLD_GUTI_TYPE_IEI,
buffer + encoded, len - encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
return encoded;
}
@@ -0,0 +1,173 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "ProtocolDiscriminator.h"
#include "SecurityHeaderType.h"
#include "MessageType.h"
#include "EpsUpdateType.h"
#include "NasKeySetIdentifier.h"
#include "EpsMobileIdentity.h"
#include "CipheringKeySequenceNumber.h"
#include "PTmsiSignature.h"
#include "Nonce.h"
#include "UeNetworkCapability.h"
#include "TrackingAreaIdentity.h"
#include "DrxParameter.h"
#include "UeRadioCapabilityInformationUpdateNeeded.h"
#include "EpsBearerContextStatus.h"
#include "MsNetworkCapability.h"
#include "LocationAreaIdentification.h"
#include "TmsiStatus.h"
#include "MobileStationClassmark2.h"
#include "MobileStationClassmark3.h"
#include "SupportedCodecList.h"
#include "AdditionalUpdateType.h"
#include "GutiType.h"
#ifndef TRACKING_AREA_UPDATE_REQUEST_H_
#define TRACKING_AREA_UPDATE_REQUEST_H_
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define TRACKING_AREA_UPDATE_REQUEST_MINIMUM_LENGTH ( \
EPS_UPDATE_TYPE_MINIMUM_LENGTH + \
NAS_KEY_SET_IDENTIFIER_MINIMUM_LENGTH + \
EPS_MOBILE_IDENTITY_MINIMUM_LENGTH )
/* Maximum length macro. Formed by maximum length of each field */
#define TRACKING_AREA_UPDATE_REQUEST_MAXIMUM_LENGTH ( \
EPS_UPDATE_TYPE_MAXIMUM_LENGTH + \
NAS_KEY_SET_IDENTIFIER_MAXIMUM_LENGTH + \
EPS_MOBILE_IDENTITY_MAXIMUM_LENGTH + \
NAS_KEY_SET_IDENTIFIER_MAXIMUM_LENGTH + \
CIPHERING_KEY_SEQUENCE_NUMBER_MAXIMUM_LENGTH + \
P_TMSI_SIGNATURE_MAXIMUM_LENGTH + \
EPS_MOBILE_IDENTITY_MAXIMUM_LENGTH + \
NONCE_MAXIMUM_LENGTH + \
UE_NETWORK_CAPABILITY_MAXIMUM_LENGTH + \
TRACKING_AREA_IDENTITY_MAXIMUM_LENGTH + \
DRX_PARAMETER_MAXIMUM_LENGTH + \
UE_RADIO_CAPABILITY_INFORMATION_UPDATE_NEEDED_MAXIMUM_LENGTH + \
EPS_BEARER_CONTEXT_STATUS_MAXIMUM_LENGTH + \
MS_NETWORK_CAPABILITY_MAXIMUM_LENGTH + \
LOCATION_AREA_IDENTIFICATION_MAXIMUM_LENGTH + \
TMSI_STATUS_MAXIMUM_LENGTH + \
MOBILE_STATION_CLASSMARK_2_MAXIMUM_LENGTH + \
MOBILE_STATION_CLASSMARK_3_MAXIMUM_LENGTH + \
SUPPORTED_CODEC_LIST_MAXIMUM_LENGTH + \
ADDITIONAL_UPDATE_TYPE_MAXIMUM_LENGTH )
/* If an optional value is present and should be encoded, the corresponding
* Bit mask should be set to 1.
*/
# define TRACKING_AREA_UPDATE_REQUEST_NONCURRENT_NATIVE_NAS_KEY_SET_IDENTIFIER_PRESENT (1<<0)
# define TRACKING_AREA_UPDATE_REQUEST_GPRS_CIPHERING_KEY_SEQUENCE_NUMBER_PRESENT (1<<1)
# define TRACKING_AREA_UPDATE_REQUEST_OLD_PTMSI_SIGNATURE_PRESENT (1<<2)
# define TRACKING_AREA_UPDATE_REQUEST_ADDITIONAL_GUTI_PRESENT (1<<3)
# define TRACKING_AREA_UPDATE_REQUEST_NONCEUE_PRESENT (1<<4)
# define TRACKING_AREA_UPDATE_REQUEST_UE_NETWORK_CAPABILITY_PRESENT (1<<5)
# define TRACKING_AREA_UPDATE_REQUEST_LAST_VISITED_REGISTERED_TAI_PRESENT (1<<6)
# define TRACKING_AREA_UPDATE_REQUEST_DRX_PARAMETER_PRESENT (1<<7)
# define TRACKING_AREA_UPDATE_REQUEST_UE_RADIO_CAPABILITY_INFORMATION_UPDATE_NEEDED_PRESENT (1<<8)
# define TRACKING_AREA_UPDATE_REQUEST_EPS_BEARER_CONTEXT_STATUS_PRESENT (1<<9)
# define TRACKING_AREA_UPDATE_REQUEST_MS_NETWORK_CAPABILITY_PRESENT (1<<10)
# define TRACKING_AREA_UPDATE_REQUEST_OLD_LOCATION_AREA_IDENTIFICATION_PRESENT (1<<11)
# define TRACKING_AREA_UPDATE_REQUEST_TMSI_STATUS_PRESENT (1<<12)
# define TRACKING_AREA_UPDATE_REQUEST_MOBILE_STATION_CLASSMARK_2_PRESENT (1<<13)
# define TRACKING_AREA_UPDATE_REQUEST_MOBILE_STATION_CLASSMARK_3_PRESENT (1<<14)
# define TRACKING_AREA_UPDATE_REQUEST_SUPPORTED_CODECS_PRESENT (1<<15)
# define TRACKING_AREA_UPDATE_REQUEST_ADDITIONAL_UPDATE_TYPE_PRESENT (1<<16)
# define TRACKING_AREA_UPDATE_REQUEST_OLD_GUTI_TYPE_PRESENT (1<<17)
typedef enum tracking_area_update_request_iei_tag {
TRACKING_AREA_UPDATE_REQUEST_NONCURRENT_NATIVE_NAS_KEY_SET_IDENTIFIER_IEI = 0xB0, /* 0xB0 = 176 */
TRACKING_AREA_UPDATE_REQUEST_GPRS_CIPHERING_KEY_SEQUENCE_NUMBER_IEI = 0x80, /* 0x80 = 128 */
TRACKING_AREA_UPDATE_REQUEST_OLD_PTMSI_SIGNATURE_IEI = 0x19, /* 0x19 = 25 */
TRACKING_AREA_UPDATE_REQUEST_ADDITIONAL_GUTI_IEI = 0x50, /* 0x50 = 80 */
TRACKING_AREA_UPDATE_REQUEST_NONCEUE_IEI = 0x55, /* 0x55 = 85 */
TRACKING_AREA_UPDATE_REQUEST_UE_NETWORK_CAPABILITY_IEI = 0x58, /* 0x58 = 88 */
TRACKING_AREA_UPDATE_REQUEST_LAST_VISITED_REGISTERED_TAI_IEI = 0x52, /* 0x52 = 82 */
TRACKING_AREA_UPDATE_REQUEST_DRX_PARAMETER_IEI = 0x5C, /* 0x5C = 92 */
TRACKING_AREA_UPDATE_REQUEST_UE_RADIO_CAPABILITY_INFORMATION_UPDATE_NEEDED_IEI = 0xA0, /* 0xA0 = 160 */
TRACKING_AREA_UPDATE_REQUEST_EPS_BEARER_CONTEXT_STATUS_IEI = 0x57, /* 0x57 = 87 */
TRACKING_AREA_UPDATE_REQUEST_MS_NETWORK_CAPABILITY_IEI = 0x31, /* 0x31 = 49 */
TRACKING_AREA_UPDATE_REQUEST_OLD_LOCATION_AREA_IDENTIFICATION_IEI = 0x13, /* 0x13 = 19 */
TRACKING_AREA_UPDATE_REQUEST_TMSI_STATUS_IEI = 0x90, /* 0x90 = 144 */
TRACKING_AREA_UPDATE_REQUEST_MOBILE_STATION_CLASSMARK_2_IEI = 0x11, /* 0x11 = 17 */
TRACKING_AREA_UPDATE_REQUEST_MOBILE_STATION_CLASSMARK_3_IEI = 0x20, /* 0x20 = 32 */
TRACKING_AREA_UPDATE_REQUEST_SUPPORTED_CODECS_IEI = 0x40, /* 0x40 = 64 */
TRACKING_AREA_UPDATE_REQUEST_ADDITIONAL_UPDATE_TYPE_IEI = 0xF0, /* 0xF0 = 240 */
TRACKING_AREA_UPDATE_REQUEST_OLD_GUTI_TYPE_IEI = 0xE0, /* 0xE0 = 224 */
} tracking_area_update_request_iei;
/*
* Message name: Tracking area update request
* Description: The purposes of sending the tracking area update request by the UE to the network are described in subclause 5.5.3.1. See table 8.2.29.1.
* Significance: dual
* Direction: UE to network
*/
typedef struct tracking_area_update_request_msg_tag {
/* Mandatory fields */
ProtocolDiscriminator protocoldiscriminator:4;
SecurityHeaderType securityheadertype:4;
MessageType messagetype;
EpsUpdateType epsupdatetype;
NasKeySetIdentifier naskeysetidentifier;
EpsMobileIdentity oldguti;
/* Optional fields */
uint32_t presencemask;
NasKeySetIdentifier noncurrentnativenaskeysetidentifier;
CipheringKeySequenceNumber gprscipheringkeysequencenumber;
PTmsiSignature oldptmsisignature;
EpsMobileIdentity additionalguti;
Nonce nonceue;
UeNetworkCapability uenetworkcapability;
TrackingAreaIdentity lastvisitedregisteredtai;
DrxParameter drxparameter;
UeRadioCapabilityInformationUpdateNeeded ueradiocapabilityinformationupdateneeded;
EpsBearerContextStatus epsbearercontextstatus;
MsNetworkCapability msnetworkcapability;
LocationAreaIdentification oldlocationareaidentification;
TmsiStatus tmsistatus;
MobileStationClassmark2 mobilestationclassmark2;
MobileStationClassmark3 mobilestationclassmark3;
SupportedCodecList supportedcodecs;
AdditionalUpdateType additionalupdatetype;
GutiType oldgutitype;
} tracking_area_update_request_msg;
int decode_tracking_area_update_request(tracking_area_update_request_msg *trackingareaupdaterequest, uint8_t *buffer, uint32_t len);
int encode_tracking_area_update_request(tracking_area_update_request_msg *trackingareaupdaterequest, uint8_t *buffer, uint32_t len);
#endif /* ! defined(TRACKING_AREA_UPDATE_REQUEST_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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "UplinkNasTransport.h"
int decode_uplink_nas_transport(uplink_nas_transport_msg *uplink_nas_transport, uint8_t *buffer, uint32_t len)
{
uint32_t decoded = 0;
int decoded_result = 0;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, UPLINK_NAS_TRANSPORT_MINIMUM_LENGTH, len);
/* Decoding mandatory fields */
if ((decoded_result = decode_nas_message_container(&uplink_nas_transport->nasmessagecontainer, 0, buffer + decoded, len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
return decoded;
}
int encode_uplink_nas_transport(uplink_nas_transport_msg *uplink_nas_transport, uint8_t *buffer, uint32_t len)
{
int encoded = 0;
int encode_result = 0;
/* Checking IEI and pointer */
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, UPLINK_NAS_TRANSPORT_MINIMUM_LENGTH, len);
if ((encode_result =
encode_nas_message_container(&uplink_nas_transport->nasmessagecontainer,
0, buffer + encoded, len - encoded)) < 0) //Return in case of error
return encode_result;
else
encoded += encode_result;
return encoded;
}
@@ -0,0 +1,70 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "ProtocolDiscriminator.h"
#include "SecurityHeaderType.h"
#include "MessageType.h"
#include "NasMessageContainer.h"
#ifndef UPLINK_NAS_TRANSPORT_H_
#define UPLINK_NAS_TRANSPORT_H_
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define UPLINK_NAS_TRANSPORT_MINIMUM_LENGTH ( \
NAS_MESSAGE_CONTAINER_MINIMUM_LENGTH )
/* Maximum length macro. Formed by maximum length of each field */
#define UPLINK_NAS_TRANSPORT_MAXIMUM_LENGTH ( \
NAS_MESSAGE_CONTAINER_MAXIMUM_LENGTH )
/*
* Message name: Uplink NAS Transport
* Description: This message is sent by the UE to the network in order to carry an SMS message in encapsulated format. See table 8.2.30.1.
* Significance: dual
* Direction: UE to network
*/
typedef struct uplink_nas_transport_msg_tag {
/* Mandatory fields */
ProtocolDiscriminator protocoldiscriminator:4;
SecurityHeaderType securityheadertype:4;
MessageType messagetype;
NasMessageContainer nasmessagecontainer;
} uplink_nas_transport_msg;
int decode_uplink_nas_transport(uplink_nas_transport_msg *uplinknastransport, uint8_t *buffer, uint32_t len);
int encode_uplink_nas_transport(uplink_nas_transport_msg *uplinknastransport, uint8_t *buffer, uint32_t len);
#endif /* ! defined(UPLINK_NAS_TRANSPORT_H_) */
+132
View File
@@ -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 <http://www.gnu.org/licenses/>.
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_cause.h
Version 0.1
Date 2013/01/30
Product NAS stack
Subsystem EPS Mobility Management
Author Frederic Maurel
Description Defines error cause code returned upon receiving unknown,
unforeseen, and erroneous EPS mobility management protocol
data.
*****************************************************************************/
#ifndef __EMM_CAUSE_H__
#define __EMM_CAUSE_H__
/****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/
/****************************************************************************/
/*
* Cause code used to notify that the EPS mobility management procedure
* has been successfully processed
*/
#define EMM_CAUSE_SUCCESS (-1)
/*
* Causes related to UE identification (TS 24.301 - Annex A1)
*/
#define EMM_CAUSE_IMSI_UNKNOWN_IN_HSS 2
#define EMM_CAUSE_ILLEGAL_UE 3
#define EMM_CAUSE_ILLEGAL_ME 6
#define EMM_CAUSE_INVALID_UE 9
#define EMM_CAUSE_IMPLICITLY_DETACHED 10
/*
* Causes related to subscription options (TS 24.301 - Annex A2)
*/
#define EMM_CAUSE_IMEI_NOT_ACCEPTED 5
#define EMM_CAUSE_EPS_NOT_ALLOWED 7
#define EMM_CAUSE_BOTH_NOT_ALLOWED 8
#define EMM_CAUSE_PLMN_NOT_ALLOWED 11
#define EMM_CAUSE_TA_NOT_ALLOWED 12
#define EMM_CAUSE_ROAMING_NOT_ALLOWED 13
#define EMM_CAUSE_EPS_NOT_ALLOWED_IN_PLMN 14
#define EMM_CAUSE_NO_SUITABLE_CELLS 15
#define EMM_CAUSE_CSG_NOT_AUTHORIZED 25
#define EMM_CAUSE_NOT_AUTHORIZED_IN_PLMN 35
#define EMM_CAUSE_NO_EPS_BEARER_CTX_ACTIVE 40
/*
* Causes related to PLMN specific network failures and congestion/
* authentication failures (TS 24.301 - Annex A3)
*/
#define EMM_CAUSE_MSC_NOT_REACHABLE 16
#define EMM_CAUSE_NETWORK_FAILURE 17
#define EMM_CAUSE_CS_DOMAIN_NOT_AVAILABLE 18
#define EMM_CAUSE_ESM_FAILURE 19
#define EMM_CAUSE_MAC_FAILURE 20
#define EMM_CAUSE_SYNCH_FAILURE 21
#define EMM_CAUSE_CONGESTION 22
#define EMM_CAUSE_UE_SECURITY_MISMATCH 23
#define EMM_CAUSE_SECURITY_MODE_REJECTED 24
#define EMM_CAUSE_NON_EPS_AUTH_UNACCEPTABLE 26
#define EMM_CAUSE_CS_SERVICE_NOT_AVAILABLE 39
/*
* Causes related to invalid messages (TS 24.301 - Annex A5)
*/
#define EMM_CAUSE_SEMANTICALLY_INCORRECT 95
#define EMM_CAUSE_INVALID_MANDATORY_INFO 96
#define EMM_CAUSE_MESSAGE_TYPE_NOT_IMPLEMENTED 97
#define EMM_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE 98
#define EMM_CAUSE_IE_NOT_IMPLEMENTED 99
#define EMM_CAUSE_CONDITIONAL_IE_ERROR 100
#define EMM_CAUSE_MESSAGE_NOT_COMPATIBLE 101
#define EMM_CAUSE_PROTOCOL_ERROR 111
/*
* TS 24.301 - Table 9.9.3.9.1
* Any other value received by the mobile station shall be treated as cause
* code #111 "protocol error, unspecified".
* Any other value received by the network shall be treated as cause code #111
* "protocol error, unspecified".
*/
/****************************************************************************/
/************************ 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 ******************/
/****************************************************************************/
#endif /* __EMM_CAUSE_H__*/
+568
View File
@@ -0,0 +1,568 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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_msg.c
Version 0.1
Date 2012/09/27
Product NAS stack
Subsystem EPS Mobility Management
Author Frederic Maurel, Sebastien Roux
Description Defines EPS Mobility Management messages
*****************************************************************************/
#include "emm_msg.h"
#include "commonDef.h"
#include "nas_log.h"
#include "TLVDecoder.h"
#include "TLVEncoder.h"
#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE)))
# include "nas_itti_messaging.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 *******************/
/****************************************************************************/
static int _emm_msg_decode_header(emm_msg_header_t *header,
const uint8_t *buffer, uint32_t len);
static int _emm_msg_encode_header(const emm_msg_header_t *header,
uint8_t *buffer, uint32_t len);
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
/****************************************************************************
** **
** Name: emm_msg_decode() **
** **
** Description: Decode EPS Mobility Management messages **
** **
** Inputs: buffer: Pointer to the buffer containing the EMM **
** message data **
** len: Number of bytes that should be decoded **
** Others: None **
** **
** Outputs: msg: The EMM message structure to be filled **
** Return: The number of bytes in the buffer if data **
** have been successfully decoded; **
** A negative error code otherwise. **
** Others: None **
** **
***************************************************************************/
int emm_msg_decode(EMM_msg *msg, uint8_t *buffer, uint32_t len)
{
LOG_FUNC_IN;
int header_result;
int decode_result;
#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE)))
uint8_t *buffer_log = buffer;
uint32_t len_log = len;
int down_link;
# if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)))
down_link = 0;
# else
down_link = 1;
# endif
#endif
/* First decode the EMM message header */
header_result = _emm_msg_decode_header(&msg->header, buffer, len);
if (header_result < 0) {
LOG_TRACE(ERROR, "EMM-MSG - Failed to decode EMM message header "
"(%d)", header_result);
LOG_FUNC_RETURN(header_result);
}
buffer += header_result;
len -= header_result;
LOG_TRACE(INFO, "EMM-MSG - Message Type 0x%02x", msg->header.message_type);
switch(msg->header.message_type) {
case EMM_INFORMATION:
decode_result = decode_emm_information(&msg->emm_information, buffer, len);
break;
case UPLINK_NAS_TRANSPORT:
decode_result = decode_uplink_nas_transport(&msg->uplink_nas_transport, buffer,
len);
break;
case AUTHENTICATION_REJECT:
decode_result = decode_authentication_reject(&msg->authentication_reject,
buffer, len);
break;
case AUTHENTICATION_FAILURE:
decode_result = decode_authentication_failure(&msg->authentication_failure,
buffer, len);
break;
case DETACH_ACCEPT:
decode_result = decode_detach_accept(&msg->detach_accept, buffer, len);
break;
case SERVICE_REJECT:
decode_result = decode_service_reject(&msg->service_reject, buffer, len);
break;
case AUTHENTICATION_REQUEST:
decode_result = decode_authentication_request(&msg->authentication_request,
buffer, len);
break;
case TRACKING_AREA_UPDATE_REQUEST:
decode_result = decode_tracking_area_update_request(
&msg->tracking_area_update_request, buffer, len);
break;
case ATTACH_REQUEST:
decode_result = decode_attach_request(&msg->attach_request, buffer, len);
break;
case EMM_STATUS:
decode_result = decode_emm_status(&msg->emm_status, buffer, len);
break;
case IDENTITY_RESPONSE:
decode_result = decode_identity_response(&msg->identity_response, buffer, len);
break;
case IDENTITY_REQUEST:
decode_result = decode_identity_request(&msg->identity_request, buffer, len);
break;
case GUTI_REALLOCATION_COMMAND:
decode_result = decode_guti_reallocation_command(&msg->guti_reallocation_command,
buffer, len);
break;
case TRACKING_AREA_UPDATE_REJECT:
decode_result = decode_tracking_area_update_reject(
&msg->tracking_area_update_reject, buffer, len);
break;
case ATTACH_ACCEPT:
decode_result = decode_attach_accept(&msg->attach_accept, buffer, len);
break;
case SECURITY_MODE_COMPLETE:
decode_result = decode_security_mode_complete(&msg->security_mode_complete,
buffer, len);
break;
case TRACKING_AREA_UPDATE_ACCEPT:
decode_result = decode_tracking_area_update_accept(
&msg->tracking_area_update_accept, buffer, len);
break;
case ATTACH_REJECT:
decode_result = decode_attach_reject(&msg->attach_reject, buffer, len);
break;
case ATTACH_COMPLETE:
decode_result = decode_attach_complete(&msg->attach_complete, buffer, len);
break;
case TRACKING_AREA_UPDATE_COMPLETE:
decode_result = decode_tracking_area_update_complete(
&msg->tracking_area_update_complete, buffer, len);
break;
case CS_SERVICE_NOTIFICATION:
decode_result = decode_cs_service_notification(&msg->cs_service_notification,
buffer, len);
break;
case SECURITY_MODE_REJECT:
decode_result = decode_security_mode_reject(&msg->security_mode_reject, buffer,
len);
break;
case DETACH_REQUEST:
decode_result = decode_detach_request(&msg->detach_request, buffer, len);
break;
case GUTI_REALLOCATION_COMPLETE:
decode_result = decode_guti_reallocation_complete(
&msg->guti_reallocation_complete, buffer, len);
break;
case SECURITY_MODE_COMMAND:
decode_result = decode_security_mode_command(&msg->security_mode_command,
buffer, len);
break;
case DOWNLINK_NAS_TRANSPORT:
decode_result = decode_downlink_nas_transport(&msg->downlink_nas_transport,
buffer, len);
break;
case EXTENDED_SERVICE_REQUEST:
decode_result = decode_extended_service_request(&msg->extended_service_request,
buffer, len);
break;
case AUTHENTICATION_RESPONSE:
decode_result = decode_authentication_response(&msg->authentication_response,
buffer, len);
break;
default:
LOG_TRACE(ERROR, "EMM-MSG - Unexpected message type: 0x%x",
msg->header.message_type);
decode_result = TLV_DECODE_WRONG_MESSAGE_TYPE;
/* TODO: Handle not standard layer 3 messages: SERVICE_REQUEST */
}
if (decode_result < 0) {
LOG_TRACE(ERROR, "EMM-MSG - Failed to decode L3 EMM message 0x%x "
"(%d)", msg->header.message_type, decode_result);
LOG_FUNC_RETURN (decode_result);
} else {
#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE)))
/* Message has been decoded and security header removed, handle it has a plain message */
nas_itti_plain_msg((char *) buffer_log, (nas_message_t *) msg, len_log, down_link);
#endif
}
LOG_FUNC_RETURN (header_result + decode_result);
}
/****************************************************************************
** **
** Name: emm_msg_encode() **
** **
** Description: Encode EPS Mobility Management messages **
** **
** Inputs: msg: The EMM message structure to encode **
** length: Maximal capacity of the output buffer **
** Others: None **
** **
** Outputs: buffer: Pointer to the encoded data buffer **
** Return: The number of bytes in the buffer if data **
** have been successfully encoded; **
** A negative error code otherwise. **
** Others: None **
** **
***************************************************************************/
int emm_msg_encode(EMM_msg *msg, uint8_t *buffer, uint32_t len)
{
LOG_FUNC_IN;
int header_result;
int encode_result;
#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE)))
uint8_t *buffer_log = buffer;
int down_link;
# if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)))
down_link = 1;
# else
down_link = 0;
# endif
#endif
/* First encode the EMM message header */
header_result = _emm_msg_encode_header(&msg->header, buffer, len);
if (header_result < 0) {
LOG_TRACE(ERROR, "EMM-MSG - Failed to encode EMM message header "
"(%d)", header_result);
LOG_FUNC_RETURN(header_result);
}
buffer += header_result;
len -= header_result;
switch(msg->header.message_type) {
case EMM_INFORMATION:
encode_result = encode_emm_information(&msg->emm_information, buffer, len);
break;
case UPLINK_NAS_TRANSPORT:
encode_result = encode_uplink_nas_transport(&msg->uplink_nas_transport, buffer,
len);
break;
case AUTHENTICATION_REJECT:
encode_result = encode_authentication_reject(&msg->authentication_reject,
buffer, len);
break;
case AUTHENTICATION_FAILURE:
encode_result = encode_authentication_failure(&msg->authentication_failure,
buffer, len);
break;
case DETACH_ACCEPT:
encode_result = encode_detach_accept(&msg->detach_accept, buffer, len);
break;
case SERVICE_REJECT:
encode_result = encode_service_reject(&msg->service_reject, buffer, len);
break;
case AUTHENTICATION_REQUEST:
encode_result = encode_authentication_request(&msg->authentication_request,
buffer, len);
break;
case TRACKING_AREA_UPDATE_REQUEST:
encode_result = encode_tracking_area_update_request(
&msg->tracking_area_update_request, buffer, len);
break;
case ATTACH_REQUEST:
encode_result = encode_attach_request(&msg->attach_request, buffer, len);
break;
case EMM_STATUS:
encode_result = encode_emm_status(&msg->emm_status, buffer, len);
break;
case IDENTITY_RESPONSE:
encode_result = encode_identity_response(&msg->identity_response, buffer, len);
break;
case IDENTITY_REQUEST:
encode_result = encode_identity_request(&msg->identity_request, buffer, len);
break;
case GUTI_REALLOCATION_COMMAND:
encode_result = encode_guti_reallocation_command(&msg->guti_reallocation_command,
buffer, len);
break;
case TRACKING_AREA_UPDATE_REJECT:
encode_result = encode_tracking_area_update_reject(
&msg->tracking_area_update_reject, buffer, len);
break;
case ATTACH_ACCEPT:
encode_result = encode_attach_accept(&msg->attach_accept, buffer, len);
break;
case SECURITY_MODE_COMPLETE:
encode_result = encode_security_mode_complete(&msg->security_mode_complete,
buffer, len);
break;
case TRACKING_AREA_UPDATE_ACCEPT:
encode_result = encode_tracking_area_update_accept(
&msg->tracking_area_update_accept, buffer, len);
break;
case ATTACH_REJECT:
encode_result = encode_attach_reject(&msg->attach_reject, buffer, len);
break;
case ATTACH_COMPLETE:
encode_result = encode_attach_complete(&msg->attach_complete, buffer, len);
break;
case TRACKING_AREA_UPDATE_COMPLETE:
encode_result = encode_tracking_area_update_complete(
&msg->tracking_area_update_complete, buffer, len);
break;
case CS_SERVICE_NOTIFICATION:
encode_result = encode_cs_service_notification(&msg->cs_service_notification,
buffer, len);
break;
case SECURITY_MODE_REJECT:
encode_result = encode_security_mode_reject(&msg->security_mode_reject, buffer,
len);
break;
case DETACH_REQUEST:
encode_result = encode_detach_request(&msg->detach_request, buffer, len);
break;
case GUTI_REALLOCATION_COMPLETE:
encode_result = encode_guti_reallocation_complete(
&msg->guti_reallocation_complete, buffer, len);
break;
case SECURITY_MODE_COMMAND:
encode_result = encode_security_mode_command(&msg->security_mode_command,
buffer, len);
break;
case DOWNLINK_NAS_TRANSPORT:
encode_result = encode_downlink_nas_transport(&msg->downlink_nas_transport,
buffer, len);
break;
case EXTENDED_SERVICE_REQUEST:
encode_result = encode_extended_service_request(&msg->extended_service_request,
buffer, len);
break;
case AUTHENTICATION_RESPONSE:
encode_result = encode_authentication_response(&msg->authentication_response,
buffer, len);
break;
case SERVICE_REQUEST:
encode_result = encode_service_request(&msg->service_request, buffer, len);
break;
default:
LOG_TRACE(ERROR, "EMM-MSG - Unexpected message type: 0x%x",
msg->header.message_type);
encode_result = TLV_ENCODE_WRONG_MESSAGE_TYPE;
/* TODO: Handle not standard layer 3 messages: SERVICE_REQUEST */
}
if (encode_result < 0) {
LOG_TRACE(ERROR, "EMM-MSG - Failed to encode L3 EMM message 0x%x "
"(%d)", msg->header.message_type, encode_result);
} else {
#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE)))
nas_itti_plain_msg((char *) buffer_log, (nas_message_t *) msg, header_result + encode_result, down_link);
#endif
}
LOG_FUNC_RETURN (header_result + encode_result);
}
/****************************************************************************/
/********************* L O C A L F U N C T I O N S *********************/
/****************************************************************************/
/****************************************************************************
** **
** Name: _emm_msg_decode_header() **
** **
** Description: Decode header of EPS Mobility Management message. **
** The protocol discriminator and the security header type **
** have already been decoded. **
** **
** Inputs: buffer: Pointer to the buffer containing the EMM **
** message **
** len: Number of bytes that should be decoded **
** Others: None **
** **
** Outputs: header: The EMM message header to be filled **
** Return: The size of the header if data have been **
** successfully decoded; **
** A negative error code otherwise. **
** Others: None **
** **
***************************************************************************/
static int _emm_msg_decode_header(emm_msg_header_t *header,
const uint8_t *buffer, uint32_t len)
{
int size = 0;
/* Check the buffer length */
if (len < sizeof(emm_msg_header_t)) {
return (TLV_DECODE_BUFFER_TOO_SHORT);
}
/* Decode the security header type and the protocol discriminator */
DECODE_U8(buffer + size, *(uint8_t *)(header), size);
/* Decode the message type */
DECODE_U8(buffer + size, header->message_type, size);
/* Check the protocol discriminator */
if (header->protocol_discriminator != EPS_MOBILITY_MANAGEMENT_MESSAGE) {
LOG_TRACE(ERROR, "ESM-MSG - Unexpected protocol discriminator: 0x%x",
header->protocol_discriminator);
return (TLV_DECODE_PROTOCOL_NOT_SUPPORTED);
}
return (size);
}
/****************************************************************************
** **
** Name: _emm_msg_encode_header() **
** **
** The protocol discriminator and the security header type **
** have already been encoded. **
** **
** Inputs: header: The EMM message header to encode **
** len: Maximal capacity of the output buffer **
** Others: None **
** **
** Outputs: buffer: Pointer to the encoded data buffer **
** Return: The number of bytes in the buffer if data **
** have been successfully encoded; **
** A negative error code otherwise. **
** Others: None **
** **
***************************************************************************/
static int _emm_msg_encode_header(const emm_msg_header_t *header,
uint8_t *buffer, uint32_t len)
{
int size = 0;
/* Check the buffer length */
if (len < sizeof(emm_msg_header_t)) {
return (TLV_ENCODE_BUFFER_TOO_SHORT);
}
/* Check the protocol discriminator */
if (header->protocol_discriminator != EPS_MOBILITY_MANAGEMENT_MESSAGE) {
LOG_TRACE(ERROR, "ESM-MSG - Unexpected protocol discriminator: 0x%x",
header->protocol_discriminator);
return (TLV_ENCODE_PROTOCOL_NOT_SUPPORTED);
}
/* Encode the security header type and the protocol discriminator */
ENCODE_U8(buffer + size, *(uint8_t *)(header), size);
/* Encode the message type */
ENCODE_U8(buffer + size, header->message_type, size);
return (size);
}
+141
View File
@@ -0,0 +1,141 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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_msg.h
Version 0.1
Date 2012/09/27
Product NAS stack
Subsystem EPS Mobility Management
Author Frederic Maurel
Description Defines EPS Mobility Management messages and functions used
to encode and decode
*****************************************************************************/
#ifndef __EMM_MSG_H__
#define __EMM_MSG_H__
#include "emm_msgDef.h"
#include "AttachRequest.h"
#include "AttachAccept.h"
#include "AttachComplete.h"
#include "AttachReject.h"
#include "DetachRequest.h"
#include "DetachAccept.h"
#include "TrackingAreaUpdateRequest.h"
#include "TrackingAreaUpdateAccept.h"
#include "TrackingAreaUpdateComplete.h"
#include "TrackingAreaUpdateReject.h"
#include "ExtendedServiceRequest.h"
#include "ServiceRequest.h"
#include "ServiceReject.h"
#include "GutiReallocationCommand.h"
#include "GutiReallocationComplete.h"
#include "AuthenticationRequest.h"
#include "AuthenticationResponse.h"
#include "AuthenticationReject.h"
#include "AuthenticationFailure.h"
#include "IdentityRequest.h"
#include "IdentityResponse.h"
#include "NASSecurityModeCommand.h"
#include "NASSecurityModeComplete.h"
#include "SecurityModeReject.h"
#include "EmmStatus.h"
#include "EmmInformation.h"
#include "DownlinkNasTransport.h"
#include "UplinkNasTransport.h"
#include "CsServiceNotification.h"
#include <stdint.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 ************************/
/****************************************************************************/
/*
* Structure of EMM plain NAS message
* ----------------------------------
*/
typedef union {
emm_msg_header_t header;
attach_request_msg attach_request;
attach_accept_msg attach_accept;
attach_complete_msg attach_complete;
attach_reject_msg attach_reject;
detach_request_msg detach_request;
detach_accept_msg detach_accept;
tracking_area_update_request_msg tracking_area_update_request;
tracking_area_update_accept_msg tracking_area_update_accept;
tracking_area_update_complete_msg tracking_area_update_complete;
tracking_area_update_reject_msg tracking_area_update_reject;
extended_service_request_msg extended_service_request;
service_request_msg service_request;
service_reject_msg service_reject;
guti_reallocation_command_msg guti_reallocation_command;
guti_reallocation_complete_msg guti_reallocation_complete;
authentication_request_msg authentication_request;
authentication_response_msg authentication_response;
authentication_reject_msg authentication_reject;
authentication_failure_msg authentication_failure;
identity_request_msg identity_request;
identity_response_msg identity_response;
security_mode_command_msg security_mode_command;
security_mode_complete_msg security_mode_complete;
security_mode_reject_msg security_mode_reject;
emm_status_msg emm_status;
emm_information_msg emm_information;
downlink_nas_transport_msg downlink_nas_transport;
uplink_nas_transport_msg uplink_nas_transport;
cs_service_notification_msg cs_service_notification;
} EMM_msg;
/****************************************************************************/
/******************** 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 emm_msg_decode(EMM_msg *msg, uint8_t *buffer, uint32_t len);
int emm_msg_encode(EMM_msg *msg, uint8_t *buffer, uint32_t len);
#endif /* __EMM_MSG_H__ */
+137
View File
@@ -0,0 +1,137 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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.
*******************************************************************************/
/*****************************************************************************
Version 0.1
Date 2012/09/27
Product NAS stack
Subsystem EPS Mobility Management
Author Frederic Maurel, Sebastien Roux
Description Defines identifiers of the EPS Mobility Management messages.
*****************************************************************************/
#ifndef __EMM_MSGDEF_H__
#define __EMM_MSGDEF_H__
#include <stdint.h>
#include <asm/byteorder.h>
/****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/
/****************************************************************************/
/* Header length boundaries of EPS Mobility Management messages */
#define EMM_HEADER_LENGTH sizeof(emm_msg_header_t)
#define EMM_HEADER_MINIMUM_LENGTH EMM_HEADER_LENGTH
#define EMM_HEADER_MAXIMUM_LENGTH EMM_HEADER_LENGTH
/* EPS Mobility Management Security header type */
#define SECURITY_HEADER_TYPE_NOT_PROTECTED 0b0000
#define SECURITY_HEADER_TYPE_INTEGRITY_PROTECTED 0b0001
#define SECURITY_HEADER_TYPE_INTEGRITY_PROTECTED_CYPHERED 0b0010
#define SECURITY_HEADER_TYPE_INTEGRITY_PROTECTED_NEW 0b0011
#define SECURITY_HEADER_TYPE_INTEGRITY_PROTECTED_CYPHERED_NEW 0b0100
#define SECURITY_HEADER_TYPE_SERVICE_REQUEST 0b1100
/* Message identifiers for EPS Mobility Management */
# define ATTACH_REQUEST 0b01000001 /* 65 = 0x41 */
# define ATTACH_ACCEPT 0b01000010 /* 66 = 0x42 */
# define ATTACH_COMPLETE 0b01000011 /* 67 = 0x43 */
# define ATTACH_REJECT 0b01000100 /* 68 = 0x44 */
# define DETACH_REQUEST 0b01000101 /* 69 = 0x45 */
# define DETACH_ACCEPT 0b01000110 /* 70 = 0x46 */
# define TRACKING_AREA_UPDATE_REQUEST 0b01001000 /* 72 = 0x48 */
# define TRACKING_AREA_UPDATE_ACCEPT 0b01001001 /* 73 = 0x49 */
# define TRACKING_AREA_UPDATE_COMPLETE 0b01001010 /* 74 = 0x4a */
# define TRACKING_AREA_UPDATE_REJECT 0b01001011 /* 75 = 0x4b */
# define EXTENDED_SERVICE_REQUEST 0b01001100 /* 76 = 0x4c */
# define SERVICE_REJECT 0b01001110 /* 78 = 0x4e */
# define GUTI_REALLOCATION_COMMAND 0b01010000 /* 80 = 0x50 */
# define GUTI_REALLOCATION_COMPLETE 0b01010001 /* 81 = 0x51 */
# define AUTHENTICATION_REQUEST 0b01010010 /* 82 = 0x52 */
# define AUTHENTICATION_RESPONSE 0b01010011 /* 83 = 0x53 */
# define AUTHENTICATION_REJECT 0b01010100 /* 84 = 0x54 */
# define AUTHENTICATION_FAILURE 0b01011100 /* 92 = 0x5c */
# define IDENTITY_REQUEST 0b01010101 /* 85 = 0x55 */
# define IDENTITY_RESPONSE 0b01010110 /* 86 = 0x56 */
# define SECURITY_MODE_COMMAND 0b01011101 /* 93 = 0x5d */
# define SECURITY_MODE_COMPLETE 0b01011110 /* 94 = 0x5e */
# define SECURITY_MODE_REJECT 0b01011111 /* 95 = 0x5f */
# define EMM_STATUS 0b01100000 /* 96 = 0x60 */
# define EMM_INFORMATION 0b01100001 /* 97 = 0x61 */
# define DOWNLINK_NAS_TRANSPORT 0b01100010 /* 98 = 0x62 */
# define UPLINK_NAS_TRANSPORT 0b01100011 /* 99 = 0x63 */
# define CS_SERVICE_NOTIFICATION 0b01100100 /* 100 = 0x64 */
/*
* Message identifiers for EMM messages that does not follow the structure
* of a standard layer 3 message
*/
# define SERVICE_REQUEST 0b01001101 /* TODO: TBD - 77 = 0x4d */
/****************************************************************************/
/************************ G L O B A L T Y P E S ************************/
/****************************************************************************/
/*
* Header of EPS Mobility Management plain NAS message
* ---------------------------------------------------
* 8 7 6 5 4 3 2 1
* +-----------------------+------------------------+
* | Security header type | Protocol discriminator |
* +-----------------------+------------------------+
* | Message type |
* +-----------------------+------------------------+
*/
typedef struct {
#ifdef __LITTLE_ENDIAN_BITFIELD
uint8_t protocol_discriminator:4;
uint8_t security_header_type:4;
#endif
#ifdef __BIG_ENDIAN_BITFIELD
uint8_t security_header_type:4;
uint8_t protocol_discriminator:4;
#endif
uint8_t message_type;
} __attribute__((__packed__)) emm_msg_header_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_MSGDEF_H__ */
@@ -0,0 +1,100 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "ActivateDedicatedEpsBearerContextAccept.h"
int decode_activate_dedicated_eps_bearer_context_accept(activate_dedicated_eps_bearer_context_accept_msg *activate_dedicated_eps_bearer_context_accept, uint8_t *buffer, uint32_t len)
{
uint32_t decoded = 0;
int decoded_result = 0;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_MINIMUM_LENGTH, len);
/* Decoding mandatory fields */
/* Decoding optional fields */
while(len - decoded > 0) {
uint8_t ieiDecoded = *(buffer + decoded);
/* Type | value iei are below 0x80 so just return the first 4 bits */
if (ieiDecoded >= 0x80)
ieiDecoded = ieiDecoded & 0xf0;
switch(ieiDecoded) {
case ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_IEI:
if ((decoded_result =
decode_protocol_configuration_options(&activate_dedicated_eps_bearer_context_accept->protocolconfigurationoptions,
ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_IEI,
buffer + decoded, len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
activate_dedicated_eps_bearer_context_accept->presencemask |= ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT;
break;
default:
errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI;
return TLV_DECODE_UNEXPECTED_IEI;
}
}
return decoded;
}
int encode_activate_dedicated_eps_bearer_context_accept(activate_dedicated_eps_bearer_context_accept_msg *activate_dedicated_eps_bearer_context_accept, uint8_t *buffer, uint32_t len)
{
int encoded = 0;
int encode_result = 0;
/* Checking IEI and pointer */
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_MINIMUM_LENGTH, len);
if ((activate_dedicated_eps_bearer_context_accept->presencemask & ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT)
== ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) {
if ((encode_result =
encode_protocol_configuration_options(&activate_dedicated_eps_bearer_context_accept->protocolconfigurationoptions,
ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_IEI,
buffer + encoded, len - encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
return encoded;
}
@@ -0,0 +1,81 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "ProtocolDiscriminator.h"
#include "EpsBearerIdentity.h"
#include "ProcedureTransactionIdentity.h"
#include "MessageType.h"
#include "ProtocolConfigurationOptions.h"
#ifndef ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_H_
#define ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_H_
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_MINIMUM_LENGTH (0)
/* Maximum length macro. Formed by maximum length of each field */
#define ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_MAXIMUM_LENGTH ( \
PROTOCOL_CONFIGURATION_OPTIONS_MAXIMUM_LENGTH )
/* If an optional value is present and should be encoded, the corresponding
* Bit mask should be set to 1.
*/
# define ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT (1<<0)
typedef enum activate_dedicated_eps_bearer_context_accept_iei_tag {
ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_IEI = 0x27, /* 0x27 = 39 */
} activate_dedicated_eps_bearer_context_accept_iei;
/*
* Message name: Activate dedicated EPS bearer context accept
* Description: This message is sent by the UE to the network to acknowledge activation of a dedicated EPS bearer context associated with the same PDN address(es) and APN as an already active EPS bearer context. See table 8.3.1.1.
* Significance: dual
* Direction: UE to network
*/
typedef struct activate_dedicated_eps_bearer_context_accept_msg_tag {
/* Mandatory fields */
ProtocolDiscriminator protocoldiscriminator:4;
EpsBearerIdentity epsbeareridentity:4;
ProcedureTransactionIdentity proceduretransactionidentity;
MessageType messagetype;
/* Optional fields */
uint32_t presencemask;
ProtocolConfigurationOptions protocolconfigurationoptions;
} activate_dedicated_eps_bearer_context_accept_msg;
int decode_activate_dedicated_eps_bearer_context_accept(activate_dedicated_eps_bearer_context_accept_msg *activatededicatedepsbearercontextaccept, uint8_t *buffer, uint32_t len);
int encode_activate_dedicated_eps_bearer_context_accept(activate_dedicated_eps_bearer_context_accept_msg *activatededicatedepsbearercontextaccept, uint8_t *buffer, uint32_t len);
#endif /* ! defined(ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_H_) */
@@ -0,0 +1,112 @@
/*******************************************************************************
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 <http://www.gnu.org/licenses/>.
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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "ActivateDedicatedEpsBearerContextReject.h"
int decode_activate_dedicated_eps_bearer_context_reject(activate_dedicated_eps_bearer_context_reject_msg *activate_dedicated_eps_bearer_context_reject, uint8_t *buffer, uint32_t len)
{
uint32_t decoded = 0;
int decoded_result = 0;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT_MINIMUM_LENGTH, len);
/* Decoding mandatory fields */
if ((decoded_result = decode_esm_cause(&activate_dedicated_eps_bearer_context_reject->esmcause, 0, buffer + decoded, len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
/* Decoding optional fields */
while(len - decoded > 0) {
uint8_t ieiDecoded = *(buffer + decoded);
/* Type | value iei are below 0x80 so just return the first 4 bits */
if (ieiDecoded >= 0x80)
ieiDecoded = ieiDecoded & 0xf0;
switch(ieiDecoded) {
case ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI:
if ((decoded_result =
decode_protocol_configuration_options(&activate_dedicated_eps_bearer_context_reject->protocolconfigurationoptions,
ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI,
buffer + decoded, len - decoded)) <= 0)
return decoded_result;
decoded += decoded_result;
/* Set corresponding mask to 1 in presencemask */
activate_dedicated_eps_bearer_context_reject->presencemask |= ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT;
break;
default:
errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI;
return TLV_DECODE_UNEXPECTED_IEI;
}
}
return decoded;
}
int encode_activate_dedicated_eps_bearer_context_reject(activate_dedicated_eps_bearer_context_reject_msg *activate_dedicated_eps_bearer_context_reject, uint8_t *buffer, uint32_t len)
{
int encoded = 0;
int encode_result = 0;
/* Checking IEI and pointer */
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT_MINIMUM_LENGTH, len);
if ((encode_result =
encode_esm_cause(&activate_dedicated_eps_bearer_context_reject->esmcause,
0, buffer + encoded, len - encoded)) < 0) //Return in case of error
return encode_result;
else
encoded += encode_result;
if ((activate_dedicated_eps_bearer_context_reject->presencemask & ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT)
== ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) {
if ((encode_result =
encode_protocol_configuration_options(&activate_dedicated_eps_bearer_context_reject->protocolconfigurationoptions,
ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI,
buffer + encoded, len - encoded)) < 0)
// Return in case of error
return encode_result;
else
encoded += encode_result;
}
return encoded;
}

Some files were not shown because too many files have changed in this diff Show More