From 2c2a2c6ae9a0269f915e308bf75e8fd9628bc763 Mon Sep 17 00:00:00 2001 From: gauthier Date: Wed, 24 Jun 2015 13:16:51 +0000 Subject: [PATCH] git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7653 818b1a75-f10b-46b9-bf7c-635c3b92a50f --- cmake_targets/CMakeLists.txt | 700 +++-- cmake_targets/at_commands/CMakeLists.txt | 846 +++--- cmake_targets/build_oai | 4 +- .../lte_noS1_build_oai/CMakeLists.txt | 2 +- cmake_targets/nas_sim_tools/CMakeLists.txt | 52 +- cmake_targets/tools/build_epc | 18 +- cmake_targets/tools/build_helper | 13 +- cmake_targets/tools/check_mme_s6a_certificate | 4 + cmake_targets/tools/epc.local.enb.conf.in | 2 +- cmake_targets/tools/run_enb_s1_usrp | 8 +- cmake_targets/tools/run_enb_ue_virt_s1 | 42 +- cmake_targets/tools/run_epc | 15 +- common/utils/itti_analyzer/INSTALL | 12 +- openair-cn/GTPV1-U/GTPUAH/cmd.sh | 18 - .../GTPV1-U/{GTPUAH => GTPU_SP}/COPYING | 0 .../GTPV1-U/{GTPUAH => GTPU_SP}/INSTALL | 0 .../GTPV1-U/{GTPUAH => GTPU_SP}/Makefile | 18 +- openair-cn/GTPV1-U/{GTPUAH => GTPU_SP}/README | 0 .../GTPV1-U/{GTPUAH => GTPU_SP}/RELEASE_NOTES | 1 - openair-cn/GTPV1-U/GTPU_SP/cmd.sh | 18 + .../libxt_GTPUAH.c => GTPU_SP/libxt_GTPUSP.c} | 148 +- .../xt_GTPUAH.c => GTPU_SP/xt_GTPUSP.c} | 204 +- .../xt_GTPUAH.h => GTPU_SP/xt_GTPUSP.h} | 6 +- openair-cn/NAS/COMMON/API/NETWORK/COPYING | 674 +++++ .../API/NETWORK/Makefile} | 55 +- .../NAS/COMMON/API/NETWORK/as_message.c | 374 +++ .../NAS/COMMON/API/NETWORK/as_message.h | 1 + .../NAS/COMMON/API/NETWORK/l2_message.h | 309 ++ .../NAS/COMMON/API/NETWORK/nas_message.c | 1436 +++++++++ .../NAS/COMMON/API/NETWORK/nas_message.h | 135 + .../NAS/COMMON/API/NETWORK/network_api.c | 447 +++ .../NAS/COMMON/API/NETWORK/network_api.h | 78 + openair-cn/NAS/COMMON/COPYING | 674 +++++ openair-cn/NAS/COMMON/EMM/MSG/AttachAccept.c | 373 +++ openair-cn/NAS/COMMON/EMM/MSG/AttachAccept.h | 138 + .../NAS/COMMON/EMM/MSG/AttachComplete.c | 73 + .../NAS/COMMON/EMM/MSG/AttachComplete.h | 70 + openair-cn/NAS/COMMON/EMM/MSG/AttachReject.c | 111 + openair-cn/NAS/COMMON/EMM/MSG/AttachReject.h | 83 + openair-cn/NAS/COMMON/EMM/MSG/AttachRequest.c | 474 +++ openair-cn/NAS/COMMON/EMM/MSG/AttachRequest.h | 157 + .../COMMON/EMM/MSG/AuthenticationFailure.c | 111 + .../COMMON/EMM/MSG/AuthenticationFailure.h | 83 + .../NAS/COMMON/EMM/MSG/AuthenticationReject.c | 57 + .../NAS/COMMON/EMM/MSG/AuthenticationReject.h | 65 + .../COMMON/EMM/MSG/AuthenticationRequest.c | 93 + .../COMMON/EMM/MSG/AuthenticationRequest.h | 78 + .../COMMON/EMM/MSG/AuthenticationResponse.c | 73 + .../COMMON/EMM/MSG/AuthenticationResponse.h | 70 + openair-cn/NAS/COMMON/EMM/MSG/COPYING | 674 +++++ .../COMMON/EMM/MSG/CsServiceNotification.c | 181 ++ .../COMMON/EMM/MSG/CsServiceNotification.h | 98 + openair-cn/NAS/COMMON/EMM/MSG/DetachAccept.c | 57 + openair-cn/NAS/COMMON/EMM/MSG/DetachAccept.h | 65 + openair-cn/NAS/COMMON/EMM/MSG/DetachRequest.c | 83 + openair-cn/NAS/COMMON/EMM/MSG/DetachRequest.h | 78 + .../NAS/COMMON/EMM/MSG/DownlinkNasTransport.c | 73 + .../NAS/COMMON/EMM/MSG/DownlinkNasTransport.h | 70 + .../NAS/COMMON/EMM/MSG/EmmInformation.c | 195 ++ .../NAS/COMMON/EMM/MSG/EmmInformation.h | 98 + openair-cn/NAS/COMMON/EMM/MSG/EmmStatus.c | 72 + openair-cn/NAS/COMMON/EMM/MSG/EmmStatus.h | 70 + .../COMMON/EMM/MSG/ExtendedServiceRequest.c | 91 + .../COMMON/EMM/MSG/ExtendedServiceRequest.h | 83 + .../COMMON/EMM/MSG/GutiReallocationCommand.c | 112 + .../COMMON/EMM/MSG/GutiReallocationCommand.h | 83 + .../COMMON/EMM/MSG/GutiReallocationComplete.c | 57 + .../COMMON/EMM/MSG/GutiReallocationComplete.h | 65 + .../NAS/COMMON/EMM/MSG/IdentityRequest.c | 66 + .../NAS/COMMON/EMM/MSG/IdentityRequest.h | 70 + .../NAS/COMMON/EMM/MSG/IdentityResponse.c | 73 + .../NAS/COMMON/EMM/MSG/IdentityResponse.h | 70 + openair-cn/NAS/COMMON/EMM/MSG/Makefile | 69 + .../COMMON/EMM/MSG/NASSecurityModeCommand.h | 100 + .../COMMON/EMM/MSG/NASSecurityModeComplete.h | 79 + .../NAS/COMMON/EMM/MSG/SecurityModeCommand.c | 179 ++ .../NAS/COMMON/EMM/MSG/SecurityModeComplete.c | 100 + .../NAS/COMMON/EMM/MSG/SecurityModeReject.c | 72 + .../NAS/COMMON/EMM/MSG/SecurityModeReject.h | 70 + openair-cn/NAS/COMMON/EMM/MSG/ServiceReject.c | 78 + openair-cn/NAS/COMMON/EMM/MSG/ServiceReject.h | 75 + .../NAS/COMMON/EMM/MSG/ServiceRequest.c | 87 + .../NAS/COMMON/EMM/MSG/ServiceRequest.h | 72 + .../COMMON/EMM/MSG/TrackingAreaUpdateAccept.c | 396 +++ .../COMMON/EMM/MSG/TrackingAreaUpdateAccept.h | 141 + .../EMM/MSG/TrackingAreaUpdateComplete.c | 57 + .../EMM/MSG/TrackingAreaUpdateComplete.h | 65 + .../COMMON/EMM/MSG/TrackingAreaUpdateReject.c | 73 + .../COMMON/EMM/MSG/TrackingAreaUpdateReject.h | 70 + .../EMM/MSG/TrackingAreaUpdateRequest.c | 532 ++++ .../EMM/MSG/TrackingAreaUpdateRequest.h | 173 ++ .../NAS/COMMON/EMM/MSG/UplinkNasTransport.c | 73 + .../NAS/COMMON/EMM/MSG/UplinkNasTransport.h | 70 + openair-cn/NAS/COMMON/EMM/MSG/emm_cause.h | 132 + openair-cn/NAS/COMMON/EMM/MSG/emm_msg.c | 568 ++++ openair-cn/NAS/COMMON/EMM/MSG/emm_msg.h | 141 + openair-cn/NAS/COMMON/EMM/MSG/emm_msgDef.h | 137 + .../ActivateDedicatedEpsBearerContextAccept.c | 100 + .../ActivateDedicatedEpsBearerContextAccept.h | 81 + .../ActivateDedicatedEpsBearerContextReject.c | 112 + .../ActivateDedicatedEpsBearerContextReject.h | 85 + ...ActivateDedicatedEpsBearerContextRequest.c | 252 ++ ...ActivateDedicatedEpsBearerContextRequest.h | 116 + .../ActivateDefaultEpsBearerContextAccept.c | 100 + .../ActivateDefaultEpsBearerContextAccept.h | 81 + .../ActivateDefaultEpsBearerContextReject.c | 112 + .../ActivateDefaultEpsBearerContextReject.h | 85 + .../ActivateDefaultEpsBearerContextRequest.c | 341 +++ .../ActivateDefaultEpsBearerContextRequest.h | 128 + .../ESM/MSG/BearerResourceAllocationReject.c | 112 + .../ESM/MSG/BearerResourceAllocationReject.h | 85 + .../ESM/MSG/BearerResourceAllocationRequest.c | 132 + .../ESM/MSG/BearerResourceAllocationRequest.h | 91 + .../MSG/BearerResourceModificationReject.c | 112 + .../MSG/BearerResourceModificationReject.h | 85 + .../MSG/BearerResourceModificationRequest.c | 168 ++ .../MSG/BearerResourceModificationRequest.h | 97 + openair-cn/NAS/COMMON/ESM/MSG/COPYING | 674 +++++ .../MSG/DeactivateEpsBearerContextAccept.c | 100 + .../MSG/DeactivateEpsBearerContextAccept.h | 81 + .../MSG/DeactivateEpsBearerContextRequest.c | 112 + .../MSG/DeactivateEpsBearerContextRequest.h | 85 + .../COMMON/ESM/MSG/EsmInformationRequest.c | 59 + .../COMMON/ESM/MSG/EsmInformationRequest.h | 67 + .../COMMON/ESM/MSG/EsmInformationResponse.c | 124 + .../COMMON/ESM/MSG/EsmInformationResponse.h | 86 + openair-cn/NAS/COMMON/ESM/MSG/EsmStatus.c | 72 + openair-cn/NAS/COMMON/ESM/MSG/EsmStatus.h | 72 + openair-cn/NAS/COMMON/ESM/MSG/Makefile | 69 + .../ESM/MSG/ModifyEpsBearerContextAccept.c | 100 + .../ESM/MSG/ModifyEpsBearerContextAccept.h | 81 + .../ESM/MSG/ModifyEpsBearerContextReject.c | 112 + .../ESM/MSG/ModifyEpsBearerContextReject.h | 85 + .../ESM/MSG/ModifyEpsBearerContextRequest.c | 268 ++ .../ESM/MSG/ModifyEpsBearerContextRequest.h | 116 + .../COMMON/ESM/MSG/PdnConnectivityReject.c | 111 + .../COMMON/ESM/MSG/PdnConnectivityReject.h | 85 + .../COMMON/ESM/MSG/PdnConnectivityRequest.c | 159 + .../COMMON/ESM/MSG/PdnConnectivityRequest.h | 97 + .../NAS/COMMON/ESM/MSG/PdnDisconnectReject.c | 111 + .../NAS/COMMON/ESM/MSG/PdnDisconnectReject.h | 85 + .../NAS/COMMON/ESM/MSG/PdnDisconnectRequest.c | 108 + .../NAS/COMMON/ESM/MSG/PdnDisconnectRequest.h | 85 + openair-cn/NAS/COMMON/ESM/MSG/esm_cause.h | 129 + openair-cn/NAS/COMMON/ESM/MSG/esm_msg.c | 484 +++ openair-cn/NAS/COMMON/ESM/MSG/esm_msg.h | 127 + openair-cn/NAS/COMMON/ESM/MSG/esm_msgDef.h | 121 + openair-cn/NAS/COMMON/IES/AccessPointName.c | 132 + openair-cn/NAS/COMMON/IES/AccessPointName.h | 52 + .../NAS/COMMON/IES/AdditionalUpdateResult.c | 106 + .../NAS/COMMON/IES/AdditionalUpdateResult.h | 54 + .../NAS/COMMON/IES/AdditionalUpdateType.c | 64 + .../NAS/COMMON/IES/AdditionalUpdateType.h | 50 + .../COMMON/IES/ApnAggregateMaximumBitRate.c | 138 + .../COMMON/IES/ApnAggregateMaximumBitRate.h | 61 + .../IES/AuthenticationFailureParameter.c | 102 + .../IES/AuthenticationFailureParameter.h | 52 + .../COMMON/IES/AuthenticationParameterAutn.c | 102 + .../COMMON/IES/AuthenticationParameterAutn.h | 52 + .../COMMON/IES/AuthenticationParameterRand.c | 94 + .../COMMON/IES/AuthenticationParameterRand.h | 52 + .../IES/AuthenticationResponseParameter.c | 97 + .../IES/AuthenticationResponseParameter.h | 52 + openair-cn/NAS/COMMON/IES/COPYING | 674 +++++ .../COMMON/IES/CipheringKeySequenceNumber.c | 106 + .../COMMON/IES/CipheringKeySequenceNumber.h | 54 + openair-cn/NAS/COMMON/IES/Cli.c | 102 + openair-cn/NAS/COMMON/IES/Cli.h | 52 + openair-cn/NAS/COMMON/IES/CsfbResponse.c | 106 + openair-cn/NAS/COMMON/IES/CsfbResponse.h | 54 + .../NAS/COMMON/IES/DaylightSavingTime.c | 93 + .../NAS/COMMON/IES/DaylightSavingTime.h | 50 + openair-cn/NAS/COMMON/IES/DetachType.c | 113 + openair-cn/NAS/COMMON/IES/DetachType.h | 64 + openair-cn/NAS/COMMON/IES/DrxParameter.c | 97 + openair-cn/NAS/COMMON/IES/DrxParameter.h | 55 + .../NAS/COMMON/IES/EmergencyNumberList.c | 98 + .../NAS/COMMON/IES/EmergencyNumberList.h | 53 + openair-cn/NAS/COMMON/IES/EmmCause.c | 85 + openair-cn/NAS/COMMON/IES/EmmCause.h | 50 + openair-cn/NAS/COMMON/IES/EpsAttachResult.c | 108 + openair-cn/NAS/COMMON/IES/EpsAttachResult.h | 56 + openair-cn/NAS/COMMON/IES/EpsAttachType.c | 108 + openair-cn/NAS/COMMON/IES/EpsAttachType.h | 58 + .../NAS/COMMON/IES/EpsBearerContextStatus.c | 86 + .../NAS/COMMON/IES/EpsBearerContextStatus.h | 50 + openair-cn/NAS/COMMON/IES/EpsBearerIdentity.c | 47 + openair-cn/NAS/COMMON/IES/EpsBearerIdentity.h | 53 + openair-cn/NAS/COMMON/IES/EpsMobileIdentity.c | 381 +++ openair-cn/NAS/COMMON/IES/EpsMobileIdentity.h | 96 + .../NAS/COMMON/IES/EpsNetworkFeatureSupport.c | 93 + .../NAS/COMMON/IES/EpsNetworkFeatureSupport.h | 50 + .../NAS/COMMON/IES/EpsQualityOfService.c | 209 ++ .../NAS/COMMON/IES/EpsQualityOfService.h | 66 + openair-cn/NAS/COMMON/IES/EpsUpdateResult.c | 106 + openair-cn/NAS/COMMON/IES/EpsUpdateResult.h | 54 + openair-cn/NAS/COMMON/IES/EpsUpdateType.c | 111 + openair-cn/NAS/COMMON/IES/EpsUpdateType.h | 57 + openair-cn/NAS/COMMON/IES/EsmCause.c | 85 + openair-cn/NAS/COMMON/IES/EsmCause.h | 50 + .../COMMON/IES/EsmInformationTransferFlag.c | 106 + .../COMMON/IES/EsmInformationTransferFlag.h | 54 + .../NAS/COMMON/IES/EsmMessageContainer.c | 114 + .../NAS/COMMON/IES/EsmMessageContainer.h | 52 + openair-cn/NAS/COMMON/IES/GprsTimer.c | 95 + openair-cn/NAS/COMMON/IES/GprsTimer.h | 59 + openair-cn/NAS/COMMON/IES/GutiType.c | 108 + openair-cn/NAS/COMMON/IES/GutiType.h | 56 + openair-cn/NAS/COMMON/IES/IdentityType2.c | 108 + openair-cn/NAS/COMMON/IES/IdentityType2.h | 58 + openair-cn/NAS/COMMON/IES/ImeisvRequest.c | 106 + openair-cn/NAS/COMMON/IES/ImeisvRequest.h | 54 + .../NAS/COMMON/IES/KsiAndSequenceNumber.c | 88 + .../NAS/COMMON/IES/KsiAndSequenceNumber.h | 53 + openair-cn/NAS/COMMON/IES/LcsClientIdentity.c | 102 + openair-cn/NAS/COMMON/IES/LcsClientIdentity.h | 52 + openair-cn/NAS/COMMON/IES/LcsIndicator.c | 85 + openair-cn/NAS/COMMON/IES/LcsIndicator.h | 50 + .../NAS/COMMON/IES/LinkedEpsBearerIdentity.c | 108 + .../NAS/COMMON/IES/LinkedEpsBearerIdentity.h | 54 + .../IES/LlcServiceAccessPointIdentifier.c | 86 + .../IES/LlcServiceAccessPointIdentifier.h | 50 + .../COMMON/IES/LocationAreaIdentification.c | 108 + .../COMMON/IES/LocationAreaIdentification.h | 58 + openair-cn/NAS/COMMON/IES/Makefile | 72 + openair-cn/NAS/COMMON/IES/MessageType.c | 47 + openair-cn/NAS/COMMON/IES/MessageType.h | 50 + openair-cn/NAS/COMMON/IES/MobileIdentity.c | 678 +++++ openair-cn/NAS/COMMON/IES/MobileIdentity.h | 110 + .../NAS/COMMON/IES/MobileStationClassmark2.c | 146 + .../NAS/COMMON/IES/MobileStationClassmark2.h | 68 + .../NAS/COMMON/IES/MobileStationClassmark3.c | 47 + .../NAS/COMMON/IES/MobileStationClassmark3.h | 52 + .../NAS/COMMON/IES/MsNetworkCapability.c | 102 + .../NAS/COMMON/IES/MsNetworkCapability.h | 52 + .../NAS/COMMON/IES/NasKeySetIdentifier.c | 113 + .../NAS/COMMON/IES/NasKeySetIdentifier.h | 60 + .../NAS/COMMON/IES/NasMessageContainer.c | 102 + .../NAS/COMMON/IES/NasMessageContainer.h | 52 + openair-cn/NAS/COMMON/IES/NasRequestType.c | 108 + openair-cn/NAS/COMMON/IES/NasRequestType.h | 58 + .../NAS/COMMON/IES/NasSecurityAlgorithms.c | 89 + .../NAS/COMMON/IES/NasSecurityAlgorithms.h | 69 + openair-cn/NAS/COMMON/IES/NetworkName.c | 119 + openair-cn/NAS/COMMON/IES/NetworkName.h | 55 + openair-cn/NAS/COMMON/IES/Nonce.c | 84 + openair-cn/NAS/COMMON/IES/Nonce.h | 50 + openair-cn/NAS/COMMON/IES/PTmsiSignature.c | 94 + openair-cn/NAS/COMMON/IES/PTmsiSignature.h | 52 + .../NAS/COMMON/IES/PacketFlowIdentifier.c | 93 + .../NAS/COMMON/IES/PacketFlowIdentifier.h | 50 + openair-cn/NAS/COMMON/IES/PagingIdentity.c | 86 + openair-cn/NAS/COMMON/IES/PagingIdentity.h | 50 + openair-cn/NAS/COMMON/IES/PdnAddress.c | 108 + openair-cn/NAS/COMMON/IES/PdnAddress.h | 56 + openair-cn/NAS/COMMON/IES/PdnType.c | 108 + openair-cn/NAS/COMMON/IES/PdnType.h | 58 + openair-cn/NAS/COMMON/IES/PlmnList.c | 111 + openair-cn/NAS/COMMON/IES/PlmnList.h | 57 + .../COMMON/IES/ProcedureTransactionIdentity.c | 47 + .../COMMON/IES/ProcedureTransactionIdentity.h | 53 + .../COMMON/IES/ProtocolConfigurationOptions.c | 152 + .../COMMON/IES/ProtocolConfigurationOptions.h | 79 + .../NAS/COMMON/IES/ProtocolDiscriminator.c | 47 + .../NAS/COMMON/IES/ProtocolDiscriminator.h | 50 + openair-cn/NAS/COMMON/IES/QualityOfService.c | 171 ++ openair-cn/NAS/COMMON/IES/QualityOfService.h | 70 + openair-cn/NAS/COMMON/IES/RadioPriority.c | 106 + openair-cn/NAS/COMMON/IES/RadioPriority.h | 54 + .../NAS/COMMON/IES/SecurityHeaderType.c | 47 + .../NAS/COMMON/IES/SecurityHeaderType.h | 50 + openair-cn/NAS/COMMON/IES/ServiceType.c | 106 + openair-cn/NAS/COMMON/IES/ServiceType.h | 54 + openair-cn/NAS/COMMON/IES/ShortMac.c | 84 + openair-cn/NAS/COMMON/IES/ShortMac.h | 50 + openair-cn/NAS/COMMON/IES/SsCode.c | 85 + openair-cn/NAS/COMMON/IES/SsCode.h | 50 + .../NAS/COMMON/IES/SupportedCodecList.c | 101 + .../NAS/COMMON/IES/SupportedCodecList.h | 54 + openair-cn/NAS/COMMON/IES/TimeZone.c | 85 + openair-cn/NAS/COMMON/IES/TimeZone.h | 50 + openair-cn/NAS/COMMON/IES/TimeZoneAndTime.c | 115 + openair-cn/NAS/COMMON/IES/TimeZoneAndTime.h | 58 + openair-cn/NAS/COMMON/IES/TmsiStatus.c | 106 + openair-cn/NAS/COMMON/IES/TmsiStatus.h | 54 + .../NAS/COMMON/IES/TrackingAreaIdentity.c | 108 + .../NAS/COMMON/IES/TrackingAreaIdentity.h | 58 + .../NAS/COMMON/IES/TrackingAreaIdentityList.c | 126 + .../NAS/COMMON/IES/TrackingAreaIdentityList.h | 65 + .../IES/TrafficFlowAggregateDescription.c | 47 + .../IES/TrafficFlowAggregateDescription.h | 52 + .../NAS/COMMON/IES/TrafficFlowTemplate.c | 550 ++++ .../NAS/COMMON/IES/TrafficFlowTemplate.h | 199 ++ .../NAS/COMMON/IES/TransactionIdentifier.c | 47 + .../NAS/COMMON/IES/TransactionIdentifier.h | 52 + .../NAS/COMMON/IES/UeNetworkCapability.c | 173 ++ .../NAS/COMMON/IES/UeNetworkCapability.h | 114 + ...UeRadioCapabilityInformationUpdateNeeded.c | 106 + ...UeRadioCapabilityInformationUpdateNeeded.h | 54 + .../NAS/COMMON/IES/UeSecurityCapability.c | 153 + .../NAS/COMMON/IES/UeSecurityCapability.h | 101 + .../VoiceDomainPreferenceAndUeUsageSetting.c | 101 + .../VoiceDomainPreferenceAndUeUsageSetting.h | 60 + openair-cn/NAS/COMMON/UTIL/COPYING | 674 +++++ openair-cn/NAS/COMMON/UTIL/Makefile | 70 + openair-cn/NAS/COMMON/UTIL/OctetString.c | 132 + openair-cn/NAS/COMMON/UTIL/OctetString.h | 77 + openair-cn/NAS/COMMON/UTIL/TLVDecoder.c | 57 + openair-cn/NAS/COMMON/UTIL/TLVDecoder.h | 141 + openair-cn/NAS/COMMON/UTIL/TLVEncoder.c | 54 + openair-cn/NAS/COMMON/UTIL/TLVEncoder.h | 105 + openair-cn/NAS/COMMON/UTIL/device.c | 271 ++ openair-cn/NAS/COMMON/UTIL/device.h | 80 + openair-cn/NAS/COMMON/UTIL/memory.c | 191 ++ openair-cn/NAS/COMMON/UTIL/memory.h | 72 + openair-cn/NAS/COMMON/UTIL/nas_log.c | 280 ++ openair-cn/NAS/COMMON/UTIL/nas_log.h | 166 + openair-cn/NAS/COMMON/UTIL/nas_timer.c | 880 ++++++ openair-cn/NAS/COMMON/UTIL/nas_timer.h | 88 + openair-cn/NAS/COMMON/UTIL/parser.c | 188 ++ openair-cn/NAS/COMMON/UTIL/parser.h | 96 + openair-cn/NAS/COMMON/UTIL/socket.c | 426 +++ openair-cn/NAS/COMMON/UTIL/socket.h | 81 + openair-cn/NAS/COMMON/UTIL/stty.c | 353 +++ openair-cn/NAS/COMMON/UTIL/tst/Makefile | 63 + openair-cn/NAS/COMMON/UTIL/tst/timer.c | 248 ++ .../NAS/COMMON/UTIL/tst/timer_debug.txt | 101 + openair-cn/NAS/COMMON/commonDef.h | 1 + openair-cn/NAS/COMMON/networkDef.h | 1 + openair-cn/NAS/COMMON/securityDef.h | 111 + openair-cn/NAS/COMMON/userDef.h | 98 + openair-cn/NAS/EURECOM-NAS/src/emm/Detach.c | 1 + openair-cn/NAS/MME/API/MME/COPYING | 674 +++++ openair-cn/NAS/MME/API/MME/Makefile | 49 + openair-cn/NAS/MME/API/MME/mme_api.c | 569 ++++ openair-cn/NAS/MME/API/MME/mme_api.h | 146 + openair-cn/NAS/MME/EMM/Attach.c | 1664 ++++++++++ openair-cn/NAS/MME/EMM/Authentication.c | 650 ++++ openair-cn/NAS/MME/EMM/COPYING | 674 +++++ openair-cn/NAS/MME/EMM/Detach.c | 329 ++ openair-cn/NAS/MME/EMM/EmmCommon.c | 514 ++++ openair-cn/NAS/MME/EMM/EmmCommon.h | 109 + openair-cn/NAS/MME/EMM/EmmStatusHdl.c | 165 + openair-cn/NAS/MME/EMM/Identification.c | 533 ++++ openair-cn/NAS/MME/EMM/IdleMode.c | 0 openair-cn/NAS/MME/EMM/IdleMode.h | 0 openair-cn/NAS/MME/EMM/LowerLayer.c | 373 +++ openair-cn/NAS/MME/EMM/LowerLayer.h | 79 + openair-cn/NAS/MME/EMM/Makefile | 72 + openair-cn/NAS/MME/EMM/SAP/COPYING | 674 +++++ .../MME/EMM/SAP/EmmCommonProcedureInitiated.c | 186 ++ openair-cn/NAS/MME/EMM/SAP/EmmDeregistered.c | 157 + .../MME/EMM/SAP/EmmDeregisteredAttachNeeded.c | 0 .../SAP/EmmDeregisteredAttemptingToAttach.c | 0 .../MME/EMM/SAP/EmmDeregisteredInitiated.c | 110 + .../EMM/SAP/EmmDeregisteredLimitedService.c | 0 .../EMM/SAP/EmmDeregisteredNoCellAvailable.c | 0 .../NAS/MME/EMM/SAP/EmmDeregisteredNoImsi.c | 0 .../EMM/SAP/EmmDeregisteredNormalService.c | 0 .../MME/EMM/SAP/EmmDeregisteredPlmnSearch.c | 0 openair-cn/NAS/MME/EMM/SAP/EmmNull.c | 0 openair-cn/NAS/MME/EMM/SAP/EmmRegistered.c | 153 + .../EMM/SAP/EmmRegisteredAttemptingToUpdate.c | 0 .../SAP/EmmRegisteredImsiDetachInitiated.c | 0 .../NAS/MME/EMM/SAP/EmmRegisteredInitiated.c | 0 .../MME/EMM/SAP/EmmRegisteredLimitedService.c | 0 .../EMM/SAP/EmmRegisteredNoCellAvailable.c | 0 .../MME/EMM/SAP/EmmRegisteredNormalService.c | 0 .../NAS/MME/EMM/SAP/EmmRegisteredPlmnSearch.c | 0 .../MME/EMM/SAP/EmmRegisteredUpdateNeeded.c | 0 .../MME/EMM/SAP/EmmServiceRequestInitiated.c | 0 .../SAP/EmmTrackingAreaUpdatingInitiated.c | 0 openair-cn/NAS/MME/EMM/SAP/Makefile | 70 + openair-cn/NAS/MME/EMM/SAP/emm_as.c | 1763 +++++++++++ openair-cn/NAS/MME/EMM/SAP/emm_as.h | 72 + openair-cn/NAS/MME/EMM/SAP/emm_asDef.h | 276 ++ openair-cn/NAS/MME/EMM/SAP/emm_cn.c | 468 +++ openair-cn/NAS/MME/EMM/SAP/emm_cn.h | 56 + openair-cn/NAS/MME/EMM/SAP/emm_cnDef.h | 88 + openair-cn/NAS/MME/EMM/SAP/emm_esm.c | 147 + openair-cn/NAS/MME/EMM/SAP/emm_esm.h | 73 + openair-cn/NAS/MME/EMM/SAP/emm_esmDef.h | 116 + openair-cn/NAS/MME/EMM/SAP/emm_fsm.c | 323 ++ openair-cn/NAS/MME/EMM/SAP/emm_fsm.h | 91 + openair-cn/NAS/MME/EMM/SAP/emm_recv.c | 748 +++++ openair-cn/NAS/MME/EMM/SAP/emm_recv.h | 129 + openair-cn/NAS/MME/EMM/SAP/emm_reg.c | 126 + openair-cn/NAS/MME/EMM/SAP/emm_reg.h | 73 + openair-cn/NAS/MME/EMM/SAP/emm_regDef.h | 138 + openair-cn/NAS/MME/EMM/SAP/emm_sap.c | 154 + openair-cn/NAS/MME/EMM/SAP/emm_sap.h | 171 ++ openair-cn/NAS/MME/EMM/SAP/emm_send.c | 509 ++++ openair-cn/NAS/MME/EMM/SAP/emm_send.h | 122 + openair-cn/NAS/MME/EMM/SecurityModeControl.c | 801 +++++ openair-cn/NAS/MME/EMM/ServiceRequestHdl.c | 93 + openair-cn/NAS/MME/EMM/TrackingAreaUpdate.c | 188 ++ openair-cn/NAS/MME/EMM/emmData.h | 285 ++ openair-cn/NAS/MME/EMM/emm_data_ctx.c | 185 ++ openair-cn/NAS/MME/EMM/emm_main.c | 148 + openair-cn/NAS/MME/EMM/emm_main.h | 82 + openair-cn/NAS/MME/EMM/emm_proc.h | 199 ++ openair-cn/NAS/MME/ESM/COPYING | 674 +++++ .../ESM/DedicatedEpsBearerContextActivation.c | 442 +++ .../ESM/DefaultEpsBearerContextActivation.c | 497 +++ .../MME/ESM/EpsBearerContextDeactivation.c | 483 +++ openair-cn/NAS/MME/ESM/EsmStatusHdl.c | 199 ++ openair-cn/NAS/MME/ESM/Makefile | 59 + openair-cn/NAS/MME/ESM/PdnConnectivity.c | 556 ++++ openair-cn/NAS/MME/ESM/PdnDisconnect.c | 299 ++ openair-cn/NAS/MME/ESM/SAP/COPYING | 674 +++++ openair-cn/NAS/MME/ESM/SAP/Makefile | 70 + openair-cn/NAS/MME/ESM/SAP/esm_recv.c | 713 +++++ openair-cn/NAS/MME/ESM/SAP/esm_recv.h | 129 + openair-cn/NAS/MME/ESM/SAP/esm_sap.c | 799 +++++ openair-cn/NAS/MME/ESM/SAP/esm_sap.h | 72 + openair-cn/NAS/MME/ESM/SAP/esm_sapDef.h | 179 ++ openair-cn/NAS/MME/ESM/SAP/esm_send.c | 427 +++ openair-cn/NAS/MME/ESM/SAP/esm_send.h | 119 + openair-cn/NAS/MME/ESM/esmData.h | 265 ++ openair-cn/NAS/MME/ESM/esm_ebr.c | 670 +++++ openair-cn/NAS/MME/ESM/esm_ebr.h | 89 + openair-cn/NAS/MME/ESM/esm_ebr_context.c | 431 +++ openair-cn/NAS/MME/ESM/esm_ebr_context.h | 73 + openair-cn/NAS/MME/ESM/esm_ip.c | 74 + openair-cn/NAS/MME/ESM/esm_main.c | 134 + openair-cn/NAS/MME/ESM/esm_main.h | 73 + openair-cn/NAS/MME/ESM/esm_proc.h | 204 ++ openair-cn/NAS/MME/ESM/esm_pt.c | 95 + openair-cn/NAS/MME/ESM/esm_pt.h | 74 + openair-cn/NAS/MME/MMEprocess.c | 345 +++ openair-cn/NAS/{ => MME}/nas_defs.h | 0 openair-cn/NAS/MME/nas_itti_messaging.c | 211 ++ openair-cn/NAS/{ => MME}/nas_itti_messaging.h | 12 +- .../NAS/{nas_main.c => MME/nas_mme_task.c} | 0 openair-cn/NAS/MME/nas_network.c | 208 ++ openair-cn/NAS/MME/nas_network.h | 81 + openair-cn/NAS/MME/nas_parser.c | 243 ++ openair-cn/NAS/MME/nas_parser.h | 84 + openair-cn/NAS/MME/nas_proc.c | 443 +++ openair-cn/NAS/MME/nas_proc.h | 116 + openair-cn/NAS/Makefile.UE | 341 --- openair-cn/NAS/Makefile.inc | 429 --- openair-cn/NAS/TEST/AS_SIMULATOR/COPYING | 674 +++++ openair-cn/NAS/TEST/AS_SIMULATOR/Makefile | 63 + openair-cn/NAS/TEST/AS_SIMULATOR/as_data.c | 139 + openair-cn/NAS/TEST/AS_SIMULATOR/as_data.h | 56 + openair-cn/NAS/TEST/AS_SIMULATOR/as_process.c | 1246 ++++++++ openair-cn/NAS/TEST/AS_SIMULATOR/as_process.h | 70 + .../NAS/TEST/AS_SIMULATOR/as_simulator.c | 653 ++++ .../TEST/AS_SIMULATOR/as_simulator_parser.c | 213 ++ .../TEST/AS_SIMULATOR/as_simulator_parser.h | 61 + openair-cn/NAS/TEST/AS_SIMULATOR/nas_data.c | 908 ++++++ openair-cn/NAS/TEST/AS_SIMULATOR/nas_data.h | 81 + .../NAS/TEST/AS_SIMULATOR/nas_process.c | 1043 +++++++ .../NAS/TEST/AS_SIMULATOR/nas_process.h | 43 + openair-cn/NAS/TEST/COPYING | 674 +++++ openair-cn/NAS/TEST/MSC/ActivatePDN.png | Bin 0 -> 9430 bytes .../NAS/TEST/MSC/AuthenticationReject.png | Bin 0 -> 21465 bytes openair-cn/NAS/TEST/MSC/COPYING | 674 +++++ openair-cn/NAS/TEST/MSC/DeactivatePDN.png | Bin 0 -> 8833 bytes openair-cn/NAS/TEST/MSC/InitialAttach.png | Bin 0 -> 32243 bytes .../NAS/TEST/MSC/InitialAttachReject.png | Bin 0 -> 16271 bytes openair-cn/NAS/TEST/MSC/NomalDetach.png | Bin 0 -> 5844 bytes openair-cn/NAS/TEST/MSC/README | 34 + openair-cn/NAS/TEST/MSC/SwitchOffDetach.png | Bin 0 -> 3697 bytes openair-cn/NAS/TEST/MSC/msc_gen.py | 354 +++ openair-cn/NAS/TEST/MSC/mscgen | Bin 0 -> 197742 bytes openair-cn/NAS/TEST/NETWORK/COPYING | 674 +++++ openair-cn/NAS/TEST/NETWORK/Makefile | 63 + openair-cn/NAS/TEST/NETWORK/README | 255 ++ openair-cn/NAS/TEST/NETWORK/network_parser.c | 161 + openair-cn/NAS/TEST/NETWORK/network_parser.h | 54 + .../NAS/TEST/NETWORK/network_simulator.c | 1404 +++++++++ openair-cn/NAS/TEST/USER/COPYING | 674 +++++ openair-cn/NAS/TEST/USER/Makefile | 60 + openair-cn/NAS/TEST/USER/user_parser.c | 201 ++ openair-cn/NAS/TEST/USER/user_parser.h | 56 + openair-cn/NAS/TEST/USER/user_simulator.c | 312 ++ openair-cn/NAS/TOOLS/COPYING | 674 +++++ openair-cn/NAS/TOOLS/Makefile | 86 + openair-cn/NAS/TOOLS/network.h | 126 + openair-cn/NAS/TOOLS/ue_data.c | 513 ++++ openair-cn/NAS/TOOLS/usim_data.c | 639 ++++ openair-cn/NAS/UE/API/USER/COPYING | 674 +++++ openair-cn/NAS/UE/API/USER/Makefile | 49 + openair-cn/NAS/UE/API/USER/at_command.c | 1879 ++++++++++++ openair-cn/NAS/UE/API/USER/at_command.h | 865 ++++++ openair-cn/NAS/UE/API/USER/at_error.c | 438 +++ openair-cn/NAS/UE/API/USER/at_error.h | 201 ++ openair-cn/NAS/UE/API/USER/at_response.c | 1194 ++++++++ openair-cn/NAS/UE/API/USER/at_response.h | 789 +++++ openair-cn/NAS/UE/API/USER/tst/Makefile | 65 + openair-cn/NAS/UE/API/USER/tst/at_parser.c | 156 + openair-cn/NAS/UE/API/USER/tst/at_parser.in | 2 + .../NAS/UE/API/USER/tst/at_parser.in.bis | 59 + openair-cn/NAS/UE/API/USER/tst/at_parser.out | 90 + .../NAS/UE/API/USER/tst/at_parser.out.bis | 204 ++ openair-cn/NAS/UE/API/USER/tst/smartcom.txt | 23 + openair-cn/NAS/UE/API/USER/user_api.c | 851 ++++++ openair-cn/NAS/UE/API/USER/user_api.h | 85 + openair-cn/NAS/UE/API/USER/user_indication.c | 182 ++ openair-cn/NAS/UE/API/USER/user_indication.h | 129 + openair-cn/NAS/UE/API/USIM/COPYING | 674 +++++ openair-cn/NAS/UE/API/USIM/Makefile | 49 + openair-cn/NAS/UE/API/USIM/aka_functions.c | 485 +++ openair-cn/NAS/UE/API/USIM/aka_functions.h | 42 + openair-cn/NAS/UE/API/USIM/usim_api.c | 404 +++ openair-cn/NAS/UE/API/USIM/usim_api.h | 355 +++ openair-cn/NAS/UE/EMM/Attach.c | 1198 ++++++++ openair-cn/NAS/UE/EMM/Authentication.c | 1012 +++++++ openair-cn/NAS/UE/EMM/Detach.c | 488 +++ openair-cn/NAS/UE/EMM/EmmStatusHdl.c | 157 + openair-cn/NAS/UE/EMM/Identification.c | 219 ++ openair-cn/NAS/UE/EMM/IdleMode.c | 1223 ++++++++ openair-cn/NAS/UE/EMM/IdleMode.h | 89 + openair-cn/NAS/UE/EMM/LowerLayer.c | 498 +++ openair-cn/NAS/UE/EMM/LowerLayer.h | 96 + openair-cn/NAS/UE/EMM/SAP/COPYING | 674 +++++ openair-cn/NAS/UE/EMM/SAP/EmmDeregistered.c | 197 ++ .../UE/EMM/SAP/EmmDeregisteredAttachNeeded.c | 101 + .../SAP/EmmDeregisteredAttemptingToAttach.c | 145 + .../NAS/UE/EMM/SAP/EmmDeregisteredInitiated.c | 148 + .../EMM/SAP/EmmDeregisteredLimitedService.c | 165 + .../EMM/SAP/EmmDeregisteredNoCellAvailable.c | 145 + .../NAS/UE/EMM/SAP/EmmDeregisteredNoImsi.c | 102 + .../UE/EMM/SAP/EmmDeregisteredNormalService.c | 174 ++ .../UE/EMM/SAP/EmmDeregisteredPlmnSearch.c | 162 + openair-cn/NAS/UE/EMM/SAP/EmmNull.c | 134 + openair-cn/NAS/UE/EMM/SAP/EmmRegistered.c | 175 ++ .../EMM/SAP/EmmRegisteredAttemptingToUpdate.c | 102 + .../SAP/EmmRegisteredImsiDetachInitiated.c | 102 + .../NAS/UE/EMM/SAP/EmmRegisteredInitiated.c | 271 ++ .../UE/EMM/SAP/EmmRegisteredLimitedService.c | 98 + .../UE/EMM/SAP/EmmRegisteredNoCellAvailable.c | 99 + .../UE/EMM/SAP/EmmRegisteredNormalService.c | 98 + .../NAS/UE/EMM/SAP/EmmRegisteredPlmnSearch.c | 126 + .../UE/EMM/SAP/EmmRegisteredUpdateNeeded.c | 104 + .../UE/EMM/SAP/EmmServiceRequestInitiated.c | 100 + .../SAP/EmmTrackingAreaUpdatingInitiated.c | 100 + openair-cn/NAS/UE/EMM/SAP/emm_as.c | 1486 +++++++++ openair-cn/NAS/UE/EMM/SAP/emm_as.h | 72 + openair-cn/NAS/UE/EMM/SAP/emm_asDef.h | 276 ++ openair-cn/NAS/UE/EMM/SAP/emm_esm.c | 178 ++ openair-cn/NAS/UE/EMM/SAP/emm_esm.h | 73 + openair-cn/NAS/UE/EMM/SAP/emm_esmDef.h | 118 + openair-cn/NAS/UE/EMM/SAP/emm_fsm.c | 325 ++ openair-cn/NAS/UE/EMM/SAP/emm_fsm.h | 109 + openair-cn/NAS/UE/EMM/SAP/emm_recv.c | 486 +++ openair-cn/NAS/UE/EMM/SAP/emm_recv.h | 111 + openair-cn/NAS/UE/EMM/SAP/emm_reg.c | 126 + openair-cn/NAS/UE/EMM/SAP/emm_reg.h | 73 + openair-cn/NAS/UE/EMM/SAP/emm_regDef.h | 147 + openair-cn/NAS/UE/EMM/SAP/emm_sap.c | 143 + openair-cn/NAS/UE/EMM/SAP/emm_sap.h | 170 ++ openair-cn/NAS/UE/EMM/SAP/emm_send.c | 909 ++++++ openair-cn/NAS/UE/EMM/SAP/emm_send.h | 132 + openair-cn/NAS/UE/EMM/SecurityModeControl.c | 549 ++++ openair-cn/NAS/UE/EMM/ServiceRequestHdl.c | 130 + openair-cn/NAS/UE/EMM/TrackingAreaUpdate.c | 132 + openair-cn/NAS/UE/EMM/emmData.h | 386 +++ openair-cn/NAS/UE/EMM/emm_main.c | 1079 +++++++ openair-cn/NAS/UE/EMM/emm_main.h | 98 + openair-cn/NAS/UE/EMM/emm_proc.h | 195 ++ .../ESM/DedicatedEpsBearerContextActivation.c | 317 ++ .../ESM/DefaultEpsBearerContextActivation.c | 385 +++ .../NAS/UE/ESM/EpsBearerContextDeactivation.c | 392 +++ openair-cn/NAS/UE/ESM/EsmStatusHdl.c | 196 ++ openair-cn/NAS/UE/ESM/PdnConnectivity.c | 1036 +++++++ openair-cn/NAS/UE/ESM/PdnDisconnect.c | 512 ++++ openair-cn/NAS/UE/ESM/SAP/COPYING | 674 +++++ openair-cn/NAS/UE/ESM/SAP/esm_recv.c | 695 +++++ openair-cn/NAS/UE/ESM/SAP/esm_recv.h | 118 + openair-cn/NAS/UE/ESM/SAP/esm_sap.c | 797 +++++ openair-cn/NAS/UE/ESM/SAP/esm_sap.h | 72 + openair-cn/NAS/UE/ESM/SAP/esm_sapDef.h | 178 ++ openair-cn/NAS/UE/ESM/SAP/esm_send.c | 441 +++ openair-cn/NAS/UE/ESM/SAP/esm_send.h | 123 + openair-cn/NAS/UE/ESM/esmData.h | 218 ++ openair-cn/NAS/UE/ESM/esm_ebr.c | 492 +++ openair-cn/NAS/UE/ESM/esm_ebr.h | 85 + openair-cn/NAS/UE/ESM/esm_ebr_context.c | 726 +++++ openair-cn/NAS/UE/ESM/esm_ebr_context.h | 86 + openair-cn/NAS/UE/ESM/esm_ip.c | 74 + openair-cn/NAS/UE/ESM/esm_main.c | 391 +++ openair-cn/NAS/UE/ESM/esm_main.h | 83 + openair-cn/NAS/UE/ESM/esm_proc.h | 198 ++ openair-cn/NAS/UE/ESM/esm_pt.c | 598 ++++ openair-cn/NAS/UE/ESM/esm_pt.h | 104 + openair-cn/NAS/UE/UEprocess.c | 424 +++ openair-cn/NAS/{ => UE}/nas_itti_messaging.c | 31 +- openair-cn/NAS/UE/nas_itti_messaging.h | 65 + openair-cn/NAS/UE/nas_network.c | 226 ++ openair-cn/NAS/UE/nas_network.h | 75 + openair-cn/NAS/UE/nas_parser.c | 351 +++ openair-cn/NAS/UE/nas_parser.h | 96 + openair-cn/NAS/UE/nas_proc.c | 1423 +++++++++ openair-cn/NAS/UE/nas_proc.h | 132 + openair-cn/NAS/{ => UE}/nas_ue_task.c | 0 openair-cn/NAS/UE/nas_user.c | 2677 +++++++++++++++++ openair-cn/NAS/UE/nas_user.h | 76 + openair-cn/SGW-LITE/sgw_lite_handlers.c | 4 +- openair-cn/SGW-LITE/spgw_config.c | 8 +- openair-cn/TEST/oaisim_mme_test_s1c.c | 3 +- targets/COMMON/create_tasks.c | 2 + .../enb.band7.tm1.usrpb210.epc.local.conf | 66 +- .../enb.band7.tm1.usrpb210.epc.remote.conf | 7 +- 606 files changed, 118981 insertions(+), 1889 deletions(-) delete mode 100755 openair-cn/GTPV1-U/GTPUAH/cmd.sh rename openair-cn/GTPV1-U/{GTPUAH => GTPU_SP}/COPYING (100%) rename openair-cn/GTPV1-U/{GTPUAH => GTPU_SP}/INSTALL (100%) rename openair-cn/GTPV1-U/{GTPUAH => GTPU_SP}/Makefile (90%) rename openair-cn/GTPV1-U/{GTPUAH => GTPU_SP}/README (100%) rename openair-cn/GTPV1-U/{GTPUAH => GTPU_SP}/RELEASE_NOTES (70%) create mode 100755 openair-cn/GTPV1-U/GTPU_SP/cmd.sh rename openair-cn/GTPV1-U/{GTPUAH/libxt_GTPUAH.c => GTPU_SP/libxt_GTPUSP.c} (54%) rename openair-cn/GTPV1-U/{GTPUAH/xt_GTPUAH.c => GTPU_SP/xt_GTPUSP.c} (77%) rename openair-cn/GTPV1-U/{GTPUAH/xt_GTPUAH.h => GTPU_SP/xt_GTPUSP.h} (84%) create mode 100644 openair-cn/NAS/COMMON/API/NETWORK/COPYING rename openair-cn/NAS/{Makefile.am => COMMON/API/NETWORK/Makefile} (52%) create mode 100644 openair-cn/NAS/COMMON/API/NETWORK/as_message.c create mode 120000 openair-cn/NAS/COMMON/API/NETWORK/as_message.h create mode 100644 openair-cn/NAS/COMMON/API/NETWORK/l2_message.h create mode 100644 openair-cn/NAS/COMMON/API/NETWORK/nas_message.c create mode 100644 openair-cn/NAS/COMMON/API/NETWORK/nas_message.h create mode 100644 openair-cn/NAS/COMMON/API/NETWORK/network_api.c create mode 100644 openair-cn/NAS/COMMON/API/NETWORK/network_api.h create mode 100644 openair-cn/NAS/COMMON/COPYING create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/AttachAccept.c create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/AttachAccept.h create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/AttachComplete.c create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/AttachComplete.h create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/AttachReject.c create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/AttachReject.h create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/AttachRequest.c create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/AttachRequest.h create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/AuthenticationFailure.c create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/AuthenticationFailure.h create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/AuthenticationReject.c create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/AuthenticationReject.h create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/AuthenticationRequest.c create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/AuthenticationRequest.h create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/AuthenticationResponse.c create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/AuthenticationResponse.h create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/COPYING create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/CsServiceNotification.c create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/CsServiceNotification.h create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/DetachAccept.c create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/DetachAccept.h create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/DetachRequest.c create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/DetachRequest.h create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/DownlinkNasTransport.c create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/DownlinkNasTransport.h create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/EmmInformation.c create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/EmmInformation.h create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/EmmStatus.c create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/EmmStatus.h create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/ExtendedServiceRequest.c create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/ExtendedServiceRequest.h create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/GutiReallocationCommand.c create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/GutiReallocationCommand.h create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/GutiReallocationComplete.c create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/GutiReallocationComplete.h create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/IdentityRequest.c create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/IdentityRequest.h create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/IdentityResponse.c create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/IdentityResponse.h create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/Makefile create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/NASSecurityModeCommand.h create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/NASSecurityModeComplete.h create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/SecurityModeCommand.c create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/SecurityModeComplete.c create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/SecurityModeReject.c create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/SecurityModeReject.h create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/ServiceReject.c create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/ServiceReject.h create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/ServiceRequest.c create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/ServiceRequest.h create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateAccept.c create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateAccept.h create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateComplete.c create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateComplete.h create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateReject.c create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateReject.h create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateRequest.c create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateRequest.h create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/UplinkNasTransport.c create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/UplinkNasTransport.h create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/emm_cause.h create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/emm_msg.c create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/emm_msg.h create mode 100644 openair-cn/NAS/COMMON/EMM/MSG/emm_msgDef.h create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextAccept.c create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextAccept.h create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextReject.c create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextReject.h create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextRequest.c create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextRequest.h create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextAccept.c create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextAccept.h create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextReject.c create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextReject.h create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextRequest.c create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextRequest.h create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/BearerResourceAllocationReject.c create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/BearerResourceAllocationReject.h create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/BearerResourceAllocationRequest.c create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/BearerResourceAllocationRequest.h create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/BearerResourceModificationReject.c create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/BearerResourceModificationReject.h create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/BearerResourceModificationRequest.c create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/BearerResourceModificationRequest.h create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/COPYING create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/DeactivateEpsBearerContextAccept.c create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/DeactivateEpsBearerContextAccept.h create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/DeactivateEpsBearerContextRequest.c create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/DeactivateEpsBearerContextRequest.h create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/EsmInformationRequest.c create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/EsmInformationRequest.h create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/EsmInformationResponse.c create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/EsmInformationResponse.h create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/EsmStatus.c create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/EsmStatus.h create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/Makefile create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextAccept.c create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextAccept.h create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextReject.c create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextReject.h create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextRequest.c create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextRequest.h create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/PdnConnectivityReject.c create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/PdnConnectivityReject.h create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/PdnConnectivityRequest.c create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/PdnConnectivityRequest.h create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/PdnDisconnectReject.c create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/PdnDisconnectReject.h create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/PdnDisconnectRequest.c create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/PdnDisconnectRequest.h create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/esm_cause.h create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/esm_msg.c create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/esm_msg.h create mode 100644 openair-cn/NAS/COMMON/ESM/MSG/esm_msgDef.h create mode 100644 openair-cn/NAS/COMMON/IES/AccessPointName.c create mode 100644 openair-cn/NAS/COMMON/IES/AccessPointName.h create mode 100644 openair-cn/NAS/COMMON/IES/AdditionalUpdateResult.c create mode 100644 openair-cn/NAS/COMMON/IES/AdditionalUpdateResult.h create mode 100644 openair-cn/NAS/COMMON/IES/AdditionalUpdateType.c create mode 100644 openair-cn/NAS/COMMON/IES/AdditionalUpdateType.h create mode 100644 openair-cn/NAS/COMMON/IES/ApnAggregateMaximumBitRate.c create mode 100644 openair-cn/NAS/COMMON/IES/ApnAggregateMaximumBitRate.h create mode 100644 openair-cn/NAS/COMMON/IES/AuthenticationFailureParameter.c create mode 100644 openair-cn/NAS/COMMON/IES/AuthenticationFailureParameter.h create mode 100644 openair-cn/NAS/COMMON/IES/AuthenticationParameterAutn.c create mode 100644 openair-cn/NAS/COMMON/IES/AuthenticationParameterAutn.h create mode 100644 openair-cn/NAS/COMMON/IES/AuthenticationParameterRand.c create mode 100644 openair-cn/NAS/COMMON/IES/AuthenticationParameterRand.h create mode 100644 openair-cn/NAS/COMMON/IES/AuthenticationResponseParameter.c create mode 100644 openair-cn/NAS/COMMON/IES/AuthenticationResponseParameter.h create mode 100644 openair-cn/NAS/COMMON/IES/COPYING create mode 100644 openair-cn/NAS/COMMON/IES/CipheringKeySequenceNumber.c create mode 100644 openair-cn/NAS/COMMON/IES/CipheringKeySequenceNumber.h create mode 100644 openair-cn/NAS/COMMON/IES/Cli.c create mode 100644 openair-cn/NAS/COMMON/IES/Cli.h create mode 100644 openair-cn/NAS/COMMON/IES/CsfbResponse.c create mode 100644 openair-cn/NAS/COMMON/IES/CsfbResponse.h create mode 100644 openair-cn/NAS/COMMON/IES/DaylightSavingTime.c create mode 100644 openair-cn/NAS/COMMON/IES/DaylightSavingTime.h create mode 100644 openair-cn/NAS/COMMON/IES/DetachType.c create mode 100644 openair-cn/NAS/COMMON/IES/DetachType.h create mode 100644 openair-cn/NAS/COMMON/IES/DrxParameter.c create mode 100644 openair-cn/NAS/COMMON/IES/DrxParameter.h create mode 100644 openair-cn/NAS/COMMON/IES/EmergencyNumberList.c create mode 100644 openair-cn/NAS/COMMON/IES/EmergencyNumberList.h create mode 100644 openair-cn/NAS/COMMON/IES/EmmCause.c create mode 100644 openair-cn/NAS/COMMON/IES/EmmCause.h create mode 100644 openair-cn/NAS/COMMON/IES/EpsAttachResult.c create mode 100644 openair-cn/NAS/COMMON/IES/EpsAttachResult.h create mode 100644 openair-cn/NAS/COMMON/IES/EpsAttachType.c create mode 100644 openair-cn/NAS/COMMON/IES/EpsAttachType.h create mode 100644 openair-cn/NAS/COMMON/IES/EpsBearerContextStatus.c create mode 100644 openair-cn/NAS/COMMON/IES/EpsBearerContextStatus.h create mode 100644 openair-cn/NAS/COMMON/IES/EpsBearerIdentity.c create mode 100644 openair-cn/NAS/COMMON/IES/EpsBearerIdentity.h create mode 100644 openair-cn/NAS/COMMON/IES/EpsMobileIdentity.c create mode 100644 openair-cn/NAS/COMMON/IES/EpsMobileIdentity.h create mode 100644 openair-cn/NAS/COMMON/IES/EpsNetworkFeatureSupport.c create mode 100644 openair-cn/NAS/COMMON/IES/EpsNetworkFeatureSupport.h create mode 100644 openair-cn/NAS/COMMON/IES/EpsQualityOfService.c create mode 100644 openair-cn/NAS/COMMON/IES/EpsQualityOfService.h create mode 100644 openair-cn/NAS/COMMON/IES/EpsUpdateResult.c create mode 100644 openair-cn/NAS/COMMON/IES/EpsUpdateResult.h create mode 100644 openair-cn/NAS/COMMON/IES/EpsUpdateType.c create mode 100644 openair-cn/NAS/COMMON/IES/EpsUpdateType.h create mode 100644 openair-cn/NAS/COMMON/IES/EsmCause.c create mode 100644 openair-cn/NAS/COMMON/IES/EsmCause.h create mode 100644 openair-cn/NAS/COMMON/IES/EsmInformationTransferFlag.c create mode 100644 openair-cn/NAS/COMMON/IES/EsmInformationTransferFlag.h create mode 100644 openair-cn/NAS/COMMON/IES/EsmMessageContainer.c create mode 100644 openair-cn/NAS/COMMON/IES/EsmMessageContainer.h create mode 100644 openair-cn/NAS/COMMON/IES/GprsTimer.c create mode 100644 openair-cn/NAS/COMMON/IES/GprsTimer.h create mode 100644 openair-cn/NAS/COMMON/IES/GutiType.c create mode 100644 openair-cn/NAS/COMMON/IES/GutiType.h create mode 100644 openair-cn/NAS/COMMON/IES/IdentityType2.c create mode 100644 openair-cn/NAS/COMMON/IES/IdentityType2.h create mode 100644 openair-cn/NAS/COMMON/IES/ImeisvRequest.c create mode 100644 openair-cn/NAS/COMMON/IES/ImeisvRequest.h create mode 100644 openair-cn/NAS/COMMON/IES/KsiAndSequenceNumber.c create mode 100644 openair-cn/NAS/COMMON/IES/KsiAndSequenceNumber.h create mode 100644 openair-cn/NAS/COMMON/IES/LcsClientIdentity.c create mode 100644 openair-cn/NAS/COMMON/IES/LcsClientIdentity.h create mode 100644 openair-cn/NAS/COMMON/IES/LcsIndicator.c create mode 100644 openair-cn/NAS/COMMON/IES/LcsIndicator.h create mode 100644 openair-cn/NAS/COMMON/IES/LinkedEpsBearerIdentity.c create mode 100644 openair-cn/NAS/COMMON/IES/LinkedEpsBearerIdentity.h create mode 100644 openair-cn/NAS/COMMON/IES/LlcServiceAccessPointIdentifier.c create mode 100644 openair-cn/NAS/COMMON/IES/LlcServiceAccessPointIdentifier.h create mode 100644 openair-cn/NAS/COMMON/IES/LocationAreaIdentification.c create mode 100644 openair-cn/NAS/COMMON/IES/LocationAreaIdentification.h create mode 100644 openair-cn/NAS/COMMON/IES/Makefile create mode 100644 openair-cn/NAS/COMMON/IES/MessageType.c create mode 100644 openair-cn/NAS/COMMON/IES/MessageType.h create mode 100644 openair-cn/NAS/COMMON/IES/MobileIdentity.c create mode 100644 openair-cn/NAS/COMMON/IES/MobileIdentity.h create mode 100644 openair-cn/NAS/COMMON/IES/MobileStationClassmark2.c create mode 100644 openair-cn/NAS/COMMON/IES/MobileStationClassmark2.h create mode 100644 openair-cn/NAS/COMMON/IES/MobileStationClassmark3.c create mode 100644 openair-cn/NAS/COMMON/IES/MobileStationClassmark3.h create mode 100644 openair-cn/NAS/COMMON/IES/MsNetworkCapability.c create mode 100644 openair-cn/NAS/COMMON/IES/MsNetworkCapability.h create mode 100644 openair-cn/NAS/COMMON/IES/NasKeySetIdentifier.c create mode 100644 openair-cn/NAS/COMMON/IES/NasKeySetIdentifier.h create mode 100644 openair-cn/NAS/COMMON/IES/NasMessageContainer.c create mode 100644 openair-cn/NAS/COMMON/IES/NasMessageContainer.h create mode 100644 openair-cn/NAS/COMMON/IES/NasRequestType.c create mode 100644 openair-cn/NAS/COMMON/IES/NasRequestType.h create mode 100644 openair-cn/NAS/COMMON/IES/NasSecurityAlgorithms.c create mode 100644 openair-cn/NAS/COMMON/IES/NasSecurityAlgorithms.h create mode 100644 openair-cn/NAS/COMMON/IES/NetworkName.c create mode 100644 openair-cn/NAS/COMMON/IES/NetworkName.h create mode 100644 openair-cn/NAS/COMMON/IES/Nonce.c create mode 100644 openair-cn/NAS/COMMON/IES/Nonce.h create mode 100644 openair-cn/NAS/COMMON/IES/PTmsiSignature.c create mode 100644 openair-cn/NAS/COMMON/IES/PTmsiSignature.h create mode 100644 openair-cn/NAS/COMMON/IES/PacketFlowIdentifier.c create mode 100644 openair-cn/NAS/COMMON/IES/PacketFlowIdentifier.h create mode 100644 openair-cn/NAS/COMMON/IES/PagingIdentity.c create mode 100644 openair-cn/NAS/COMMON/IES/PagingIdentity.h create mode 100644 openair-cn/NAS/COMMON/IES/PdnAddress.c create mode 100644 openair-cn/NAS/COMMON/IES/PdnAddress.h create mode 100644 openair-cn/NAS/COMMON/IES/PdnType.c create mode 100644 openair-cn/NAS/COMMON/IES/PdnType.h create mode 100644 openair-cn/NAS/COMMON/IES/PlmnList.c create mode 100644 openair-cn/NAS/COMMON/IES/PlmnList.h create mode 100644 openair-cn/NAS/COMMON/IES/ProcedureTransactionIdentity.c create mode 100644 openair-cn/NAS/COMMON/IES/ProcedureTransactionIdentity.h create mode 100644 openair-cn/NAS/COMMON/IES/ProtocolConfigurationOptions.c create mode 100644 openair-cn/NAS/COMMON/IES/ProtocolConfigurationOptions.h create mode 100644 openair-cn/NAS/COMMON/IES/ProtocolDiscriminator.c create mode 100644 openair-cn/NAS/COMMON/IES/ProtocolDiscriminator.h create mode 100644 openair-cn/NAS/COMMON/IES/QualityOfService.c create mode 100644 openair-cn/NAS/COMMON/IES/QualityOfService.h create mode 100644 openair-cn/NAS/COMMON/IES/RadioPriority.c create mode 100644 openair-cn/NAS/COMMON/IES/RadioPriority.h create mode 100644 openair-cn/NAS/COMMON/IES/SecurityHeaderType.c create mode 100644 openair-cn/NAS/COMMON/IES/SecurityHeaderType.h create mode 100644 openair-cn/NAS/COMMON/IES/ServiceType.c create mode 100644 openair-cn/NAS/COMMON/IES/ServiceType.h create mode 100644 openair-cn/NAS/COMMON/IES/ShortMac.c create mode 100644 openair-cn/NAS/COMMON/IES/ShortMac.h create mode 100644 openair-cn/NAS/COMMON/IES/SsCode.c create mode 100644 openair-cn/NAS/COMMON/IES/SsCode.h create mode 100644 openair-cn/NAS/COMMON/IES/SupportedCodecList.c create mode 100644 openair-cn/NAS/COMMON/IES/SupportedCodecList.h create mode 100644 openair-cn/NAS/COMMON/IES/TimeZone.c create mode 100644 openair-cn/NAS/COMMON/IES/TimeZone.h create mode 100644 openair-cn/NAS/COMMON/IES/TimeZoneAndTime.c create mode 100644 openair-cn/NAS/COMMON/IES/TimeZoneAndTime.h create mode 100644 openair-cn/NAS/COMMON/IES/TmsiStatus.c create mode 100644 openair-cn/NAS/COMMON/IES/TmsiStatus.h create mode 100644 openair-cn/NAS/COMMON/IES/TrackingAreaIdentity.c create mode 100644 openair-cn/NAS/COMMON/IES/TrackingAreaIdentity.h create mode 100644 openair-cn/NAS/COMMON/IES/TrackingAreaIdentityList.c create mode 100644 openair-cn/NAS/COMMON/IES/TrackingAreaIdentityList.h create mode 100644 openair-cn/NAS/COMMON/IES/TrafficFlowAggregateDescription.c create mode 100644 openair-cn/NAS/COMMON/IES/TrafficFlowAggregateDescription.h create mode 100644 openair-cn/NAS/COMMON/IES/TrafficFlowTemplate.c create mode 100644 openair-cn/NAS/COMMON/IES/TrafficFlowTemplate.h create mode 100644 openair-cn/NAS/COMMON/IES/TransactionIdentifier.c create mode 100644 openair-cn/NAS/COMMON/IES/TransactionIdentifier.h create mode 100644 openair-cn/NAS/COMMON/IES/UeNetworkCapability.c create mode 100644 openair-cn/NAS/COMMON/IES/UeNetworkCapability.h create mode 100644 openair-cn/NAS/COMMON/IES/UeRadioCapabilityInformationUpdateNeeded.c create mode 100644 openair-cn/NAS/COMMON/IES/UeRadioCapabilityInformationUpdateNeeded.h create mode 100644 openair-cn/NAS/COMMON/IES/UeSecurityCapability.c create mode 100644 openair-cn/NAS/COMMON/IES/UeSecurityCapability.h create mode 100644 openair-cn/NAS/COMMON/IES/VoiceDomainPreferenceAndUeUsageSetting.c create mode 100644 openair-cn/NAS/COMMON/IES/VoiceDomainPreferenceAndUeUsageSetting.h create mode 100644 openair-cn/NAS/COMMON/UTIL/COPYING create mode 100644 openair-cn/NAS/COMMON/UTIL/Makefile create mode 100644 openair-cn/NAS/COMMON/UTIL/OctetString.c create mode 100644 openair-cn/NAS/COMMON/UTIL/OctetString.h create mode 100644 openair-cn/NAS/COMMON/UTIL/TLVDecoder.c create mode 100644 openair-cn/NAS/COMMON/UTIL/TLVDecoder.h create mode 100644 openair-cn/NAS/COMMON/UTIL/TLVEncoder.c create mode 100644 openair-cn/NAS/COMMON/UTIL/TLVEncoder.h create mode 100644 openair-cn/NAS/COMMON/UTIL/device.c create mode 100644 openair-cn/NAS/COMMON/UTIL/device.h create mode 100644 openair-cn/NAS/COMMON/UTIL/memory.c create mode 100644 openair-cn/NAS/COMMON/UTIL/memory.h create mode 100644 openair-cn/NAS/COMMON/UTIL/nas_log.c create mode 100644 openair-cn/NAS/COMMON/UTIL/nas_log.h create mode 100644 openair-cn/NAS/COMMON/UTIL/nas_timer.c create mode 100644 openair-cn/NAS/COMMON/UTIL/nas_timer.h create mode 100644 openair-cn/NAS/COMMON/UTIL/parser.c create mode 100644 openair-cn/NAS/COMMON/UTIL/parser.h create mode 100644 openair-cn/NAS/COMMON/UTIL/socket.c create mode 100644 openair-cn/NAS/COMMON/UTIL/socket.h create mode 100644 openair-cn/NAS/COMMON/UTIL/stty.c create mode 100644 openair-cn/NAS/COMMON/UTIL/tst/Makefile create mode 100644 openair-cn/NAS/COMMON/UTIL/tst/timer.c create mode 100644 openair-cn/NAS/COMMON/UTIL/tst/timer_debug.txt create mode 120000 openair-cn/NAS/COMMON/commonDef.h create mode 120000 openair-cn/NAS/COMMON/networkDef.h create mode 100644 openair-cn/NAS/COMMON/securityDef.h create mode 100644 openair-cn/NAS/COMMON/userDef.h create mode 100644 openair-cn/NAS/MME/API/MME/COPYING create mode 100644 openair-cn/NAS/MME/API/MME/Makefile create mode 100644 openair-cn/NAS/MME/API/MME/mme_api.c create mode 100644 openair-cn/NAS/MME/API/MME/mme_api.h create mode 100644 openair-cn/NAS/MME/EMM/Attach.c create mode 100644 openair-cn/NAS/MME/EMM/Authentication.c create mode 100644 openair-cn/NAS/MME/EMM/COPYING create mode 100644 openair-cn/NAS/MME/EMM/Detach.c create mode 100644 openair-cn/NAS/MME/EMM/EmmCommon.c create mode 100644 openair-cn/NAS/MME/EMM/EmmCommon.h create mode 100644 openair-cn/NAS/MME/EMM/EmmStatusHdl.c create mode 100644 openair-cn/NAS/MME/EMM/Identification.c create mode 100644 openair-cn/NAS/MME/EMM/IdleMode.c create mode 100644 openair-cn/NAS/MME/EMM/IdleMode.h create mode 100644 openair-cn/NAS/MME/EMM/LowerLayer.c create mode 100644 openair-cn/NAS/MME/EMM/LowerLayer.h create mode 100644 openair-cn/NAS/MME/EMM/Makefile create mode 100644 openair-cn/NAS/MME/EMM/SAP/COPYING create mode 100644 openair-cn/NAS/MME/EMM/SAP/EmmCommonProcedureInitiated.c create mode 100644 openair-cn/NAS/MME/EMM/SAP/EmmDeregistered.c create mode 100644 openair-cn/NAS/MME/EMM/SAP/EmmDeregisteredAttachNeeded.c create mode 100644 openair-cn/NAS/MME/EMM/SAP/EmmDeregisteredAttemptingToAttach.c create mode 100644 openair-cn/NAS/MME/EMM/SAP/EmmDeregisteredInitiated.c create mode 100644 openair-cn/NAS/MME/EMM/SAP/EmmDeregisteredLimitedService.c create mode 100644 openair-cn/NAS/MME/EMM/SAP/EmmDeregisteredNoCellAvailable.c create mode 100644 openair-cn/NAS/MME/EMM/SAP/EmmDeregisteredNoImsi.c create mode 100644 openair-cn/NAS/MME/EMM/SAP/EmmDeregisteredNormalService.c create mode 100644 openair-cn/NAS/MME/EMM/SAP/EmmDeregisteredPlmnSearch.c create mode 100644 openair-cn/NAS/MME/EMM/SAP/EmmNull.c create mode 100644 openair-cn/NAS/MME/EMM/SAP/EmmRegistered.c create mode 100644 openair-cn/NAS/MME/EMM/SAP/EmmRegisteredAttemptingToUpdate.c create mode 100644 openair-cn/NAS/MME/EMM/SAP/EmmRegisteredImsiDetachInitiated.c create mode 100644 openair-cn/NAS/MME/EMM/SAP/EmmRegisteredInitiated.c create mode 100644 openair-cn/NAS/MME/EMM/SAP/EmmRegisteredLimitedService.c create mode 100644 openair-cn/NAS/MME/EMM/SAP/EmmRegisteredNoCellAvailable.c create mode 100644 openair-cn/NAS/MME/EMM/SAP/EmmRegisteredNormalService.c create mode 100644 openair-cn/NAS/MME/EMM/SAP/EmmRegisteredPlmnSearch.c create mode 100644 openair-cn/NAS/MME/EMM/SAP/EmmRegisteredUpdateNeeded.c create mode 100644 openair-cn/NAS/MME/EMM/SAP/EmmServiceRequestInitiated.c create mode 100644 openair-cn/NAS/MME/EMM/SAP/EmmTrackingAreaUpdatingInitiated.c create mode 100644 openair-cn/NAS/MME/EMM/SAP/Makefile create mode 100644 openair-cn/NAS/MME/EMM/SAP/emm_as.c create mode 100644 openair-cn/NAS/MME/EMM/SAP/emm_as.h create mode 100644 openair-cn/NAS/MME/EMM/SAP/emm_asDef.h create mode 100644 openair-cn/NAS/MME/EMM/SAP/emm_cn.c create mode 100644 openair-cn/NAS/MME/EMM/SAP/emm_cn.h create mode 100644 openair-cn/NAS/MME/EMM/SAP/emm_cnDef.h create mode 100644 openair-cn/NAS/MME/EMM/SAP/emm_esm.c create mode 100644 openair-cn/NAS/MME/EMM/SAP/emm_esm.h create mode 100644 openair-cn/NAS/MME/EMM/SAP/emm_esmDef.h create mode 100644 openair-cn/NAS/MME/EMM/SAP/emm_fsm.c create mode 100644 openair-cn/NAS/MME/EMM/SAP/emm_fsm.h create mode 100644 openair-cn/NAS/MME/EMM/SAP/emm_recv.c create mode 100644 openair-cn/NAS/MME/EMM/SAP/emm_recv.h create mode 100644 openair-cn/NAS/MME/EMM/SAP/emm_reg.c create mode 100644 openair-cn/NAS/MME/EMM/SAP/emm_reg.h create mode 100644 openair-cn/NAS/MME/EMM/SAP/emm_regDef.h create mode 100644 openair-cn/NAS/MME/EMM/SAP/emm_sap.c create mode 100644 openair-cn/NAS/MME/EMM/SAP/emm_sap.h create mode 100644 openair-cn/NAS/MME/EMM/SAP/emm_send.c create mode 100644 openair-cn/NAS/MME/EMM/SAP/emm_send.h create mode 100644 openair-cn/NAS/MME/EMM/SecurityModeControl.c create mode 100644 openair-cn/NAS/MME/EMM/ServiceRequestHdl.c create mode 100644 openair-cn/NAS/MME/EMM/TrackingAreaUpdate.c create mode 100644 openair-cn/NAS/MME/EMM/emmData.h create mode 100644 openair-cn/NAS/MME/EMM/emm_data_ctx.c create mode 100644 openair-cn/NAS/MME/EMM/emm_main.c create mode 100644 openair-cn/NAS/MME/EMM/emm_main.h create mode 100644 openair-cn/NAS/MME/EMM/emm_proc.h create mode 100644 openair-cn/NAS/MME/ESM/COPYING create mode 100644 openair-cn/NAS/MME/ESM/DedicatedEpsBearerContextActivation.c create mode 100644 openair-cn/NAS/MME/ESM/DefaultEpsBearerContextActivation.c create mode 100644 openair-cn/NAS/MME/ESM/EpsBearerContextDeactivation.c create mode 100644 openair-cn/NAS/MME/ESM/EsmStatusHdl.c create mode 100644 openair-cn/NAS/MME/ESM/Makefile create mode 100644 openair-cn/NAS/MME/ESM/PdnConnectivity.c create mode 100644 openair-cn/NAS/MME/ESM/PdnDisconnect.c create mode 100644 openair-cn/NAS/MME/ESM/SAP/COPYING create mode 100644 openair-cn/NAS/MME/ESM/SAP/Makefile create mode 100644 openair-cn/NAS/MME/ESM/SAP/esm_recv.c create mode 100644 openair-cn/NAS/MME/ESM/SAP/esm_recv.h create mode 100644 openair-cn/NAS/MME/ESM/SAP/esm_sap.c create mode 100644 openair-cn/NAS/MME/ESM/SAP/esm_sap.h create mode 100644 openair-cn/NAS/MME/ESM/SAP/esm_sapDef.h create mode 100644 openair-cn/NAS/MME/ESM/SAP/esm_send.c create mode 100644 openair-cn/NAS/MME/ESM/SAP/esm_send.h create mode 100644 openair-cn/NAS/MME/ESM/esmData.h create mode 100644 openair-cn/NAS/MME/ESM/esm_ebr.c create mode 100644 openair-cn/NAS/MME/ESM/esm_ebr.h create mode 100644 openair-cn/NAS/MME/ESM/esm_ebr_context.c create mode 100644 openair-cn/NAS/MME/ESM/esm_ebr_context.h create mode 100644 openair-cn/NAS/MME/ESM/esm_ip.c create mode 100644 openair-cn/NAS/MME/ESM/esm_main.c create mode 100644 openair-cn/NAS/MME/ESM/esm_main.h create mode 100644 openair-cn/NAS/MME/ESM/esm_proc.h create mode 100644 openair-cn/NAS/MME/ESM/esm_pt.c create mode 100644 openair-cn/NAS/MME/ESM/esm_pt.h create mode 100644 openair-cn/NAS/MME/MMEprocess.c rename openair-cn/NAS/{ => MME}/nas_defs.h (100%) create mode 100644 openair-cn/NAS/MME/nas_itti_messaging.c rename openair-cn/NAS/{ => MME}/nas_itti_messaging.h (93%) rename openair-cn/NAS/{nas_main.c => MME/nas_mme_task.c} (100%) create mode 100644 openair-cn/NAS/MME/nas_network.c create mode 100644 openair-cn/NAS/MME/nas_network.h create mode 100644 openair-cn/NAS/MME/nas_parser.c create mode 100644 openair-cn/NAS/MME/nas_parser.h create mode 100644 openair-cn/NAS/MME/nas_proc.c create mode 100644 openair-cn/NAS/MME/nas_proc.h delete mode 100644 openair-cn/NAS/Makefile.UE delete mode 100644 openair-cn/NAS/Makefile.inc create mode 100644 openair-cn/NAS/TEST/AS_SIMULATOR/COPYING create mode 100644 openair-cn/NAS/TEST/AS_SIMULATOR/Makefile create mode 100644 openair-cn/NAS/TEST/AS_SIMULATOR/as_data.c create mode 100644 openair-cn/NAS/TEST/AS_SIMULATOR/as_data.h create mode 100644 openair-cn/NAS/TEST/AS_SIMULATOR/as_process.c create mode 100644 openair-cn/NAS/TEST/AS_SIMULATOR/as_process.h create mode 100644 openair-cn/NAS/TEST/AS_SIMULATOR/as_simulator.c create mode 100644 openair-cn/NAS/TEST/AS_SIMULATOR/as_simulator_parser.c create mode 100644 openair-cn/NAS/TEST/AS_SIMULATOR/as_simulator_parser.h create mode 100644 openair-cn/NAS/TEST/AS_SIMULATOR/nas_data.c create mode 100644 openair-cn/NAS/TEST/AS_SIMULATOR/nas_data.h create mode 100644 openair-cn/NAS/TEST/AS_SIMULATOR/nas_process.c create mode 100644 openair-cn/NAS/TEST/AS_SIMULATOR/nas_process.h create mode 100644 openair-cn/NAS/TEST/COPYING create mode 100644 openair-cn/NAS/TEST/MSC/ActivatePDN.png create mode 100644 openair-cn/NAS/TEST/MSC/AuthenticationReject.png create mode 100644 openair-cn/NAS/TEST/MSC/COPYING create mode 100644 openair-cn/NAS/TEST/MSC/DeactivatePDN.png create mode 100644 openair-cn/NAS/TEST/MSC/InitialAttach.png create mode 100644 openair-cn/NAS/TEST/MSC/InitialAttachReject.png create mode 100644 openair-cn/NAS/TEST/MSC/NomalDetach.png create mode 100644 openair-cn/NAS/TEST/MSC/README create mode 100644 openair-cn/NAS/TEST/MSC/SwitchOffDetach.png create mode 100755 openair-cn/NAS/TEST/MSC/msc_gen.py create mode 100755 openair-cn/NAS/TEST/MSC/mscgen create mode 100644 openair-cn/NAS/TEST/NETWORK/COPYING create mode 100644 openair-cn/NAS/TEST/NETWORK/Makefile create mode 100644 openair-cn/NAS/TEST/NETWORK/README create mode 100644 openair-cn/NAS/TEST/NETWORK/network_parser.c create mode 100644 openair-cn/NAS/TEST/NETWORK/network_parser.h create mode 100644 openair-cn/NAS/TEST/NETWORK/network_simulator.c create mode 100644 openair-cn/NAS/TEST/USER/COPYING create mode 100644 openair-cn/NAS/TEST/USER/Makefile create mode 100644 openair-cn/NAS/TEST/USER/user_parser.c create mode 100644 openair-cn/NAS/TEST/USER/user_parser.h create mode 100644 openair-cn/NAS/TEST/USER/user_simulator.c create mode 100644 openair-cn/NAS/TOOLS/COPYING create mode 100644 openair-cn/NAS/TOOLS/Makefile create mode 100644 openair-cn/NAS/TOOLS/network.h create mode 100644 openair-cn/NAS/TOOLS/ue_data.c create mode 100644 openair-cn/NAS/TOOLS/usim_data.c create mode 100644 openair-cn/NAS/UE/API/USER/COPYING create mode 100644 openair-cn/NAS/UE/API/USER/Makefile create mode 100644 openair-cn/NAS/UE/API/USER/at_command.c create mode 100644 openair-cn/NAS/UE/API/USER/at_command.h create mode 100644 openair-cn/NAS/UE/API/USER/at_error.c create mode 100644 openair-cn/NAS/UE/API/USER/at_error.h create mode 100644 openair-cn/NAS/UE/API/USER/at_response.c create mode 100644 openair-cn/NAS/UE/API/USER/at_response.h create mode 100644 openair-cn/NAS/UE/API/USER/tst/Makefile create mode 100644 openair-cn/NAS/UE/API/USER/tst/at_parser.c create mode 100644 openair-cn/NAS/UE/API/USER/tst/at_parser.in create mode 100644 openair-cn/NAS/UE/API/USER/tst/at_parser.in.bis create mode 100644 openair-cn/NAS/UE/API/USER/tst/at_parser.out create mode 100644 openair-cn/NAS/UE/API/USER/tst/at_parser.out.bis create mode 100644 openair-cn/NAS/UE/API/USER/tst/smartcom.txt create mode 100644 openair-cn/NAS/UE/API/USER/user_api.c create mode 100644 openair-cn/NAS/UE/API/USER/user_api.h create mode 100644 openair-cn/NAS/UE/API/USER/user_indication.c create mode 100644 openair-cn/NAS/UE/API/USER/user_indication.h create mode 100644 openair-cn/NAS/UE/API/USIM/COPYING create mode 100644 openair-cn/NAS/UE/API/USIM/Makefile create mode 100644 openair-cn/NAS/UE/API/USIM/aka_functions.c create mode 100644 openair-cn/NAS/UE/API/USIM/aka_functions.h create mode 100644 openair-cn/NAS/UE/API/USIM/usim_api.c create mode 100644 openair-cn/NAS/UE/API/USIM/usim_api.h create mode 100755 openair-cn/NAS/UE/EMM/Attach.c create mode 100755 openair-cn/NAS/UE/EMM/Authentication.c create mode 100755 openair-cn/NAS/UE/EMM/Detach.c create mode 100755 openair-cn/NAS/UE/EMM/EmmStatusHdl.c create mode 100755 openair-cn/NAS/UE/EMM/Identification.c create mode 100755 openair-cn/NAS/UE/EMM/IdleMode.c create mode 100755 openair-cn/NAS/UE/EMM/IdleMode.h create mode 100755 openair-cn/NAS/UE/EMM/LowerLayer.c create mode 100755 openair-cn/NAS/UE/EMM/LowerLayer.h create mode 100755 openair-cn/NAS/UE/EMM/SAP/COPYING create mode 100755 openair-cn/NAS/UE/EMM/SAP/EmmDeregistered.c create mode 100755 openair-cn/NAS/UE/EMM/SAP/EmmDeregisteredAttachNeeded.c create mode 100755 openair-cn/NAS/UE/EMM/SAP/EmmDeregisteredAttemptingToAttach.c create mode 100755 openair-cn/NAS/UE/EMM/SAP/EmmDeregisteredInitiated.c create mode 100755 openair-cn/NAS/UE/EMM/SAP/EmmDeregisteredLimitedService.c create mode 100755 openair-cn/NAS/UE/EMM/SAP/EmmDeregisteredNoCellAvailable.c create mode 100755 openair-cn/NAS/UE/EMM/SAP/EmmDeregisteredNoImsi.c create mode 100755 openair-cn/NAS/UE/EMM/SAP/EmmDeregisteredNormalService.c create mode 100755 openair-cn/NAS/UE/EMM/SAP/EmmDeregisteredPlmnSearch.c create mode 100755 openair-cn/NAS/UE/EMM/SAP/EmmNull.c create mode 100755 openair-cn/NAS/UE/EMM/SAP/EmmRegistered.c create mode 100755 openair-cn/NAS/UE/EMM/SAP/EmmRegisteredAttemptingToUpdate.c create mode 100755 openair-cn/NAS/UE/EMM/SAP/EmmRegisteredImsiDetachInitiated.c create mode 100755 openair-cn/NAS/UE/EMM/SAP/EmmRegisteredInitiated.c create mode 100755 openair-cn/NAS/UE/EMM/SAP/EmmRegisteredLimitedService.c create mode 100755 openair-cn/NAS/UE/EMM/SAP/EmmRegisteredNoCellAvailable.c create mode 100755 openair-cn/NAS/UE/EMM/SAP/EmmRegisteredNormalService.c create mode 100755 openair-cn/NAS/UE/EMM/SAP/EmmRegisteredPlmnSearch.c create mode 100755 openair-cn/NAS/UE/EMM/SAP/EmmRegisteredUpdateNeeded.c create mode 100755 openair-cn/NAS/UE/EMM/SAP/EmmServiceRequestInitiated.c create mode 100755 openair-cn/NAS/UE/EMM/SAP/EmmTrackingAreaUpdatingInitiated.c create mode 100755 openair-cn/NAS/UE/EMM/SAP/emm_as.c create mode 100755 openair-cn/NAS/UE/EMM/SAP/emm_as.h create mode 100755 openair-cn/NAS/UE/EMM/SAP/emm_asDef.h create mode 100755 openair-cn/NAS/UE/EMM/SAP/emm_esm.c create mode 100755 openair-cn/NAS/UE/EMM/SAP/emm_esm.h create mode 100755 openair-cn/NAS/UE/EMM/SAP/emm_esmDef.h create mode 100755 openair-cn/NAS/UE/EMM/SAP/emm_fsm.c create mode 100755 openair-cn/NAS/UE/EMM/SAP/emm_fsm.h create mode 100755 openair-cn/NAS/UE/EMM/SAP/emm_recv.c create mode 100755 openair-cn/NAS/UE/EMM/SAP/emm_recv.h create mode 100755 openair-cn/NAS/UE/EMM/SAP/emm_reg.c create mode 100755 openair-cn/NAS/UE/EMM/SAP/emm_reg.h create mode 100755 openair-cn/NAS/UE/EMM/SAP/emm_regDef.h create mode 100755 openair-cn/NAS/UE/EMM/SAP/emm_sap.c create mode 100755 openair-cn/NAS/UE/EMM/SAP/emm_sap.h create mode 100755 openair-cn/NAS/UE/EMM/SAP/emm_send.c create mode 100755 openair-cn/NAS/UE/EMM/SAP/emm_send.h create mode 100755 openair-cn/NAS/UE/EMM/SecurityModeControl.c create mode 100755 openair-cn/NAS/UE/EMM/ServiceRequestHdl.c create mode 100755 openair-cn/NAS/UE/EMM/TrackingAreaUpdate.c create mode 100755 openair-cn/NAS/UE/EMM/emmData.h create mode 100755 openair-cn/NAS/UE/EMM/emm_main.c create mode 100755 openair-cn/NAS/UE/EMM/emm_main.h create mode 100755 openair-cn/NAS/UE/EMM/emm_proc.h create mode 100755 openair-cn/NAS/UE/ESM/DedicatedEpsBearerContextActivation.c create mode 100755 openair-cn/NAS/UE/ESM/DefaultEpsBearerContextActivation.c create mode 100755 openair-cn/NAS/UE/ESM/EpsBearerContextDeactivation.c create mode 100755 openair-cn/NAS/UE/ESM/EsmStatusHdl.c create mode 100755 openair-cn/NAS/UE/ESM/PdnConnectivity.c create mode 100755 openair-cn/NAS/UE/ESM/PdnDisconnect.c create mode 100755 openair-cn/NAS/UE/ESM/SAP/COPYING create mode 100755 openair-cn/NAS/UE/ESM/SAP/esm_recv.c create mode 100755 openair-cn/NAS/UE/ESM/SAP/esm_recv.h create mode 100755 openair-cn/NAS/UE/ESM/SAP/esm_sap.c create mode 100755 openair-cn/NAS/UE/ESM/SAP/esm_sap.h create mode 100755 openair-cn/NAS/UE/ESM/SAP/esm_sapDef.h create mode 100755 openair-cn/NAS/UE/ESM/SAP/esm_send.c create mode 100755 openair-cn/NAS/UE/ESM/SAP/esm_send.h create mode 100755 openair-cn/NAS/UE/ESM/esmData.h create mode 100755 openair-cn/NAS/UE/ESM/esm_ebr.c create mode 100755 openair-cn/NAS/UE/ESM/esm_ebr.h create mode 100755 openair-cn/NAS/UE/ESM/esm_ebr_context.c create mode 100755 openair-cn/NAS/UE/ESM/esm_ebr_context.h create mode 100755 openair-cn/NAS/UE/ESM/esm_ip.c create mode 100755 openair-cn/NAS/UE/ESM/esm_main.c create mode 100755 openair-cn/NAS/UE/ESM/esm_main.h create mode 100755 openair-cn/NAS/UE/ESM/esm_proc.h create mode 100755 openair-cn/NAS/UE/ESM/esm_pt.c create mode 100755 openair-cn/NAS/UE/ESM/esm_pt.h create mode 100644 openair-cn/NAS/UE/UEprocess.c rename openair-cn/NAS/{ => UE}/nas_itti_messaging.c (90%) mode change 100644 => 100755 create mode 100755 openair-cn/NAS/UE/nas_itti_messaging.h create mode 100755 openair-cn/NAS/UE/nas_network.c create mode 100755 openair-cn/NAS/UE/nas_network.h create mode 100755 openair-cn/NAS/UE/nas_parser.c create mode 100755 openair-cn/NAS/UE/nas_parser.h create mode 100755 openair-cn/NAS/UE/nas_proc.c create mode 100755 openair-cn/NAS/UE/nas_proc.h rename openair-cn/NAS/{ => UE}/nas_ue_task.c (100%) create mode 100644 openair-cn/NAS/UE/nas_user.c create mode 100644 openair-cn/NAS/UE/nas_user.h diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index c74dd51252..bd5aedd7bd 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -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(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 - ) - -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 -) -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(NAS_SRC ${OPENAIRCN_DIR}/NAS/) +set(libnas_api_OBJS + ${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_msg_OBJS + ${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_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 -) - -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 + ${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_usim_OBJS - ${NAS_SRC}api/usim/aka_functions.c - ${NAS_SRC}api/usim/usim_api.c -) - -add_library(NAS_UE - ${OPENAIRCN_DIR}/NAS/nas_ue_task.c -) - -set(libnas_OBJS - - ${OPENAIRCN_DIR}/NAS/nas_itti_messaging.c - ${NAS_SRC}nas_parser.c - ${NAS_SRC}nas_proc.c - ${NAS_SRC}nas_user.c - ${NAS_SRC}nas_network.c - ${libnas_utils_OBJS} - ${libnas_user_OBJS} - ${libnas_usim_OBJS} - ${libnas_emm_OBJS} - ${libnas_emm_msg_OBJS} - ${libnas_emm_sap_OBJS} - ${libnas_esm_OBJS} - ${libnas_esm_msg_OBJS} - ${libnas_esm_sap_OBJS} - ${libnas_ies_OBJS} - ${libnas_api_OBJS} +if(NAS_UE) + set(libnas_ue_api_OBJS + ${NAS_SRC}UE/API/USER/at_command.c + ${NAS_SRC}UE/API/USER/at_error.c + ${NAS_SRC}UE/API/USER/at_response.c + ${NAS_SRC}UE/API/USER/user_api.c + ${NAS_SRC}UE/API/USER/user_indication.c + ${NAS_SRC}UE/API/USIM/aka_functions.c + ${NAS_SRC}UE/API/USIM/usim_api.c + ) + 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(NAS ${libnas_OBJS}) + 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() -if(NAS_UE) - set(NAS_LIB NAS NAS_UE) +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() -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) + # 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) diff --git a/cmake_targets/at_commands/CMakeLists.txt b/cmake_targets/at_commands/CMakeLists.txt index 83180c41f9..cc06b93f1e 100755 --- a/cmake_targets/at_commands/CMakeLists.txt +++ b/cmake_targets/at_commands/CMakeLists.txt @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with OpenAirInterface.The full GNU General Public License is # included in this distribution in the file called "COPYING". If not, -# see . +# see . # # Contact Information # OpenAirInterface Admin: openair_admin@eurecom.fr @@ -51,7 +51,7 @@ set(OPENAIRCN_DIR ${OPENAIR_DIR}/openair-cn) set(OPENAIR_TARGETS ${OPENAIR_DIR}/targets) set(OPENAIR_CMAKE_SCRIPTS ${OPENAIR_DIR}/cmake_targets/tools) set(OPENAIR_BIN_DIR ${OPENAIR_DIR}/targets/bin) -set(OPENAIR_NAS_DIR ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS) +set(OPENAIR_NAS_DIR ${OPENAIR_DIR}/openair-cn/NAS) set(CMAKE_MODULE_PATH "${OPENAIR_DIR}/cmake_targets/tools/MODULES" "${CMAKE_MODULE_PATH}") @@ -151,229 +151,229 @@ target_include_directories(secu_cn PRIVATE # UTIL LIB ################################################################################ set(util_SRC - ${OPENAIR_NAS_DIR}/src/util/device.c - ${OPENAIR_NAS_DIR}/src/util/memory.c - ${OPENAIR_NAS_DIR}/src/util/nas_log.c - ${OPENAIR_NAS_DIR}/src/util/nas_timer.c - ${OPENAIR_NAS_DIR}/src/util/OctetString.c - ${OPENAIR_NAS_DIR}/src/util/parser.c - ${OPENAIR_NAS_DIR}/src/util/TLVDecoder.c - ${OPENAIR_NAS_DIR}/src/util/TLVEncoder.c - ${OPENAIR_NAS_DIR}/src/util/socket.c - ${OPENAIR_NAS_DIR}/src/util/stty.c + ${OPENAIR_NAS_DIR}/COMMON/UTIL/device.c + ${OPENAIR_NAS_DIR}/COMMON/UTIL/memory.c + ${OPENAIR_NAS_DIR}/COMMON/UTIL/nas_log.c + ${OPENAIR_NAS_DIR}/COMMON/UTIL/nas_timer.c + ${OPENAIR_NAS_DIR}/COMMON/UTIL/OctetString.c + ${OPENAIR_NAS_DIR}/COMMON/UTIL/parser.c + ${OPENAIR_NAS_DIR}/COMMON/UTIL/TLVDecoder.c + ${OPENAIR_NAS_DIR}/COMMON/UTIL/TLVEncoder.c + ${OPENAIR_NAS_DIR}/COMMON/UTIL/socket.c + ${OPENAIR_NAS_DIR}/COMMON/UTIL/stty.c ) set(util_HDR - ${OPENAIR_NAS_DIR}/src/util/device.h - ${OPENAIR_NAS_DIR}/src/util/memory.h - ${OPENAIR_NAS_DIR}/src/util/nas_log.h - ${OPENAIR_NAS_DIR}/src/util/nas_timer.h - ${OPENAIR_NAS_DIR}/src/util/OctetString.h - ${OPENAIR_NAS_DIR}/src/util/parser.h - ${OPENAIR_NAS_DIR}/src/util/TLVDecoder.h - ${OPENAIR_NAS_DIR}/src/util/TLVEncoder.h - ${OPENAIR_NAS_DIR}/src/util/socket.h + ${OPENAIR_NAS_DIR}/COMMON/UTIL/device.h + ${OPENAIR_NAS_DIR}/COMMON/UTIL/memory.h + ${OPENAIR_NAS_DIR}/COMMON/UTIL/nas_log.h + ${OPENAIR_NAS_DIR}/COMMON/UTIL/nas_timer.h + ${OPENAIR_NAS_DIR}/COMMON/UTIL/OctetString.h + ${OPENAIR_NAS_DIR}/COMMON/UTIL/parser.h + ${OPENAIR_NAS_DIR}/COMMON/UTIL/TLVDecoder.h + ${OPENAIR_NAS_DIR}/COMMON/UTIL/TLVEncoder.h + ${OPENAIR_NAS_DIR}/COMMON/UTIL/socket.h ) add_library(util ${util_SRC} ${util_HDR}) -target_include_directories(util PRIVATE ${OPENAIR_NAS_DIR}/src/util) +target_include_directories(util PRIVATE ${OPENAIR_NAS_DIR}/COMMON/UTIL + ${OPENAIR_NAS_DIR}/COMMON + ) ################################################################################ # api_user LIB ################################################################################ set(api_user_SRC - ${OPENAIR_NAS_DIR}/src/api/user/at_command.c - ${OPENAIR_NAS_DIR}/src/api/user/at_error.c - ${OPENAIR_NAS_DIR}/src/api/user/at_response.c - ${OPENAIR_NAS_DIR}/src/api/user/user_api.c - ${OPENAIR_NAS_DIR}/src/api/user/user_indication.c + ${OPENAIR_NAS_DIR}/UE/API/USER/at_command.c + ${OPENAIR_NAS_DIR}/UE/API/USER/at_error.c + ${OPENAIR_NAS_DIR}/UE/API/USER/at_response.c + ${OPENAIR_NAS_DIR}/UE/API/USER/user_api.c + ${OPENAIR_NAS_DIR}/UE/API/USER/user_indication.c ) set(api_user_HDR - ${OPENAIR_NAS_DIR}/src/api/user/at_command.h - ${OPENAIR_NAS_DIR}/src/api/user/at_error.h - ${OPENAIR_NAS_DIR}/src/api/user/at_response.h - ${OPENAIR_NAS_DIR}/src/api/user/user_api.h - ${OPENAIR_NAS_DIR}/src/api/user/user_indication.h + ${OPENAIR_NAS_DIR}/UE/API/USER/at_command.h + ${OPENAIR_NAS_DIR}/UE/API/USER/at_error.h + ${OPENAIR_NAS_DIR}/UE/API/USER/at_response.h + ${OPENAIR_NAS_DIR}/UE/API/USER/user_api.h + ${OPENAIR_NAS_DIR}/UE/API/USER/user_indication.h ) add_library(api_user ${api_user_SRC} ${api_user_HDR}) -target_include_directories(api_user PRIVATE ${OPENAIR_NAS_DIR}/src/api/user) +target_include_directories(api_user PRIVATE ${OPENAIR_NAS_DIR}/UE/API/USER + ${OPENAIR_NAS_DIR}/UE + ${OPENAIR_NAS_DIR}/COMMON + ) ################################################################################ # api_usim LIB ################################################################################ set(api_usim_SRC - ${OPENAIR_NAS_DIR}/src/api/usim/aka_functions.c - ${OPENAIR_NAS_DIR}/src/api/usim/usim_api.c + ${OPENAIR_NAS_DIR}/UE/API/USIM/aka_functions.c + ${OPENAIR_NAS_DIR}/UE/API/USIM/usim_api.c ) set(api_usim_HDR - ${OPENAIR_NAS_DIR}/src/api/usim/aka_functions.h - ${OPENAIR_NAS_DIR}/src/api/usim/usim_api.h + ${OPENAIR_NAS_DIR}/UE/API/USIM/aka_functions.h + ${OPENAIR_NAS_DIR}/UE/API/USIM/usim_api.h ) add_library(api_usim ${api_usim_SRC} ${api_usim_HDR}) -target_include_directories(api_usim PRIVATE ${OPENAIR_NAS_DIR}/src/api/usim) +target_include_directories(api_usim PRIVATE ${OPENAIR_NAS_DIR}/UE/API/USIM) ################################################################################ # api_network LIB ################################################################################ set(api_network_SRC - ${OPENAIR_NAS_DIR}/src/api/network/as_message.c - ${OPENAIR_NAS_DIR}/src/api/network/nas_message.c - ${OPENAIR_NAS_DIR}/src/api/network/network_api.c + ${OPENAIR_NAS_DIR}/COMMON/API/NETWORK/as_message.c + ${OPENAIR_NAS_DIR}/COMMON/API/NETWORK/nas_message.c + ${OPENAIR_NAS_DIR}/COMMON/API/NETWORK/network_api.c ) set(api_network_HDR - ${OPENAIR_NAS_DIR}/src/api/network/as_message.h - ${OPENAIR_NAS_DIR}/src/api/network/nas_message.h - ${OPENAIR_NAS_DIR}/src/api/network/network_api.h + ${OPENAIR_NAS_DIR}/COMMON/API/NETWORK/as_message.h + ${OPENAIR_NAS_DIR}/COMMON/API/NETWORK/nas_message.h + ${OPENAIR_NAS_DIR}/COMMON/API/NETWORK/network_api.h ) add_library(api_network ${api_network_SRC} ${api_network_HDR}) -target_include_directories(api_network PRIVATE ${OPENAIR_NAS_DIR}/src/api/network) +target_include_directories(api_network PRIVATE ${OPENAIR_NAS_DIR}/COMMON/API/NETWORK + ${OPENAIR_NAS_DIR}/COMMON + ) ################################################################################ # emm LIB ################################################################################ set(emm_SRC - ${OPENAIR_NAS_DIR}/src/emm//Attach.c - ${OPENAIR_NAS_DIR}/src/emm//Authentication.c - ${OPENAIR_NAS_DIR}/src/emm//Detach.c - ${OPENAIR_NAS_DIR}/src/emm//EmmCommon.c - ${OPENAIR_NAS_DIR}/src/emm//emm_data_ctx.c - ${OPENAIR_NAS_DIR}/src/emm//emm_main.c - ${OPENAIR_NAS_DIR}/src/emm//EmmStatusHdl.c - ${OPENAIR_NAS_DIR}/src/emm//Identification.c - ${OPENAIR_NAS_DIR}/src/emm//IdleMode.c - ${OPENAIR_NAS_DIR}/src/emm//LowerLayer.c - ${OPENAIR_NAS_DIR}/src/emm//SecurityModeControl.c - ${OPENAIR_NAS_DIR}/src/emm//ServiceRequestHdl.c - ${OPENAIR_NAS_DIR}/src/emm//TrackingAreaUpdate.c - - ${OPENAIR_NAS_DIR}/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}/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}/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 diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index f7a8cc9455..1a0b46fed1 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -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 diff --git a/cmake_targets/lte_noS1_build_oai/CMakeLists.txt b/cmake_targets/lte_noS1_build_oai/CMakeLists.txt index ebc39abd41..8be7a19b3d 100644 --- a/cmake_targets/lte_noS1_build_oai/CMakeLists.txt +++ b/cmake_targets/lte_noS1_build_oai/CMakeLists.txt @@ -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) diff --git a/cmake_targets/nas_sim_tools/CMakeLists.txt b/cmake_targets/nas_sim_tools/CMakeLists.txt index 99a6990ae7..1894ba6697 100644 --- a/cmake_targets/nas_sim_tools/CMakeLists.txt +++ b/cmake_targets/nas_sim_tools/CMakeLists.txt @@ -20,30 +20,30 @@ set(OPENAIR_TARGETS $ENV{OPENAIR_DIR}/targets) # Add .h files for dependancies set(usim_SRC - ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/tools/usim_data.c - ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/src/api/usim/usim_api.c - ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/src/api/usim/aka_functions.c - ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/src/util/memory.c - ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/src/util/nas_log.c - ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/src/util/OctetString.c - ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/src/util/TLVEncoder.c + ${OPENAIR_DIR}/openair-cn/NAS/TOOLS/usim_data.c + ${OPENAIR_DIR}/openair-cn/NAS/UE/API/USIM/usim_api.c + ${OPENAIR_DIR}/openair-cn/NAS/UE/API/USIM/aka_functions.c + ${OPENAIR_DIR}/openair-cn/NAS/COMMON/UTIL/memory.c + ${OPENAIR_DIR}/openair-cn/NAS/COMMON/UTIL/nas_log.c + ${OPENAIR_DIR}/openair-cn/NAS/COMMON/UTIL/OctetString.c + ${OPENAIR_DIR}/openair-cn/NAS/COMMON/UTIL/TLVEncoder.c ) set(usim_HDR - ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/tools/network.h - ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/src/api/usim/usim_api.h - ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/src/api/usim/aka_functions.h - ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/src/util/memory.h - ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/src/util/nas_log.h - ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/src/util/OctetString.h - ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/src/util/TLVEncoder.h + ${OPENAIR_DIR}/openair-cn/NAS/TOOLS/network.h + ${OPENAIR_DIR}/openair-cn/NAS/UE/API/USIM/usim_api.h + ${OPENAIR_DIR}/openair-cn/NAS/UE/API/USIM/aka_functions.h + ${OPENAIR_DIR}/openair-cn/NAS/COMMON/UTIL/memory.h + ${OPENAIR_DIR}/openair-cn/NAS/COMMON/UTIL/nas_log.h + ${OPENAIR_DIR}/openair-cn/NAS/COMMON/UTIL/OctetString.h + ${OPENAIR_DIR}/openair-cn/NAS/COMMON/UTIL/TLVEncoder.h ) include_directories( - ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/src/include - ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/src/api/usim - ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/src/emm/ - ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/src/esm/ - ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/src/ies/ - ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/src/util + ${OPENAIR_DIR}/openair-cn/NAS/COMMON + ${OPENAIR_DIR}/openair-cn/NAS/UE/API/USIM + ${OPENAIR_DIR}/openair-cn/NAS/UE/EMM/ + ${OPENAIR_DIR}/openair-cn/NAS/UE/ESM/ + ${OPENAIR_DIR}/openair-cn/NAS/COMMON/IES/ + ${OPENAIR_DIR}/openair-cn/NAS/COMMON/UTIL ) ADD_EXECUTABLE(usim ${usim_SRC} ${usim_HDR}) @@ -51,15 +51,15 @@ ADD_EXECUTABLE(usim ${usim_SRC} ${usim_HDR}) set(nvram_SRC - ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/tools/ue_data.c - ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/src/util/memory.c - ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/src/util/nas_log.c + ${OPENAIR_DIR}/openair-cn/NAS/TOOLS/ue_data.c + ${OPENAIR_DIR}/openair-cn/NAS/COMMON/UTIL/memory.c + ${OPENAIR_DIR}/openair-cn/NAS/COMMON/UTIL/nas_log.c ) set(nvram_HDR - ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/src/emm/emmData.h - ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/src/util/memory.h - ${OPENAIR_DIR}/openair-cn/NAS/EURECOM-NAS/src/include/userDef.h + ${OPENAIR_DIR}/openair-cn/NAS/UE/EMM/emmData.h + ${OPENAIR_DIR}/openair-cn/NAS/COMMON/UTIL/memory.h + ${OPENAIR_DIR}/openair-cn/NAS/COMMON/userDef.h ) ADD_EXECUTABLE(nvram ${nvram_SRC} ${nvram_HDR}) diff --git a/cmake_targets/tools/build_epc b/cmake_targets/tools/build_epc index c29533879f..2cb33024b8 100755 --- a/cmake_targets/tools/build_epc +++ b/cmake_targets/tools/build_epc @@ -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 diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index e3d18844af..81d95c1c89 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -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 \ diff --git a/cmake_targets/tools/check_mme_s6a_certificate b/cmake_targets/tools/check_mme_s6a_certificate index 62d0c53468..aac91f3abe 100755 --- a/cmake_targets/tools/check_mme_s6a_certificate +++ b/cmake_targets/tools/check_mme_s6a_certificate @@ -86,7 +86,11 @@ function main() { else echo_error "Bad mme fqdn found in cert file: $full_hostname fqdn is $fqdn" fi + else + echo_error "File $freediameter_path/etc/freeDiameter/mme.cert.pem not found" fi + else + echo_error "Directory $freediameter_path/etc/freeDiameter not found" fi echo_error "MME S6A: Did not find valid certificate in $freediameter_path/etc/freeDiameter" echo_warning "MME S6A: generating new certificate in $freediameter_path/etc/freeDiameter..." diff --git a/cmake_targets/tools/epc.local.enb.conf.in b/cmake_targets/tools/epc.local.enb.conf.in index 8ae32903af..3ea1bab2bb 100755 --- a/cmake_targets/tools/epc.local.enb.conf.in +++ b/cmake_targets/tools/epc.local.enb.conf.in @@ -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 ); }; diff --git a/cmake_targets/tools/run_enb_s1_usrp b/cmake_targets/tools/run_enb_s1_usrp index 606bd82d79..0653a9eb2a 100755 --- a/cmake_targets/tools/run_enb_s1_usrp +++ b/cmake_targets/tools/run_enb_s1_usrp @@ -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 diff --git a/cmake_targets/tools/run_enb_ue_virt_s1 b/cmake_targets/tools/run_enb_ue_virt_s1 index 6340feee66..2ce29429b1 100755 --- a/cmake_targets/tools/run_enb_ue_virt_s1 +++ b/cmake_targets/tools/run_enb_ue_virt_s1 @@ -214,12 +214,12 @@ function main() is_tun=`is_tun_interface $ENB_INTERFACE_NAME_FOR_S1_MME $ENB_INTERFACE_NAME_FOR_S1U` # if [ $is_tun = "1" ]; then -# $SUDO openvpn --mktun --dev $ENB_INTERFACE_NAME_FOR_S1U;sync -# $SUDO openvpn --mktun --dev $ENB_INTERFACE_NAME_FOR_S1_MME;sync -# $SUDO ip -4 addr add $ENB_IPV4_ADDRESS_FOR_S1U/$ENB_IPV4_NETMASK_FOR_S1U dev $ENB_INTERFACE_NAME_FOR_S1U;sync -# $SUDO ip -4 addr add $ENB_IPV4_ADDRESS_FOR_S1_MME/$ENB_IPV4_NETMASK_FOR_S1_MME dev $ENB_INTERFACE_NAME_FOR_S1_MME;sync -# $SUDO ifconfig $ENB_INTERFACE_NAME_FOR_S1U up;sync -# $SUDO ifconfig $ENB_INTERFACE_NAME_FOR_S1_MME up;sync +# openvpn --mktun --dev $ENB_INTERFACE_NAME_FOR_S1U;sync +# openvpn --mktun --dev $ENB_INTERFACE_NAME_FOR_S1_MME;sync +# ip -4 addr add $ENB_IPV4_ADDRESS_FOR_S1U/$ENB_IPV4_NETMASK_FOR_S1U dev $ENB_INTERFACE_NAME_FOR_S1U;sync +# ip -4 addr add $ENB_IPV4_ADDRESS_FOR_S1_MME/$ENB_IPV4_NETMASK_FOR_S1_MME dev $ENB_INTERFACE_NAME_FOR_S1_MME;sync +# ifconfig $ENB_INTERFACE_NAME_FOR_S1U up;sync +# ifconfig $ENB_INTERFACE_NAME_FOR_S1_MME up;sync # echo_success "Configured local eNB S1 tun interfaces" # else # echo_success "eNB S1 tun interfaces should be ethernet interfaces (no tunnels configured)" @@ -228,21 +228,21 @@ function main() ################################################## # LAUNCH eNB + UE executable ################################################## - $SUDO pkill oaisim - $SUDO rmmod ue_ip > /dev/null 2>&1 + pkill oaisim + rmmod ue_ip > /dev/null 2>&1 echo_success "Bringup UE interface..." - $SUDO insmod $OPENAIR_DIR/targets/bin/ue_ip.ko + insmod $OPENAIR_DIR/targets/bin/ue_ip.ko - $SUDO ip route flush cache + ip route flush cache # Check table 200 lte in /etc/iproute2/rt_tables fgrep lte /etc/iproute2/rt_tables > /dev/null if [ $? -ne 0 ]; then - $SUDO echo "200 lte " >> /etc/iproute2/rt_tables + bash -c echo "200 lte " >> /etc/iproute2/rt_tables fi - $SUDO ip rule add fwmark 1 table lte - $SUDO ip route add default dev oip1 table lte + ip rule add fwmark 1 table lte + ip route add default dev oip1 table lte exe_arguments="$exe_arguments -s15 -AAWGN -y1 -b1 -u1 -Q0" @@ -250,19 +250,19 @@ function main() if [ $run_mscgen -eq 1 ]; then - $SUDO rm -f /tmp/openair.msc.* + rm -f /tmp/openair.msc.* fi if [ $run_gdb -eq 0 ]; then - exec $SUDO $OPENAIR_DIR/targets/bin/oaisim $exe_arguments | tee /tmp/enb_ue_s1.log.txt + exec $OPENAIR_DIR/targets/bin/oaisim.Rel10 $exe_arguments | tee /tmp/enb_ue_s1.log.txt else touch ~/.gdb_enb_ue_s1 chmod 777 ~/.gdb_enb_ue_s1 - echo "file $OPENAIR_DIR/targets/bin/oaisim" > ~/.gdb_enb_ue_s1 + echo "file $OPENAIR_DIR/targets/bin/oaisim.Rel10" > ~/.gdb_enb_ue_s1 echo "set args $exe_arguments" >> ~/.gdb_enb_ue_s1 echo "run" >> ~/.gdb_enb_ue_s1 cat ~/.gdb_enb_ue_s1 - $SUDO gdb -n -x ~/.gdb_enb_ue_s1 + gdb -n -x ~/.gdb_enb_ue_s1 fi if [ $run_mscgen -eq 1 ]; then @@ -281,4 +281,12 @@ function main() } +sudo echo +is_sudo=$? +if [[ "$is_sudo" -ne 0 ]]; then + echo_error "This script must be run by root or a sudo'er" + echo + exit 1 +fi + main "$@" diff --git a/cmake_targets/tools/run_epc b/cmake_targets/tools/run_epc index efc791253b..0fa77c28be 100755 --- a/cmake_targets/tools/run_epc +++ b/cmake_targets/tools/run_epc @@ -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 "$@" diff --git a/common/utils/itti_analyzer/INSTALL b/common/utils/itti_analyzer/INSTALL index a1e89e18ad..2099840756 100644 --- a/common/utils/itti_analyzer/INSTALL +++ b/common/utils/itti_analyzer/INSTALL @@ -1,7 +1,7 @@ Installation Instructions ************************* -Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation, +Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, @@ -12,8 +12,8 @@ without warranty of any kind. Basic Installation ================== - Briefly, the shell commands `./configure; make; make install' should -configure, build, and install this package. The following + Briefly, the shell command `./configure && make && make install' +should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. Some packages provide this `INSTALL' file but do not implement all of the features documented @@ -309,9 +309,10 @@ causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to -an Autoconf bug. Until the bug is fixed you can use this workaround: +an Autoconf limitation. Until the limitation is lifted, you can use +this workaround: - CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash + CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== @@ -367,4 +368,3 @@ operates. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. - diff --git a/openair-cn/GTPV1-U/GTPUAH/cmd.sh b/openair-cn/GTPV1-U/GTPUAH/cmd.sh deleted file mode 100755 index 94c35b043e..0000000000 --- a/openair-cn/GTPV1-U/GTPUAH/cmd.sh +++ /dev/null @@ -1,18 +0,0 @@ -# Clear the iptables mangle table -iptables -t mangle -F - -# Remove GTPU KLM -rmmod xt_GTPUAH - -# Insert the GTPUAH KLM -insmod ./Bin/xt_GTPUAH.ko - -# Copy the userland iptables extenstion library -if [ -d /lib/xtables ]; then - /bin/cp -f ./Bin/libxt_GTPUAH.so /lib/xtables/ -fi - -if [ -d /lib/iptables ]; then - /bin/cp -f ./Bin/libxt_GTPUAH.so /lib/iptables/libipt_GTPUAH.so -fi - diff --git a/openair-cn/GTPV1-U/GTPUAH/COPYING b/openair-cn/GTPV1-U/GTPU_SP/COPYING similarity index 100% rename from openair-cn/GTPV1-U/GTPUAH/COPYING rename to openair-cn/GTPV1-U/GTPU_SP/COPYING diff --git a/openair-cn/GTPV1-U/GTPUAH/INSTALL b/openair-cn/GTPV1-U/GTPU_SP/INSTALL similarity index 100% rename from openair-cn/GTPV1-U/GTPUAH/INSTALL rename to openair-cn/GTPV1-U/GTPU_SP/INSTALL diff --git a/openair-cn/GTPV1-U/GTPUAH/Makefile b/openair-cn/GTPV1-U/GTPU_SP/Makefile similarity index 90% rename from openair-cn/GTPV1-U/GTPUAH/Makefile rename to openair-cn/GTPV1-U/GTPU_SP/Makefile index 1c581789e4..f8b59266e1 100755 --- a/openair-cn/GTPV1-U/GTPUAH/Makefile +++ b/openair-cn/GTPV1-U/GTPU_SP/Makefile @@ -1,5 +1,5 @@ #################################################################################### -# Makefile for iptables extension for the GTPUAH target and GTPUAH klm +# Makefile for iptables extension for the GTPUSP target and GTPUSP klm # # Copyright (c) 2010-2011 Polaris Networks # Author: Pradip Biswas @@ -14,20 +14,20 @@ export BIN_DIR ?= $(shell pwd)/Bin KVERSION = $(shell uname -r) KVERSION_LAST_DIGIT = $(shell echo ${KVERSION} | cut -d "." -f 3 | cut -d "-" -f 1) -obj-m = xt_GTPUAH.o +obj-m = xt_GTPUSP.o EXTRA_CFLAGS += -DKVERSION=$(KVERSION_LAST_DIGIT) all: xtlib echo "Building for Kernel Version: $(KVERSION_LAST_DIGIT)" make -C /lib/modules/$(KVERSION)/build M=$(PWD) modules - chmod 777 xt_GTPUAH.ko - mv xt_GTPUAH.ko $(BIN_DIR)/ + chmod 777 xt_GTPUSP.ko + mv xt_GTPUSP.ko $(BIN_DIR)/ clean: libclean make -C /lib/modules/$(KVERSION)/build M=$(PWD) clean ################################################################################ -# The next section is used by libxt_GTPUAH +# The next section is used by libxt_GTPUSP ################################################################################ XT_IPTABLES_VERSION = $(shell /sbin/iptables -V | cut -d " " -f 2 | cut -b 2-) @@ -47,11 +47,11 @@ endif LIB_CFLAGS := -fPIC -Wall -MMD -D_LARGEFILE_SOURCE=1 -D_LARGE_FILES -D_FILE_OFFSET_BITS=64 \ -D_REENTRANT -pipe -DXTABLES_LIBDIR=\"/usr/local/libexec/xtables\" -DXTABLES_INTERNAL \ - -D_INIT=libxt_GTPUAH_init -DPIC -fPIC -O2 \ + -D_INIT=libxt_GTPUSP_init -DPIC -fPIC -O2 \ -DIPTVERSION=$(IPTVERSION) \ -DIPTABLES_VERSION_STRING=$(IPTABLES_VERSION_STRING) -XT_TARGET := xt_GTPUAH +XT_TARGET := xt_GTPUSP XT_LIBNAME := lib$(XT_TARGET).so XT_BUILD_DIR = $(BIN_DIR)/$(XT_TARGET) @@ -70,7 +70,7 @@ INCLUDE_DIR = -I. \ -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include \ -I/usr/lib64/glib-2.0/include -XT_SOURCES = libxt_GTPUAH.c +XT_SOURCES = libxt_GTPUSP.c XT_OBJECTS := $(addprefix $(XT_BUILD_DIR)/, $(notdir $(XT_SOURCES:.c=.o))) @@ -91,7 +91,7 @@ $(BIN_DIR)/$(XT_LIBNAME): $(XT_OBJECTS) @$(LIB_LD) -shared $(XT_OBJECTS) -o $@ $(XT_BUILD_DIR)/%.o : %.c - @echo "Building GTPUAH ext for version $(IPTVERSION) $(IPTABLES_VERSION_STRING)" + @echo "Building GTPUSP ext for version $(IPTVERSION) $(IPTABLES_VERSION_STRING)" @echo Compiling $< @$(LIB_CC) $(LIB_CFLAGS) -MF $(DF).d $(INCLUDE_DIR) -o $@ -c $< @cp $(DF).d $(DF).P; \ diff --git a/openair-cn/GTPV1-U/GTPUAH/README b/openair-cn/GTPV1-U/GTPU_SP/README similarity index 100% rename from openair-cn/GTPV1-U/GTPUAH/README rename to openair-cn/GTPV1-U/GTPU_SP/README diff --git a/openair-cn/GTPV1-U/GTPUAH/RELEASE_NOTES b/openair-cn/GTPV1-U/GTPU_SP/RELEASE_NOTES similarity index 70% rename from openair-cn/GTPV1-U/GTPUAH/RELEASE_NOTES rename to openair-cn/GTPV1-U/GTPU_SP/RELEASE_NOTES index e8617a4978..022846fcd5 100755 --- a/openair-cn/GTPV1-U/GTPUAH/RELEASE_NOTES +++ b/openair-cn/GTPV1-U/GTPU_SP/RELEASE_NOTES @@ -3,5 +3,4 @@ Known issues in GTPU v1.0 ------------------------- 1. Does not implement the "Transport" action. -2. Does not handle segmented GTPu packets. diff --git a/openair-cn/GTPV1-U/GTPU_SP/cmd.sh b/openair-cn/GTPV1-U/GTPU_SP/cmd.sh new file mode 100755 index 0000000000..428b5b155a --- /dev/null +++ b/openair-cn/GTPV1-U/GTPU_SP/cmd.sh @@ -0,0 +1,18 @@ +# Clear the iptables mangle table +iptables -t mangle -F + +# Remove GTPU KLM +rmmod xt_GTPUSP + +# Insert the GTPUSP KLM +insmod ./Bin/xt_GTPUSP.ko + +# Copy the userland iptables extenstion library +if [ -d /lib/xtables ]; then + /bin/cp -f ./Bin/libxt_GTPUSP.so /lib/xtables/ +fi + +if [ -d /lib/iptables ]; then + /bin/cp -f ./Bin/libxt_GTPUSP.so /lib/iptables/libipt_GTPUSP.so +fi + diff --git a/openair-cn/GTPV1-U/GTPUAH/libxt_GTPUAH.c b/openair-cn/GTPV1-U/GTPU_SP/libxt_GTPUSP.c similarity index 54% rename from openair-cn/GTPV1-U/GTPUAH/libxt_GTPUAH.c rename to openair-cn/GTPV1-U/GTPU_SP/libxt_GTPUSP.c index 0e9c4dc28d..0b749a8759 100755 --- a/openair-cn/GTPV1-U/GTPUAH/libxt_GTPUAH.c +++ b/openair-cn/GTPV1-U/GTPU_SP/libxt_GTPUSP.c @@ -1,4 +1,4 @@ -/* Shared library add-on to iptables for the GTPUAH target +/* Shared library add-on to iptables for the GTPUSP target * * Copyright (c) 2010-2011 Polaris Networks * Author: Pradip Biswas @@ -19,7 +19,7 @@ #include #include -#include "xt_GTPUAH.h" +#include "xt_GTPUSP.h" #if (IPTVERSION <= 135) #include @@ -28,25 +28,25 @@ #endif #if (IPTVERSION <= 135) -#define GTPUAH_PARAM_BAD_VALUE 0 -#define GTPUAH_PARAM_ONLY_ONCE 1 -#define XT_GTPUAH_VERSION IPTABLES_VERSION_STRING -#define gtpuah_strtoui(s,v,m,M) !string_to_number(s,m,M,v) -#define gtpuah_exit_error exit_error +#define GTPUSP_PARAM_BAD_VALUE 0 +#define GTPUSP_PARAM_ONLY_ONCE 1 +#define XT_GTPUSP_VERSION IPTABLES_VERSION_STRING +#define gtpusp_strtoui(s,v,m,M) !string_to_number(s,m,M,v) +#define gtpusp_exit_error exit_error #elif (IPTVERSION > 135) && (IPTVERSION <= 141) -#define GTPUAH_PARAM_BAD_VALUE P_BAD_VALUE -#define GTPUAH_PARAM_ONLY_ONCE P_ONLY_ONCE -#define XT_GTPUAH_VERSION XTABLES_VERSION -#define gtpuah_param_act param_act -#define gtpuah_strtoui(s,v,m,M) !string_to_number(s,m,M,v) -#define gtpuah_exit_error exit_error +#define GTPUSP_PARAM_BAD_VALUE P_BAD_VALUE +#define GTPUSP_PARAM_ONLY_ONCE P_ONLY_ONCE +#define XT_GTPUSP_VERSION XTABLES_VERSION +#define gtpusp_param_act param_act +#define gtpusp_strtoui(s,v,m,M) !string_to_number(s,m,M,v) +#define gtpusp_exit_error exit_error #elif (IPTVERSION > 141) -#define GTPUAH_PARAM_BAD_VALUE XTF_BAD_VALUE -#define GTPUAH_PARAM_ONLY_ONCE XTF_ONLY_ONCE -#define XT_GTPUAH_VERSION XTABLES_VERSION -#define gtpuah_param_act xtables_param_act -#define gtpuah_strtoui(s,v,m,M) xtables_strtoui(s,NULL,v,m,M) -#define gtpuah_exit_error xtables_error +#define GTPUSP_PARAM_BAD_VALUE XTF_BAD_VALUE +#define GTPUSP_PARAM_ONLY_ONCE XTF_ONLY_ONCE +#define XT_GTPUSP_VERSION XTABLES_VERSION +#define gtpusp_param_act xtables_param_act +#define gtpusp_strtoui(s,v,m,M) xtables_strtoui(s,NULL,v,m,M) +#define gtpusp_exit_error xtables_error #endif enum { @@ -57,10 +57,10 @@ enum { PARAM_ACTION = 1 << 4, }; -static void GTPUAH_help(void) +static void GTPUSP_help(void) { printf( - "GTPUAH target options\n" + "GTPUSP target options\n" " --action value Set action \n" " --own-ip value Set own IP address\n" " --own-tun value Set own tunnel id \n" @@ -70,7 +70,7 @@ static void GTPUAH_help(void) #if (IPTVERSION <= 135) /* Stolen from iptables v1.4.7 code */ -void gtpuah_param_act(unsigned int status, const char *p1, ...) +void gtpusp_param_act(unsigned int status, const char *p1, ...) { const char *p2, *p3; va_list args; @@ -79,7 +79,7 @@ void gtpuah_param_act(unsigned int status, const char *p1, ...) va_start(args, p1); switch (status) { - case GTPUAH_PARAM_ONLY_ONCE: + case GTPUSP_PARAM_ONLY_ONCE: p2 = va_arg(args, const char *); b = va_arg(args, unsigned int); @@ -91,7 +91,7 @@ void gtpuah_param_act(unsigned int status, const char *p1, ...) p1, p2); break; - case GTPUAH_PARAM_BAD_VALUE: + case GTPUSP_PARAM_BAD_VALUE: p2 = va_arg(args, const char *); p3 = va_arg(args, const char *); exit_error(PARAMETER_PROBLEM, @@ -109,18 +109,18 @@ void gtpuah_param_act(unsigned int status, const char *p1, ...) #endif -static void parse_gtpuah_addr(const char *s, struct xt_gtpuah_target_info *info, int flag) +static void parse_gtpusp_addr(const char *s, struct xt_gtpusp_target_info *info, int flag) { in_addr_t addr; if ((addr = inet_addr(s)) == -1) { switch (flag) { case PARAM_LADDR: - gtpuah_param_act(GTPUAH_PARAM_BAD_VALUE, "GTPUAH", "--own-ip", s); + gtpusp_param_act(GTPUSP_PARAM_BAD_VALUE, "GTPUSP", "--own-ip", s); break; case PARAM_RADDR: - gtpuah_param_act(GTPUAH_PARAM_BAD_VALUE, "GTPUAH", "--peer-ip", s); + gtpusp_param_act(GTPUSP_PARAM_BAD_VALUE, "GTPUSP", "--peer-ip", s); break; } } @@ -136,18 +136,18 @@ static void parse_gtpuah_addr(const char *s, struct xt_gtpuah_target_info *info, } } -static void parse_gtpuah_tunid(char *s, struct xt_gtpuah_target_info *info, int flag) +static void parse_gtpusp_tunid(char *s, struct xt_gtpusp_target_info *info, int flag) { unsigned int value; - if (!gtpuah_strtoui(s, &value, 0, UINT32_MAX)) { + if (!gtpusp_strtoui(s, &value, 0, UINT32_MAX)) { switch (flag) { case PARAM_LTUN: - gtpuah_param_act(GTPUAH_PARAM_BAD_VALUE, "GTPUAH", "--own-tun", s); + gtpusp_param_act(GTPUSP_PARAM_BAD_VALUE, "GTPUSP", "--own-tun", s); break; case PARAM_RTUN: - gtpuah_param_act(GTPUAH_PARAM_BAD_VALUE, "GTPUAH", "--peer-tun", s); + gtpusp_param_act(GTPUSP_PARAM_BAD_VALUE, "GTPUSP", "--peer-tun", s); break; } } @@ -163,57 +163,57 @@ static void parse_gtpuah_tunid(char *s, struct xt_gtpuah_target_info *info, int } } -static void parse_gtpuah_action(char *s, struct xt_gtpuah_target_info *info, unsigned int *flags) +static void parse_gtpusp_action(char *s, struct xt_gtpusp_target_info *info, unsigned int *flags) { if (!strcmp(s, "add")) { - info->action = PARAM_GTPUAH_ACTION_ADD; - *flags |= PARAM_GTPUAH_ACTION_ADD; + info->action = PARAM_GTPUSP_ACTION_ADD; + *flags |= PARAM_GTPUSP_ACTION_ADD; } else { - gtpuah_param_act(GTPUAH_PARAM_BAD_VALUE, "GTPUAH", "--action", s); + gtpusp_param_act(GTPUSP_PARAM_BAD_VALUE, "GTPUSP", "--action", s); } } #if (IPTVERSION <= 135) static int -GTPUAH_parse(int c, char **argv, int invert, unsigned int *flags, +GTPUSP_parse(int c, char **argv, int invert, unsigned int *flags, const struct ipt_entry *entry, struct ipt_entry_target **target) #else static int -GTPUAH_parse(int c, char **argv, int invert, unsigned int *flags, +GTPUSP_parse(int c, char **argv, int invert, unsigned int *flags, const void *entry, struct xt_entry_target **target) #endif { - struct xt_gtpuah_target_info *info = (struct xt_gtpuah_target_info *) (*target)->data; + struct xt_gtpusp_target_info *info = (struct xt_gtpusp_target_info *) (*target)->data; switch (c) { case '1': - gtpuah_param_act(GTPUAH_PARAM_ONLY_ONCE, "GTPUAH", "--own-ip", *flags & PARAM_LADDR); - parse_gtpuah_addr(optarg, info, PARAM_LADDR); + gtpusp_param_act(GTPUSP_PARAM_ONLY_ONCE, "GTPUSP", "--own-ip", *flags & PARAM_LADDR); + parse_gtpusp_addr(optarg, info, PARAM_LADDR); *flags |= PARAM_LADDR; return 1; case '2': - gtpuah_param_act(GTPUAH_PARAM_ONLY_ONCE, "GTPUAH", "--own-tun", *flags & PARAM_LTUN); - parse_gtpuah_tunid(optarg, info, PARAM_LTUN); + gtpusp_param_act(GTPUSP_PARAM_ONLY_ONCE, "GTPUSP", "--own-tun", *flags & PARAM_LTUN); + parse_gtpusp_tunid(optarg, info, PARAM_LTUN); *flags |= PARAM_LTUN; return 1; case '3': - gtpuah_param_act(GTPUAH_PARAM_ONLY_ONCE, "GTPUAH", "--peer-ip", *flags & PARAM_RADDR); - parse_gtpuah_addr(optarg, info, PARAM_RADDR); + gtpusp_param_act(GTPUSP_PARAM_ONLY_ONCE, "GTPUSP", "--peer-ip", *flags & PARAM_RADDR); + parse_gtpusp_addr(optarg, info, PARAM_RADDR); *flags |= PARAM_RADDR; return 1; case '4': - gtpuah_param_act(GTPUAH_PARAM_ONLY_ONCE, "GTPUAH", "--peer-tun", *flags & PARAM_RTUN); - parse_gtpuah_tunid(optarg, info, PARAM_RTUN); + gtpusp_param_act(GTPUSP_PARAM_ONLY_ONCE, "GTPUSP", "--peer-tun", *flags & PARAM_RTUN); + parse_gtpusp_tunid(optarg, info, PARAM_RTUN); *flags |= PARAM_RTUN; return 1; case '5': - gtpuah_param_act(GTPUAH_PARAM_ONLY_ONCE, "GTPUAH", "--action", *flags & PARAM_ACTION); - parse_gtpuah_action(optarg, info, flags); + gtpusp_param_act(GTPUSP_PARAM_ONLY_ONCE, "GTPUSP", "--action", *flags & PARAM_ACTION); + parse_gtpusp_action(optarg, info, flags); *flags |= PARAM_ACTION; return 1; } @@ -221,33 +221,33 @@ GTPUAH_parse(int c, char **argv, int invert, unsigned int *flags, return 1; } -static void GTPUAH_check(unsigned int flags) +static void GTPUSP_check(unsigned int flags) { if (!(flags & PARAM_ACTION)) { - gtpuah_exit_error(PARAMETER_PROBLEM, "GTPUAH: You must specify action"); + gtpusp_exit_error(PARAMETER_PROBLEM, "GTPUSP: You must specify action"); } if (!(flags & PARAM_LADDR)) { - gtpuah_exit_error(PARAMETER_PROBLEM, "GTPUAH: You must specify local addr"); + gtpusp_exit_error(PARAMETER_PROBLEM, "GTPUSP: You must specify local addr"); } if (!(flags & PARAM_LTUN)) { - gtpuah_exit_error(PARAMETER_PROBLEM, "GTPUAH: You must specify local tunnel id"); + gtpusp_exit_error(PARAMETER_PROBLEM, "GTPUSP: You must specify local tunnel id"); } if (!(flags & PARAM_RADDR)) { - gtpuah_exit_error(PARAMETER_PROBLEM, "GTPUAH: You must specify remote addr"); + gtpusp_exit_error(PARAMETER_PROBLEM, "GTPUSP: You must specify remote addr"); } if (!(flags & PARAM_RTUN)) { - gtpuah_exit_error(PARAMETER_PROBLEM, "GTPUAH: You must specify remote tunnel id"); + gtpusp_exit_error(PARAMETER_PROBLEM, "GTPUSP: You must specify remote tunnel id"); } } static void convert_action_to_string(int action, char *actionstr) { switch(action) { - case PARAM_GTPUAH_ACTION_ADD: + case PARAM_GTPUSP_ACTION_ADD: sprintf (actionstr, "add"); break; @@ -259,19 +259,19 @@ static void convert_action_to_string(int action, char *actionstr) #if (IPTVERSION <= 135) static void -GTPUAH_print(const struct ipt_ip *ip, +GTPUSP_print(const struct ipt_ip *ip, const struct ipt_entry_target *target, int numeric) #else static void -GTPUAH_print(const void *ip, +GTPUSP_print(const void *ip, const struct xt_entry_target *target, int numeric) #endif { - const struct xt_gtpuah_target_info *info = - (struct xt_gtpuah_target_info *) target->data; + const struct xt_gtpusp_target_info *info = + (struct xt_gtpusp_target_info *) target->data; char laddr[64], raddr[64], actionstr[32]; @@ -279,11 +279,11 @@ GTPUAH_print(const void *ip, sprintf (laddr, "%s", inet_ntoa(*(struct in_addr*)&info->laddr)); sprintf (raddr, "%s", inet_ntoa(*(struct in_addr*)&info->raddr)); - printf("GTPUAH self: %s tunnel: 0x%x / peer: %s tunnel: 0x%x / action: %s", + printf("GTPUSP self: %s tunnel: 0x%x / peer: %s tunnel: 0x%x / action: %s", laddr, info->ltun, raddr, info->rtun, actionstr); } -static struct option GTPUAH_opts[] = { +static struct option GTPUSP_opts[] = { { "own-ip", 1, NULL, '1' }, { "own-tun", 1, NULL, '2' }, { "peer-ip", 1, NULL, '3' }, @@ -293,30 +293,30 @@ static struct option GTPUAH_opts[] = { }; #if (IPTVERSION <= 135) -static struct iptables_target gtpuah_tg_reg = { +static struct iptables_target gtpusp_tg_reg = { #else -static struct xtables_target gtpuah_tg_reg = { +static struct xtables_target gtpusp_tg_reg = { #endif - .name = "GTPUAH", - .version = XT_GTPUAH_VERSION, + .name = "GTPUSP", + .version = XT_GTPUSP_VERSION, #if (IPTVERSION > 135) .family = NFPROTO_IPV4, #endif - .size = XT_ALIGN(sizeof(struct xt_gtpuah_target_info)), - .userspacesize = XT_ALIGN(sizeof(struct xt_gtpuah_target_info)), - .help = GTPUAH_help, - .parse = GTPUAH_parse, - .final_check = GTPUAH_check, - .print = GTPUAH_print, - .extra_opts = GTPUAH_opts, + .size = XT_ALIGN(sizeof(struct xt_gtpusp_target_info)), + .userspacesize = XT_ALIGN(sizeof(struct xt_gtpusp_target_info)), + .help = GTPUSP_help, + .parse = GTPUSP_parse, + .final_check = GTPUSP_check, + .print = GTPUSP_print, + .extra_opts = GTPUSP_opts, }; void _init(void) { #if (IPTVERSION <= 135) - register_target(>puah_tg_reg); + register_target(>pusp_tg_reg); #else - xtables_register_target(>puah_tg_reg); + xtables_register_target(>pusp_tg_reg); #endif } diff --git a/openair-cn/GTPV1-U/GTPUAH/xt_GTPUAH.c b/openair-cn/GTPV1-U/GTPU_SP/xt_GTPUSP.c similarity index 77% rename from openair-cn/GTPV1-U/GTPUAH/xt_GTPUAH.c rename to openair-cn/GTPV1-U/GTPU_SP/xt_GTPUSP.c index d9f8633137..24f210e371 100755 --- a/openair-cn/GTPV1-U/GTPUAH/xt_GTPUAH.c +++ b/openair-cn/GTPV1-U/GTPU_SP/xt_GTPUSP.c @@ -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 "); MODULE_DESCRIPTION("GTPu Data Path extension on netfilter"); //----------------------------------------------------------------------------- -static struct xt_target gtpuah_tg_reg[] __read_mostly = { +static struct xt_target gtpusp_tg_reg[] __read_mostly = { { .name = MODULE_NAME, .revision = 0, @@ -91,8 +91,8 @@ static struct xt_target gtpuah_tg_reg[] __read_mostly = { (1 << NF_INET_LOCAL_IN) | (1 << NF_INET_FORWARD), .table = "mangle", - .target = _gtpuah_tg4, - .targetsize = sizeof(struct xt_gtpuah_target_info), + .target = _gtpusp_tg4, + .targetsize = sizeof(struct xt_gtpusp_target_info), .me = THIS_MODULE, }, #ifdef WITH_IPV6 @@ -104,8 +104,8 @@ static struct xt_target gtpuah_tg_reg[] __read_mostly = { (1 << NF_INET_LOCAL_IN) | (1 << NF_INET_FORWARD), .table = "mangle", - .target = _gtpuah_tg6, - .targetsize = sizeof(struct xt_gtpuah_target_info), + .target = _gtpusp_tg6, + .targetsize = sizeof(struct xt_gtpusp_target_info), .me = THIS_MODULE, }, #endif @@ -138,14 +138,14 @@ struct gtpuhdr { u_int16_t length; u_int32_t tunid; }; -typedef struct gtpuah_sock_s { +typedef struct gtpusp_sock_s { struct task_struct *thread; struct sockaddr_in addr; struct socket *sock; struct sockaddr_in addr_send; int running; int thread_stop_requested; -} gtpuah_sock_t; +} gtpusp_sock_t; //----------------------------------------------------------------------------- #define GTPU_HDR_PNBIT 1 @@ -155,7 +155,7 @@ typedef struct gtpuah_sock_s { #define GTPU_FAILURE 1 #define GTPU_SUCCESS !GTPU_FAILURE -#define GTPUAH_2_PRINT_BUFFER_LEN 8192 +#define GTPUSP_2_PRINT_BUFFER_LEN 8192 #define IP_MORE_FRAGMENTS 0x2000 #define NIPADDR(addr) \ @@ -164,8 +164,8 @@ typedef struct gtpuah_sock_s { (uint8_t)((addr & 0x00FF0000) >> 16), \ (uint8_t)((addr & 0xFF000000) >> 24) //----------------------------------------------------------------------------- -static char _gtpuah_print_buffer[GTPUAH_2_PRINT_BUFFER_LEN]; -gtpuah_sock_t _gtpuah_sock; +static char _gtpusp_print_buffer[GTPUSP_2_PRINT_BUFFER_LEN]; +gtpusp_sock_t _gtpusp_sock; INT_MODULE_PARM(gtpu_sgw_port, 2152); MODULE_PARM_DESC(gtpu_sgw_port, "UDP port number for S1U interface (s-GW side)"); @@ -178,7 +178,7 @@ MODULE_PARM_DESC(sgw_addr, "IPv4 address of the S1U IP interface"); //----------------------------------------------------------------------------- static char* -_gtpuah_icmph_type_2_string(uint8_t typeP) +_gtpusp_icmph_type_2_string(uint8_t typeP) //----------------------------------------------------------------------------- { switch (typeP) { @@ -200,7 +200,7 @@ _gtpuah_icmph_type_2_string(uint8_t typeP) } //----------------------------------------------------------------------------- static char* -_gtpuah_nf_inet_hook_2_string(int nf_inet_hookP) +_gtpusp_nf_inet_hook_2_string(int nf_inet_hookP) { //----------------------------------------------------------------------------- switch (nf_inet_hookP) { @@ -230,7 +230,7 @@ _gtpuah_nf_inet_hook_2_string(int nf_inet_hookP) } //----------------------------------------------------------------------------- void -_gtpuah_print_hex_octets(unsigned char* data_pP, unsigned short sizeP) +_gtpusp_print_hex_octets(unsigned char* data_pP, unsigned short sizeP) { //----------------------------------------------------------------------------- @@ -255,27 +255,27 @@ _gtpuah_print_hex_octets(unsigned char* data_pP, unsigned short sizeP) s = tv.tv_sec % 60; snprintf(timeofday, 64, "%02d:%02d:%02d.%06ld", h,m,s,tv.tv_usec); - buffer_marker+=snprintf(&_gtpuah_print_buffer[buffer_marker], GTPUAH_2_PRINT_BUFFER_LEN - buffer_marker,"%s------+-------------------------------------------------+\n",timeofday); - buffer_marker+=snprintf(&_gtpuah_print_buffer[buffer_marker], GTPUAH_2_PRINT_BUFFER_LEN - buffer_marker,"%s | 0 1 2 3 4 5 6 7 8 9 a b c d e f |\n",timeofday); - buffer_marker+=snprintf(&_gtpuah_print_buffer[buffer_marker], GTPUAH_2_PRINT_BUFFER_LEN - buffer_marker,"%s------+-------------------------------------------------+\n",timeofday); - pr_info("%s",_gtpuah_print_buffer); + buffer_marker+=snprintf(&_gtpusp_print_buffer[buffer_marker], GTPUSP_2_PRINT_BUFFER_LEN - buffer_marker,"%s------+-------------------------------------------------+\n",timeofday); + buffer_marker+=snprintf(&_gtpusp_print_buffer[buffer_marker], GTPUSP_2_PRINT_BUFFER_LEN - buffer_marker,"%s | 0 1 2 3 4 5 6 7 8 9 a b c d e f |\n",timeofday); + buffer_marker+=snprintf(&_gtpusp_print_buffer[buffer_marker], GTPUSP_2_PRINT_BUFFER_LEN - buffer_marker,"%s------+-------------------------------------------------+\n",timeofday); + pr_info("%s",_gtpusp_print_buffer); buffer_marker = 0; for (octet_index = 0; octet_index < sizeP; octet_index++) { if ((octet_index % 16) == 0) { if (octet_index != 0) { - buffer_marker+=snprintf(&_gtpuah_print_buffer[buffer_marker], GTPUAH_2_PRINT_BUFFER_LEN - buffer_marker, " |\n"); - pr_info("%s",_gtpuah_print_buffer); + buffer_marker+=snprintf(&_gtpusp_print_buffer[buffer_marker], GTPUSP_2_PRINT_BUFFER_LEN - buffer_marker, " |\n"); + pr_info("%s",_gtpusp_print_buffer); buffer_marker = 0; } - buffer_marker+=snprintf(&_gtpuah_print_buffer[buffer_marker], GTPUAH_2_PRINT_BUFFER_LEN - buffer_marker, "%s %04ld |",timeofday, octet_index); + buffer_marker+=snprintf(&_gtpusp_print_buffer[buffer_marker], GTPUSP_2_PRINT_BUFFER_LEN - buffer_marker, "%s %04ld |",timeofday, octet_index); } /* * Print every single octet in hexadecimal form */ - buffer_marker+=snprintf(&_gtpuah_print_buffer[buffer_marker], GTPUAH_2_PRINT_BUFFER_LEN - buffer_marker, " %02x", data_pP[octet_index]); + buffer_marker+=snprintf(&_gtpusp_print_buffer[buffer_marker], GTPUSP_2_PRINT_BUFFER_LEN - buffer_marker, " %02x", data_pP[octet_index]); /* * Align newline and pipes according to the octets in groups of 2 */ @@ -285,11 +285,11 @@ _gtpuah_print_hex_octets(unsigned char* data_pP, unsigned short sizeP) * Append enough spaces and put final pipe */ for (aindex = octet_index; aindex < 16; ++aindex) - buffer_marker+=snprintf(&_gtpuah_print_buffer[buffer_marker], GTPUAH_2_PRINT_BUFFER_LEN - buffer_marker, " "); + buffer_marker+=snprintf(&_gtpusp_print_buffer[buffer_marker], GTPUSP_2_PRINT_BUFFER_LEN - buffer_marker, " "); //SGI_IF_DEBUG(" "); - buffer_marker+=snprintf(&_gtpuah_print_buffer[buffer_marker], GTPUAH_2_PRINT_BUFFER_LEN - buffer_marker, " |\n"); - pr_info("%s",_gtpuah_print_buffer); + buffer_marker+=snprintf(&_gtpusp_print_buffer[buffer_marker], GTPUSP_2_PRINT_BUFFER_LEN - buffer_marker, " |\n"); + pr_info("%s",_gtpusp_print_buffer); } // for uplink GTPU traffic on S-GW @@ -307,18 +307,18 @@ static int _udp_thread(void *data) unsigned char gtp_resp[1024]; /* kernel thread initialization */ - _gtpuah_sock.running = 1; + _gtpusp_sock.running = 1; PR_INFO(MODULE_NAME": listening on port %d\n", gtpu_sgw_port); /* main loop */ - while(_gtpuah_sock.thread_stop_requested == 0){ + while(_gtpusp_sock.thread_stop_requested == 0){ if (kthread_should_stop()) { - _gtpuah_sock.running = 0; + _gtpusp_sock.running = 0; PR_INFO(MODULE_NAME": kthread_stop initiated exit at %lu \n", jiffies); return -1; //Exit from the thread. Return value will be passed to kthread_stop() } - size = _gtpuah_ksocket_receive(_gtpuah_sock.sock, &_gtpuah_sock.addr, buf, bufsize); + size = _gtpusp_ksocket_receive(_gtpusp_sock.sock, &_gtpusp_sock.addr, buf, bufsize); if (size <= 0) { if (size != -EAGAIN) { @@ -337,12 +337,12 @@ static int _udp_thread(void *data) #endif PR_INFO(MODULE_NAME": received %d bytes\n", size); - if ((tx_size = _gtpuah_ksocket_process_gtp(buf, size, gtp_resp)) > 0) { - //ksocket_send(_gtpuah_sock.sock, &_gtpuah_sock.addr_send, buf, gtp_resp, tx_size, NULL, 0)); + if ((tx_size = _gtpusp_ksocket_process_gtp(buf, size, gtp_resp)) > 0) { + //ksocket_send(_gtpusp_sock.sock, &_gtpusp_sock.addr_send, buf, gtp_resp, tx_size, NULL, 0)); } } } - _gtpuah_sock.running = 0; + _gtpusp_sock.running = 0; if (kthread_should_stop()) { PR_INFO(MODULE_NAME": kthread_stop initiated exit at %lu \n", jiffies); return -1; //Exit from the thread. Return value will be passed to kthread_stop() @@ -352,7 +352,7 @@ static int _udp_thread(void *data) } //----------------------------------------------------------------------------- -static int _gtpuah_ksocket_process_gtp(const unsigned char * const rx_buf_pP, const int lenP, unsigned char* tx_buf_pP) +static int _gtpusp_ksocket_process_gtp(const unsigned char * const rx_buf_pP, const int lenP, unsigned char* tx_buf_pP) //----------------------------------------------------------------------------- { gtpv1u_msg_t gtpv1u_msg; @@ -482,7 +482,7 @@ free_skb: } //----------------------------------------------------------------------------- -static int _gtpuah_ksocket_receive(struct socket* sock_pP, struct sockaddr_in* addr_pP, unsigned char* buf_pP, int lenP) +static int _gtpusp_ksocket_receive(struct socket* sock_pP, struct sockaddr_in* addr_pP, unsigned char* buf_pP, int lenP) //----------------------------------------------------------------------------- { struct msghdr msg; @@ -517,7 +517,7 @@ static int _gtpuah_ksocket_receive(struct socket* sock_pP, struct sockaddr_in* a } //----------------------------------------------------------------------------- -static int _gtpuah_ksocket_send(struct socket *sock_pP, struct sockaddr_in *addr_pP, unsigned char *gtpuh_pP, int len_gtpP, unsigned char *buf_ip_pP, int len_ipP) +static int _gtpusp_ksocket_send(struct socket *sock_pP, struct sockaddr_in *addr_pP, unsigned char *gtpuh_pP, int len_gtpP, unsigned char *buf_ip_pP, int len_ipP) //----------------------------------------------------------------------------- { struct msghdr msg; @@ -566,7 +566,7 @@ static int _gtpuah_ksocket_send(struct socket *sock_pP, struct sockaddr_in *addr #ifdef WITH_IPV6 //----------------------------------------------------------------------------- static void -_gtpuah_tg6_add(struct sk_buff *old_skb_pP, const struct xt_action_param *par_pP) +_gtpusp_tg6_add(struct sk_buff *old_skb_pP, const struct xt_action_param *par_pP) { //----------------------------------------------------------------------------- } @@ -574,7 +574,7 @@ _gtpuah_tg6_add(struct sk_buff *old_skb_pP, const struct xt_action_param *par_pP //----------------------------------------------------------------------------- static void -_gtpuah_tg4_add(struct sk_buff *old_skb_pP, const struct xt_action_param *par_pP) +_gtpusp_tg4_add(struct sk_buff *old_skb_pP, const struct xt_action_param *par_pP) { //----------------------------------------------------------------------------- struct iphdr *old_iph_p = ip_hdr(old_skb_pP); @@ -596,21 +596,21 @@ _gtpuah_tg4_add(struct sk_buff *old_skb_pP, const struct xt_action_param *par_pP //---------------------------------------------------------------------------- ct = nf_ct_get(old_skb_pP, &ctinfo); if (ct == NULL) { - PR_INFO(MODULE_NAME": _gtpuah_target_add force targinfo ltun %u to skb_pP mark %u\n", - ((const struct xt_gtpuah_target_info *)(par_pP->targinfo))->ltun, + PR_INFO(MODULE_NAME": _gtpusp_target_add force targinfo ltun %u to skb_pP mark %u\n", + ((const struct xt_gtpusp_target_info *)(par_pP->targinfo))->ltun, old_skb_pP->mark); - newmark = ((const struct xt_gtpuah_target_info *)(par_pP->targinfo))->ltun; + newmark = ((const struct xt_gtpusp_target_info *)(par_pP->targinfo))->ltun; } else { //XT_CONNMARK_RESTORE: newmark = old_skb_pP->mark ^ ct->mark; - PR_INFO(MODULE_NAME": _gtpuah_target_add restore mark %u (skb mark %u ct mark %u) len %u sgw addr %x\n", + PR_INFO(MODULE_NAME": _gtpusp_target_add restore mark %u (skb mark %u ct mark %u) len %u sgw addr %x\n", newmark, old_skb_pP->mark, ct->mark, orig_iplen, - ((const struct xt_gtpuah_target_info *)(par_pP->targinfo))->raddr); - if (newmark != ((const struct xt_gtpuah_target_info *)(par_pP->targinfo))->ltun) { - pr_warn(MODULE_NAME": _gtpuah_target_add restore mark 0x%x mismatch ltun 0x%x (rtun 0x%x)", - newmark, ((const struct xt_gtpuah_target_info *)(par_pP->targinfo))->ltun, - ((const struct xt_gtpuah_target_info *)(par_pP->targinfo))->rtun); + ((const struct xt_gtpusp_target_info *)(par_pP->targinfo))->raddr); + if (newmark != ((const struct xt_gtpusp_target_info *)(par_pP->targinfo))->ltun) { + pr_warn(MODULE_NAME": _gtpusp_target_add restore mark 0x%x mismatch ltun 0x%x (rtun 0x%x)", + newmark, ((const struct xt_gtpusp_target_info *)(par_pP->targinfo))->ltun, + ((const struct xt_gtpusp_target_info *)(par_pP->targinfo))->rtun); } } @@ -619,28 +619,28 @@ _gtpuah_tg4_add(struct sk_buff *old_skb_pP, const struct xt_action_param *par_pP gtpuh.flags = 0x30; /* v1 and Protocol-type=GTP */ gtpuh.msgtype = 0xff; /* T-PDU */ gtpuh.length = htons(orig_iplen); - gtpuh.tunid = htonl(((const struct xt_gtpuah_target_info *)(par_pP->targinfo))->rtun); + gtpuh.tunid = htonl(((const struct xt_gtpusp_target_info *)(par_pP->targinfo))->rtun); - _gtpuah_sock.addr_send.sin_addr.s_addr = ((const struct xt_gtpuah_target_info *)(par_pP->targinfo))->raddr; - _gtpuah_ksocket_send(_gtpuah_sock.sock, &_gtpuah_sock.addr_send, (unsigned char*)>puh, sizeof(gtpuh), (unsigned char*)old_iph_p, orig_iplen); + _gtpusp_sock.addr_send.sin_addr.s_addr = ((const struct xt_gtpusp_target_info *)(par_pP->targinfo))->raddr; + _gtpusp_ksocket_send(_gtpusp_sock.sock, &_gtpusp_sock.addr_send, (unsigned char*)>puh, sizeof(gtpuh), (unsigned char*)old_iph_p, orig_iplen); return ; } #ifdef WITH_IPV6 //----------------------------------------------------------------------------- static unsigned int -_gtpuah_tg6(struct sk_buff *skb_pP, const struct xt_action_param *par_pP) +_gtpusp_tg6(struct sk_buff *skb_pP, const struct xt_action_param *par_pP) { //----------------------------------------------------------------------------- - const struct xt_gtpuah_target_info *tgi_p = par_pP->targinfo; + const struct xt_gtpusp_target_info *tgi_p = par_pP->targinfo; if (tgi_p == NULL) { return NF_ACCEPT; } - if (tgi_p->action == PARAM_GTPUAH_ACTION_ADD) { - _gtpuah_tg6_add(skb_pP, par_pP); + if (tgi_p->action == PARAM_GTPUSP_ACTION_ADD) { + _gtpusp_tg6_add(skb_pP, par_pP); return NF_DROP; // TODO } @@ -650,17 +650,17 @@ _gtpuah_tg6(struct sk_buff *skb_pP, const struct xt_action_param *par_pP) //----------------------------------------------------------------------------- static unsigned int -_gtpuah_tg4(struct sk_buff *skb_pP, const struct xt_action_param *par_pP) +_gtpusp_tg4(struct sk_buff *skb_pP, const struct xt_action_param *par_pP) { //----------------------------------------------------------------------------- - const struct xt_gtpuah_target_info *tgi_p = par_pP->targinfo; + const struct xt_gtpusp_target_info *tgi_p = par_pP->targinfo; if (tgi_p == NULL) { return NF_ACCEPT; } - if (tgi_p->action == PARAM_GTPUAH_ACTION_ADD) { - _gtpuah_tg4_add(skb_pP, par_pP); + if (tgi_p->action == PARAM_GTPUSP_ACTION_ADD) { + _gtpusp_tg4_add(skb_pP, par_pP); return NF_DROP; } @@ -669,7 +669,7 @@ _gtpuah_tg4(struct sk_buff *skb_pP, const struct xt_action_param *par_pP) //----------------------------------------------------------------------------- static int -__init gtpuah_tg_init(void) +__init gtpusp_tg_init(void) //----------------------------------------------------------------------------- { int err; @@ -689,69 +689,69 @@ __init gtpuah_tg_init(void) gtpu_enb_port, gtpu_sgw_port, sgw_addr); // UDP socket socket - memset(&_gtpuah_sock, 0, sizeof(gtpuah_sock_t)); + memset(&_gtpusp_sock, 0, sizeof(gtpusp_sock_t)); /* create a socket */ - if ((err = sock_create(AF_INET, SOCK_DGRAM, IPPROTO_UDP, &_gtpuah_sock.sock)) < 0 ) { + if ((err = sock_create(AF_INET, SOCK_DGRAM, IPPROTO_UDP, &_gtpusp_sock.sock)) < 0 ) { PR_INFO(": Could not create a datagram socket, error = %d\n", -ENXIO); return err; } - _gtpuah_sock.addr.sin_family = AF_INET; - _gtpuah_sock.addr.sin_port = htons(gtpu_sgw_port); - _gtpuah_sock.addr.sin_addr.s_addr = in_aton(sgw_addr); + _gtpusp_sock.addr.sin_family = AF_INET; + _gtpusp_sock.addr.sin_port = htons(gtpu_sgw_port); + _gtpusp_sock.addr.sin_addr.s_addr = in_aton(sgw_addr); - _gtpuah_sock.addr_send.sin_family = AF_INET; - _gtpuah_sock.addr_send.sin_port = htons(gtpu_enb_port); - _gtpuah_sock.addr_send.sin_addr.s_addr = in_aton(sgw_addr); + _gtpusp_sock.addr_send.sin_family = AF_INET; + _gtpusp_sock.addr_send.sin_port = htons(gtpu_enb_port); + _gtpusp_sock.addr_send.sin_addr.s_addr = in_aton(sgw_addr); - _gtpuah_sock.thread_stop_requested = 0; + _gtpusp_sock.thread_stop_requested = 0; - if ( (err = _gtpuah_sock.sock->ops->bind(_gtpuah_sock.sock, (struct sockaddr *)&_gtpuah_sock.addr, sizeof(struct sockaddr) ) ) < 0) { + if ( (err = _gtpusp_sock.sock->ops->bind(_gtpusp_sock.sock, (struct sockaddr *)&_gtpusp_sock.addr, sizeof(struct sockaddr) ) ) < 0) { pr_info(MODULE_NAME": Could not bind socket, error = %d\n", -err); goto close_and_out; } // start kernel thread - _gtpuah_sock.thread = kthread_run((void *)_udp_thread, NULL, MODULE_NAME); - if (IS_ERR(_gtpuah_sock.thread)) { + _gtpusp_sock.thread = kthread_run((void *)_udp_thread, NULL, MODULE_NAME); + if (IS_ERR(_gtpusp_sock.thread)) { pr_info(MODULE_NAME": unable to start kernel thread\n"); return -ENOMEM; } - if((_gtpuah_sock.thread)) { - wake_up_process(_gtpuah_sock.thread); + if((_gtpusp_sock.thread)) { + wake_up_process(_gtpusp_sock.thread); } - return xt_register_targets(gtpuah_tg_reg, ARRAY_SIZE(gtpuah_tg_reg)); + return xt_register_targets(gtpusp_tg_reg, ARRAY_SIZE(gtpusp_tg_reg)); close_and_out: - sock_release(_gtpuah_sock.sock); - _gtpuah_sock.sock = NULL; + sock_release(_gtpusp_sock.sock); + _gtpusp_sock.sock = NULL; return err; } //----------------------------------------------------------------------------- static void -__exit gtpuah_tg_exit(void) +__exit gtpusp_tg_exit(void) //----------------------------------------------------------------------------- { int err; int loop = 0; - if (_gtpuah_sock.thread==NULL) { + if (_gtpusp_sock.thread==NULL) { pr_info(MODULE_NAME": no kernel thread to kill\n"); } else { - if (_gtpuah_sock.running > 0) { - _gtpuah_sock.thread_stop_requested = 1; + if (_gtpusp_sock.running > 0) { + _gtpusp_sock.thread_stop_requested = 1; pr_info(MODULE_NAME": exit kernel thread requested\n"); do { pr_info(MODULE_NAME": waking up thread with datagram\n"); msleep(5); pr_info(MODULE_NAME": waiting for thread...\n"); loop++; - } while ((_gtpuah_sock.running > 0) && (loop < 20)); - if (_gtpuah_sock.running > 0) { + } while ((_gtpusp_sock.running > 0) && (loop < 20)); + if (_gtpusp_sock.running > 0) { pr_info(MODULE_NAME": stopping kernel thread\n"); - err = kthread_stop(_gtpuah_sock.thread); + err = kthread_stop(_gtpusp_sock.thread); if(!err) { pr_info(MODULE_NAME": Successfully killed kernel thread!\n"); } else { @@ -764,17 +764,17 @@ __exit gtpuah_tg_exit(void) } /* free allocated resources before exit */ - if (_gtpuah_sock.sock != NULL) { - sock_release(_gtpuah_sock.sock); - _gtpuah_sock.sock = NULL; + if (_gtpusp_sock.sock != NULL) { + sock_release(_gtpusp_sock.sock); + _gtpusp_sock.sock = NULL; } - xt_unregister_targets(gtpuah_tg_reg, ARRAY_SIZE(gtpuah_tg_reg)); + xt_unregister_targets(gtpusp_tg_reg, ARRAY_SIZE(gtpusp_tg_reg)); pr_info(MODULE_NAME": Unloading module\n"); } -module_init(gtpuah_tg_init); -module_exit(gtpuah_tg_exit); -MODULE_ALIAS("ipt6_GTPUAH"); -MODULE_ALIAS("ipt_GTPUAH"); +module_init(gtpusp_tg_init); +module_exit(gtpusp_tg_exit); +MODULE_ALIAS("ipt6_GTPUSP"); +MODULE_ALIAS("ipt_GTPUSP"); diff --git a/openair-cn/GTPV1-U/GTPUAH/xt_GTPUAH.h b/openair-cn/GTPV1-U/GTPU_SP/xt_GTPUSP.h similarity index 84% rename from openair-cn/GTPV1-U/GTPUAH/xt_GTPUAH.h rename to openair-cn/GTPV1-U/GTPU_SP/xt_GTPUSP.h index e59b722627..e4d72f5875 100755 --- a/openair-cn/GTPV1-U/GTPUAH/xt_GTPUAH.h +++ b/openair-cn/GTPV1-U/GTPU_SP/xt_GTPUSP.h @@ -9,11 +9,11 @@ * */ -enum xt_gtpuah_mode_ { - PARAM_GTPUAH_ACTION_ADD = 1 << 8, +enum xt_gtpusp_mode_ { + PARAM_GTPUSP_ACTION_ADD = 1 << 8, }; -struct xt_gtpuah_target_info { +struct xt_gtpusp_target_info { u_int32_t laddr __attribute__((aligned(8))); u_int32_t raddr __attribute__((aligned(8))); u_int32_t ltun __attribute__((aligned(8))); diff --git a/openair-cn/NAS/COMMON/API/NETWORK/COPYING b/openair-cn/NAS/COMMON/API/NETWORK/COPYING new file mode 100644 index 0000000000..94a9ed024d --- /dev/null +++ b/openair-cn/NAS/COMMON/API/NETWORK/COPYING @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/openair-cn/NAS/Makefile.am b/openair-cn/NAS/COMMON/API/NETWORK/Makefile similarity index 52% rename from openair-cn/NAS/Makefile.am rename to openair-cn/NAS/COMMON/API/NETWORK/Makefile index 4e71ef5e72..cce6a240ee 100644 --- a/openair-cn/NAS/Makefile.am +++ b/openair-cn/NAS/COMMON/API/NETWORK/Makefile @@ -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 \ No newline at end of file diff --git a/openair-cn/NAS/COMMON/API/NETWORK/as_message.c b/openair-cn/NAS/COMMON/API/NETWORK/as_message.c new file mode 100644 index 0000000000..b0f07f937d --- /dev/null +++ b/openair-cn/NAS/COMMON/API/NETWORK/as_message.c @@ -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 . + + 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 // memcpy +#include // free + +/****************************************************************************/ +/**************** E X T E R N A L D E F I N I T I O N S ****************/ +/****************************************************************************/ + +/****************************************************************************/ +/******************* L O C A L D E F I N I T I O N S *******************/ +/****************************************************************************/ + +/****************************************************************************/ +/****************** 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 *********************/ +/****************************************************************************/ + diff --git a/openair-cn/NAS/COMMON/API/NETWORK/as_message.h b/openair-cn/NAS/COMMON/API/NETWORK/as_message.h new file mode 120000 index 0000000000..ef8d3686fd --- /dev/null +++ b/openair-cn/NAS/COMMON/API/NETWORK/as_message.h @@ -0,0 +1 @@ +../../../../../openair2/COMMON/as_message.h \ No newline at end of file diff --git a/openair-cn/NAS/COMMON/API/NETWORK/l2_message.h b/openair-cn/NAS/COMMON/API/NETWORK/l2_message.h new file mode 100644 index 0000000000..ced2b54bc3 --- /dev/null +++ b/openair-cn/NAS/COMMON/API/NETWORK/l2_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 . + + 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__*/ diff --git a/openair-cn/NAS/COMMON/API/NETWORK/nas_message.c b/openair-cn/NAS/COMMON/API/NETWORK/nas_message.c new file mode 100644 index 0000000000..9896ebfde0 --- /dev/null +++ b/openair-cn/NAS/COMMON/API/NETWORK/nas_message.c @@ -0,0 +1,1436 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +/***************************************************************************** + +Source nas_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 + +*****************************************************************************/ + +#include "nas_message.h" +#include "nas_log.h" + +#include "TLVDecoder.h" +#include "TLVEncoder.h" + +#include // malloc, free +#include // memcpy + +#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 +#include "secu_defs.h" +#include "emmData.h" + +/****************************************************************************/ +/**************** E X T E R N A L D E F I N I T I O N S ****************/ +/****************************************************************************/ + +/****************************************************************************/ +/******************* L O C A L D E F I N I T I O N S *******************/ +/****************************************************************************/ + + +/* Functions used to decode layer 3 NAS messages */ +static int _nas_message_header_decode(const char* buffer, + nas_message_security_header_t* header, int length); +static int _nas_message_plain_decode(const char* buffer, + const nas_message_security_header_t* header, + nas_message_plain_t* msg, int length); +static int _nas_message_protected_decode(const char* buffer, + nas_message_security_header_t* header, + nas_message_plain_t* msg, int length, + const emm_security_context_t * const emm_security_context); + +/* Functions used to encode layer 3 NAS messages */ +static int _nas_message_header_encode(char* buffer, + const nas_message_security_header_t* header, int length); +static int _nas_message_plain_encode(char* buffer, + const nas_message_security_header_t* header, + const nas_message_plain_t* msg, int length); + +static int _nas_message_protected_encode( + char *buffer, + const nas_message_security_protected_t *msg, + int length, + void *security); + +/* Functions used to decrypt and encrypt layer 3 NAS messages */ +static int _nas_message_decrypt( + char* dest, + const char* src, + UInt8_t type, + UInt32_t code, + UInt8_t seq, + int length, + const emm_security_context_t * const emm_security_context); + + +static int +_nas_message_encrypt( + char *dest, + const char *src, + UInt8_t type, + UInt32_t code, + UInt8_t seq, + int const direction, + int length, + const emm_security_context_t * const emm_security_context); + +/* Functions used for integrity protection of layer 3 NAS messages */ +static UInt32_t _nas_message_get_mac( + const char * const buffer, + int const length, + int const direction, + const emm_security_context_t * const emm_security_context); + +/****************************************************************************/ +/****************** E X P O R T E D F U N C T I O N S ******************/ +/****************************************************************************/ + +/**************************************************************************** + ** ** + ** Name: nas_message_encrypt() ** + ** ** + ** Description: Encripts plain NAS message into security protected NAS ** + ** message ** + ** ** + ** Inputs: inbuf: Input buffer containing plain NAS message ** + ** header: Security protected header to be applied ** + ** length: Number of bytes that should be encrypted ** + ** Others: None ** + ** ** + ** Outputs: outbuf: Output buffer containing security protec- ** + ** ted message ** + ** Return: The number of bytes in the output buffer ** + ** if the input buffer has been successfully ** + ** encrypted; Negative error code otherwise. ** + ** Others: None ** + ** ** + ***************************************************************************/ +int +nas_message_encrypt( + const char *inbuf, + char *outbuf, + const nas_message_security_header_t *header, + int length, + void *security) +{ + LOG_FUNC_IN; + emm_security_context_t *emm_security_context = (emm_security_context_t*)security; + int bytes = length; + + /* Encode the header */ + int size = _nas_message_header_encode(outbuf, header, length); + + if (size < 0) { + LOG_FUNC_RETURN (TLV_ENCODE_BUFFER_TOO_SHORT); + } else if (size > 1) { + /* Encrypt the plain NAS message */ + bytes = _nas_message_encrypt(outbuf + size, inbuf, + header->security_header_type, + header->message_authentication_code, + header->sequence_number, +#ifdef NAS_MME + SECU_DIRECTION_DOWNLINK, +#else + SECU_DIRECTION_UPLINK, +#endif + length - size, + emm_security_context); + + /* Integrity protected the NAS message */ + if (bytes > 0) { + /* Compute offset of the sequence number field */ + int offset = size - sizeof(UInt8_t); + /* Compute the NAS message authentication code */ + UInt32_t mac = _nas_message_get_mac( + outbuf + offset, + bytes + size - offset, +#ifdef NAS_MME + SECU_DIRECTION_DOWNLINK, +#else + SECU_DIRECTION_UPLINK, +#endif + emm_security_context); + /* Set the message authentication code of the NAS message */ + *(UInt32_t*)(outbuf + sizeof(UInt8_t)) = htonl(mac); + } + } else { + /* The input buffer does not need to be encrypted */ + memcpy(outbuf, inbuf, length); + } + +#ifdef NAS_MME + /* TS 124.301, section 4.4.3.1 + * The NAS sequence number part of the NAS COUNT shall be + * exchanged between the UE and the MME as part of the + * NAS signalling. After each new or retransmitted outbound + * security protected NAS message, the sender shall increase + * the NAS COUNT number by one. Specifically, on the sender + * side, the NAS sequence number shall be increased by one, + * and if the result is zero (due to wrap around), the NAS + * overflow counter shall also be incremented by one (see + * subclause 4.4.3.5). + */ + emm_security_context->dl_count.seq_num += 1; + + if ( ! emm_security_context->dl_count.seq_num) { + emm_security_context->dl_count.overflow += 1; + } + + LOG_TRACE(DEBUG, + "Incremented emm_security_context.dl_count.seq_num -> %u", + emm_security_context->dl_count.seq_num); +#else + emm_security_context->ul_count.seq_num += 1; + + if ( ! emm_security_context->ul_count.seq_num) { + emm_security_context->ul_count.overflow += 1; + } + + LOG_TRACE(DEBUG, + "Incremented emm_security_context.ul_count.seq_num -> %u", + emm_security_context->ul_count.seq_num); +#endif + + if (bytes < 0) { + LOG_FUNC_RETURN (bytes); + } + + if (size > 1) { + LOG_FUNC_RETURN (size + bytes); + } + + LOG_FUNC_RETURN (bytes); +} + +/**************************************************************************** + ** ** + ** Name: nas_message_decrypt() ** + ** ** + ** Description: Decripts security protected NAS message into plain NAS ** + ** message ** + ** ** + ** Inputs: inbuf: Input buffer containing security protected ** + ** NAS message ** + ** length: Number of bytes that should be decrypted ** + ** Others: None ** + ** ** + ** Outputs: outbuf: Output buffer containing plain NAS message ** + ** header: Security protected header applied ** + ** Return: The number of bytes in the output buffer ** + ** if the input buffer has been successfully ** + ** decrypted; Negative error code otherwise. ** + ** Others: None ** + ** ** + ***************************************************************************/ +int nas_message_decrypt( + const char *inbuf, + char *outbuf, + nas_message_security_header_t *header, + int length, + void *security) +{ + LOG_FUNC_IN; + + emm_security_context_t *emm_security_context = (emm_security_context_t*)security; + int bytes = length; + + /* Decode the header */ + int size = _nas_message_header_decode(inbuf, header, length); + + if (size < 0) { + LOG_TRACE(DEBUG, "MESSAGE TOO SHORT"); + LOG_FUNC_RETURN (TLV_DECODE_BUFFER_TOO_SHORT); + } else if (size > 1) { + if (emm_security_context) { +#if defined(NAS_MME) + + if (emm_security_context->ul_count.seq_num > header->sequence_number) { + emm_security_context->ul_count.overflow += 1; + } + + emm_security_context->ul_count.seq_num = header->sequence_number; +#else + + if (emm_security_context->dl_count.seq_num > header->sequence_number) { + emm_security_context->dl_count.overflow += 1; + } + + emm_security_context->dl_count.seq_num = header->sequence_number; +#endif + } + + /* Compute offset of the sequence number field */ + int offset = size - sizeof(UInt8_t); + /* Compute the NAS message authentication code */ + UInt32_t mac = _nas_message_get_mac( + inbuf + offset, + length - offset, +#ifdef NAS_MME + SECU_DIRECTION_UPLINK, +#else + SECU_DIRECTION_DOWNLINK, +#endif + emm_security_context); + + /* Check NAS message integrity */ + if (mac != header->message_authentication_code) { + + LOG_TRACE(DEBUG, + "MAC Failure MSG:%08X(%u) <> INT ALGO:%08X(%u) Type of security context %u", + header->message_authentication_code,header->message_authentication_code, + mac,mac, (emm_security_context!=NULL)?emm_security_context->type:88); +#if defined(NAS_MME) + LOG_FUNC_RETURN (TLV_DECODE_MAC_MISMATCH); +#else +#warning "added test on integrity algorithm because of SECURITY_MODE_COMMAND not correctly handled in UE (check integrity)" + + if (emm_security_context->selected_algorithms.integrity != + NAS_SECURITY_ALGORITHMS_EIA0) { + LOG_FUNC_RETURN (TLV_DECODE_MAC_MISMATCH); + } else { + LOG_TRACE(WARNING, + "MAC failure but continue due to EIA0 selected"); + } + +#endif + } else { + LOG_TRACE(DEBUG, "Integrity: MAC Success"); + } + + /* Decrypt the security protected NAS message */ + header->protocol_discriminator = + _nas_message_decrypt(outbuf, inbuf + size, + header->security_header_type, + header->message_authentication_code, + header->sequence_number, + length - size, + emm_security_context); + bytes = length - size; + } else { + LOG_TRACE(DEBUG, "Plain NAS message found"); + /* The input buffer contains a plain NAS message */ + memcpy(outbuf, inbuf, length); + } + + LOG_FUNC_RETURN (bytes); +} + +/**************************************************************************** + ** ** + ** Name: nas_message_decode() ** + ** ** + ** Description: Decode layer 3 NAS message ** + ** ** + ** Inputs: buffer: Pointer to the buffer containing layer 3 ** + ** NAS message data ** + ** length: Number of bytes that should be decoded ** + ** Others: None ** + ** ** + ** Outputs: msg: L3 NAS message structure to be filled ** + ** Return: The number of bytes in the buffer if the ** + ** data have been successfully decoded; ** + ** A negative error code otherwise. ** + ** Others: None ** + ** ** + ***************************************************************************/ +int nas_message_decode( + const char* const buffer, + nas_message_t *msg, + int length, + void *security) +{ + LOG_FUNC_IN; + emm_security_context_t *emm_security_context = (emm_security_context_t*)security; + int bytes; + + /* Decode the header */ + int size = _nas_message_header_decode(buffer, &msg->header, length); + + if (size < 0) { + LOG_FUNC_RETURN (TLV_DECODE_BUFFER_TOO_SHORT); + } else if (size > 1) { + if (emm_security_context) { +#if defined(NAS_MME) + + if (emm_security_context->ul_count.seq_num > msg->header.sequence_number) { + emm_security_context->ul_count.overflow += 1; + } + + emm_security_context->ul_count.seq_num = msg->header.sequence_number; + +#else + + if (emm_security_context->dl_count.seq_num > msg->header.sequence_number) { + emm_security_context->dl_count.overflow += 1; + } + + emm_security_context->dl_count.seq_num = msg->header.sequence_number; +#endif + } + + /* Compute offset of the sequence number field */ + int offset = size - sizeof(UInt8_t); + /* Compute the NAS message authentication code */ + UInt32_t mac = _nas_message_get_mac( + buffer + offset, + length - offset, +#ifdef NAS_MME + SECU_DIRECTION_UPLINK, +#else + SECU_DIRECTION_DOWNLINK, +#endif + emm_security_context + ); + +#define NAS_CODE_TO_BE_MODIFIED 1 +#ifdef NAS_CODE_TO_BE_MODIFIED + + // According to 3GPP TS 24.301 version 10.15.0 Release 10, 4.4.4.3 Integrity checking of NAS signalling messages in the MME + if ((!emm_security_context) && (mac == 0) && (msg->header.message_authentication_code != 0)) { + // force mac to be the same, but we should check for message types. + // TODO Reverse order of processing in NAS code: decode message type then check MAC + LOG_TRACE(DEBUG, + "Forced computed MAC to be the MSG MAC %04x", + msg->header.message_authentication_code); + mac = msg->header.message_authentication_code; + LOG_TRACE(DEBUG, + "Forced computed MAC to be the same as MAC in message %04x", + msg->header.message_authentication_code); + } + +#endif + + /* Check NAS message integrity */ + if (mac != msg->header.message_authentication_code) { + LOG_TRACE(DEBUG, + "msg->header.message_authentication_code = %04X computed = %04X", + msg->header.message_authentication_code, + mac); + LOG_FUNC_RETURN (TLV_DECODE_MAC_MISMATCH); + } + +#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE))) + /* Log message header */ +#endif + + /* Decode security protected NAS message */ + bytes = _nas_message_protected_decode(buffer + size, + &msg->header, + &msg->plain, + length - size, + emm_security_context); + } else { + /* Decode plain NAS message */ + bytes = _nas_message_plain_decode(buffer, + &msg->header, + &msg->plain, + length); + } + + if (bytes < 0) { + LOG_FUNC_RETURN (bytes); + } + + if (size > 1) { + LOG_FUNC_RETURN (size + bytes); + } + + LOG_FUNC_RETURN (bytes); +} + +/**************************************************************************** + ** ** + ** Name: nas_message_encode() ** + ** ** + ** Description: Encode layer 3 NAS message ** + ** ** + ** Inputs msg: L3 NAS 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 the ** + ** data have been successfully encoded; ** + ** A negative error code otherwise. ** + ** Others: None ** + ** ** + ***************************************************************************/ +int nas_message_encode( + char *buffer, + const nas_message_t *const msg, + int length, + void *security) +{ + LOG_FUNC_IN; + + emm_security_context_t *emm_security_context = (emm_security_context_t*)security; + int bytes; + + + /* Encode the header */ + int size = _nas_message_header_encode(buffer, &msg->header, length); + + if (size < 0) { + LOG_FUNC_RETURN (TLV_ENCODE_BUFFER_TOO_SHORT); + } else if (size > 1) { + /* Encode security protected NAS message */ + bytes = _nas_message_protected_encode( + buffer + size, + &msg->security_protected, + length - size, + emm_security_context); + + /* Integrity protect the NAS message */ + if (bytes > 0) { + /* Compute offset of the sequence number field */ + int offset = size - sizeof(UInt8_t); + /* Compute the NAS message authentication code */ + LOG_TRACE(DEBUG, + "offset %d = %d - %d, hdr encode = %d, length = %d bytes = %d", + offset, size, sizeof(UInt8_t), + size, length, bytes); + UInt32_t mac = _nas_message_get_mac( + buffer + offset, + bytes + size - offset, +#ifdef NAS_MME + SECU_DIRECTION_DOWNLINK, +#else + SECU_DIRECTION_UPLINK, +#endif + emm_security_context); + /* Set the message authentication code of the NAS message */ + *(UInt32_t*)(buffer + sizeof(UInt8_t)) = htonl(mac); + + if (emm_security_context) { +#ifdef NAS_MME + /* TS 124.301, section 4.4.3.1 + * The NAS sequence number part of the NAS COUNT shall be + * exchanged between the UE and the MME as part of the + * NAS signalling. After each new or retransmitted outbound + * security protected NAS message, the sender shall increase + * the NAS COUNT number by one. Specifically, on the sender + * side, the NAS sequence number shall be increased by one, + * and if the result is zero (due to wrap around), the NAS + * overflow counter shall also be incremented by one (see + * subclause 4.4.3.5). + */ + + emm_security_context->dl_count.seq_num += 1; + + if ( ! emm_security_context->dl_count.seq_num) { + emm_security_context->dl_count.overflow += 1; + } + + LOG_TRACE(DEBUG, + "Incremented emm_security_context.dl_count.seq_num -> %u", + emm_security_context->dl_count.seq_num); +#else + emm_security_context->ul_count.seq_num += 1; + + if ( ! emm_security_context->ul_count.seq_num) { + emm_security_context->ul_count.overflow += 1; + } + + LOG_TRACE(DEBUG, + "Incremented emm_security_context.ul_count.seq_num -> %u", + emm_security_context->ul_count.seq_num); +#endif + } else { + LOG_TRACE(DEBUG, + "Did not increment emm_security_context.dl_count.seq_num because no security context"); + } + } + +#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE))) + /* Log message header */ +#endif + } else { + /* Encode plain NAS message */ + bytes = _nas_message_plain_encode(buffer, &msg->header, + &msg->plain, length); + } + + if (bytes < 0) { + LOG_FUNC_RETURN (bytes); + } + + if (size > 1) { + LOG_FUNC_RETURN (size + bytes); + } + + LOG_FUNC_RETURN (bytes); +} + +/****************************************************************************/ +/********************* L O C A L F U N C T I O N S *********************/ +/****************************************************************************/ + +/* + * ----------------------------------------------------------------------------- + * Functions used to decode layer 3 NAS messages + * ----------------------------------------------------------------------------- + */ + +/**************************************************************************** + ** ** + ** Name: _nas_message_header_decode() ** + ** ** + ** Description: Decode header of a security protected NAS message ** + ** ** + ** Inputs: buffer: Pointer to the buffer containing layer 3 ** + ** message data ** + ** length: Number of bytes that should be decoded ** + ** Others: None ** + ** ** + ** Outputs: header: Security header structure to be filled ** + ** Return: The size in bytes of the security header ** + ** if data have been successfully decoded; ** + ** 1, if the header is not a security header ** + ** (header of plain NAS message); ** + ** -1 otherwise. ** + ** Others: None ** + ** ** + ***************************************************************************/ +static int +_nas_message_header_decode( + const char *buffer, + nas_message_security_header_t *header, + int length) +{ + LOG_FUNC_IN; + + int size = 0; + + /* Decode the first octet of the header (security header type or EPS bearer + * identity, and protocol discriminator) */ + DECODE_U8(buffer, *(UInt8_t*)(header), size); + + if (header->protocol_discriminator == EPS_MOBILITY_MANAGEMENT_MESSAGE) { + if (header->security_header_type != SECURITY_HEADER_TYPE_NOT_PROTECTED) { + if (length < NAS_MESSAGE_SECURITY_HEADER_SIZE) { + /* The buffer is not big enough to contain security header */ + LOG_TRACE(WARNING, "NET-API - The size of the header (%u) " + "exceeds the buffer length (%u)", + NAS_MESSAGE_SECURITY_HEADER_SIZE, length); + LOG_FUNC_RETURN (-1); + } + + /* Decode the message authentication code */ + DECODE_U32(buffer+size, header->message_authentication_code, size); + /* Decode the sequence number */ + DECODE_U8(buffer+size, header->sequence_number, size); + } + } + + LOG_FUNC_RETURN (size); +} + +/**************************************************************************** + ** ** + ** Name: _nas_message_plain_decode() ** + ** ** + ** Description: Decode plain NAS message ** + ** ** + ** Inputs: buffer: Pointer to the buffer containing plain NAS ** + ** message data ** + ** header: Header of the plain NAS message ** + ** length: Number of bytes that should be decoded ** + ** Others: None ** + ** ** + ** Outputs: msg: Decoded NAS message ** + ** Return: The number of bytes in the buffer if the ** + ** data have been successfully decoded; ** + ** A negative error code otherwise. ** + ** Others: None ** + ** ** + ***************************************************************************/ +static int +_nas_message_plain_decode( + const char *buffer, + const nas_message_security_header_t *header, + nas_message_plain_t *msg, + int length) +{ + LOG_FUNC_IN; + + int bytes = TLV_DECODE_PROTOCOL_NOT_SUPPORTED; + + if (header->protocol_discriminator == EPS_MOBILITY_MANAGEMENT_MESSAGE) { + /* Decode EPS Mobility Management L3 message */ + bytes = emm_msg_decode(&msg->emm, (uint8_t *)buffer, length); + } else if (header->protocol_discriminator == EPS_SESSION_MANAGEMENT_MESSAGE) { + /* Decode EPS Session Management L3 message */ + bytes = esm_msg_decode(&msg->esm, (uint8_t *)buffer, length); + } else { + /* Discard L3 messages with not supported protocol discriminator */ + LOG_TRACE(WARNING,"NET-API - Protocol discriminator 0x%x is " + "not supported", header->protocol_discriminator); + } + + LOG_FUNC_RETURN (bytes); +} + +/**************************************************************************** + ** ** + ** Name: _nas_message_protected_decode() ** + ** ** + ** Description: Decode security protected NAS message ** + ** ** + ** Inputs: buffer: Pointer to the buffer containing the secu- ** + ** rity protected NAS message data ** + ** header: Header of the security protected NAS message ** + ** length: Number of bytes that should be decoded ** + ** emm_security_context: security context ** + ** Others: None ** + ** ** + ** Outputs: msg: Decoded NAS message ** + ** Return: The number of bytes in the buffer if the ** + ** data have been successfully decoded; ** + ** A negative error code otherwise. ** + ** Others: None ** + ** ** + ***************************************************************************/ +static int _nas_message_protected_decode( + const char *buffer, + nas_message_security_header_t *header, + nas_message_plain_t *msg, + int length, + const emm_security_context_t * const emm_security_context) +{ + LOG_FUNC_IN; + + int bytes = TLV_DECODE_BUFFER_TOO_SHORT; + + char* plain_msg = (char*)calloc(1,length); + + if (plain_msg) { + /* Decrypt the security protected NAS message */ + header->protocol_discriminator = + _nas_message_decrypt(plain_msg, + buffer, + header->security_header_type, + header->message_authentication_code, + header->sequence_number, + length, + emm_security_context); + /* Decode the decrypted message as plain NAS message */ + bytes = _nas_message_plain_decode(plain_msg, header, msg, length); + free(plain_msg); + } + + LOG_FUNC_RETURN (bytes); +} + +/* + * ----------------------------------------------------------------------------- + * Functions used to encode layer 3 NAS messages + * ----------------------------------------------------------------------------- + */ + +/**************************************************************************** + ** ** + ** Name: _nas_message_header_encode() ** + ** ** + ** Description: Encode header of a security protected NAS message ** + ** ** + ** Inputs header: Security header 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 the ** + ** data have been successfully encoded; ** + ** 1, if the header is not a security header ** + ** (header of plain NAS message); ** + ** -1 otherwise. ** + ** Others: None ** + ** ** + ***************************************************************************/ +static int _nas_message_header_encode( + char *buffer, + const nas_message_security_header_t *header, + int length) +{ + LOG_FUNC_IN; + + int size = 0; + + /* Encode the first octet of the header (security header type or EPS bearer + * identity, and protocol discriminator) */ + ENCODE_U8(buffer, *(UInt8_t*)(header), size); + + if (header->protocol_discriminator == EPS_MOBILITY_MANAGEMENT_MESSAGE) { + if (header->security_header_type != SECURITY_HEADER_TYPE_NOT_PROTECTED) { + //static uint8_t seq = 0; + if (length < NAS_MESSAGE_SECURITY_HEADER_SIZE) { + /* The buffer is not big enough to contain security header */ + LOG_TRACE(WARNING, "NET-API - The size of the header (%u) " + "exceeds the buffer length (%u)", + NAS_MESSAGE_SECURITY_HEADER_SIZE, length); + LOG_FUNC_RETURN (-1); + } + + /* Encode the message authentication code */ + ENCODE_U32(buffer+size, header->message_authentication_code, size); + /* Encode the sequence number */ + ENCODE_U8(buffer+size, header->sequence_number, size); + //ENCODE_U8(buffer+size, seq, size); + //seq++; + } + } + + LOG_FUNC_RETURN (size); +} + +/**************************************************************************** + ** ** + ** Name: _nas_message_plain_encode() ** + ** ** + ** Description: Encode plain NAS message ** + ** ** + ** Inputs: pd: Protocol discriminator of the NAS message ** + ** to encode ** + ** msg: Plain NAS 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 the ** + ** data have been successfully encoded; ** + ** A negative error code otherwise. ** + ** Others: None ** + ** ** + ***************************************************************************/ +static int _nas_message_plain_encode( + char *buffer, + const nas_message_security_header_t *header, + const nas_message_plain_t *msg, + int length) +{ + LOG_FUNC_IN; + + int bytes = TLV_ENCODE_PROTOCOL_NOT_SUPPORTED; + + if (header->protocol_discriminator == EPS_MOBILITY_MANAGEMENT_MESSAGE) { + /* Encode EPS Mobility Management L3 message */ + bytes = emm_msg_encode((EMM_msg*)(&msg->emm), (uint8_t*)buffer, length); + } else if (header->protocol_discriminator == EPS_SESSION_MANAGEMENT_MESSAGE) { + /* Encode EPS Session Management L3 message */ + bytes = esm_msg_encode((ESM_msg*)(&msg->esm), (uint8_t*)buffer, length); + } else { + /* Discard L3 messages with not supported protocol discriminator */ + LOG_TRACE(WARNING,"NET-API - Protocol discriminator 0x%x is " + "not supported", header->protocol_discriminator); + } + + LOG_FUNC_RETURN (bytes); +} + +/**************************************************************************** + ** ** + ** Name: _nas_message_protected_encode() ** + ** ** + ** Description: Encode security protected NAS message ** + ** ** + ** Inputs msg: Security protected NAS 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 the ** + ** data have been successfully encoded; ** + ** A negative error code otherwise. ** + ** Others: None ** + ** ** + ***************************************************************************/ +static int _nas_message_protected_encode( + char *buffer, + const nas_message_security_protected_t *msg, + int length, + void *security) +{ + LOG_FUNC_IN; + + emm_security_context_t *emm_security_context = (emm_security_context_t*)security; + int bytes = TLV_ENCODE_BUFFER_TOO_SHORT; + + char* plain_msg = (char*)calloc(1,length); + + if (plain_msg) { + /* Encode the security protected NAS message as plain NAS message */ + int size = _nas_message_plain_encode(plain_msg, &msg->header, + &msg->plain, length); + + if (size > 0) { + //static uint8_t seq = 0; + /* Encrypt the encoded plain NAS message */ + bytes = _nas_message_encrypt(buffer, + plain_msg, + msg->header.security_header_type, + msg->header.message_authentication_code, + msg->header.sequence_number, +#ifdef NAS_MME + SECU_DIRECTION_DOWNLINK, +#else + SECU_DIRECTION_UPLINK, +#endif + size, + emm_security_context); + //seq, size); + //seq ++; + } + + free(plain_msg); + } + + LOG_FUNC_RETURN (bytes); +} + +/* + * ----------------------------------------------------------------------------- + * Functions used to decrypt and encrypt layer 3 NAS messages + * ----------------------------------------------------------------------------- + */ + +/**************************************************************************** + ** ** + ** Name: _nas_message_decrypt() ** + ** ** + ** Description: Decrypt security protected NAS message ** + ** ** + ** Inputs src: Pointer to the encrypted data buffer ** + ** security_header_type: The security header type ** + ** code: The message authentication code ** + ** seq: The sequence number ** + ** length: Maximal capacity of the output buffer ** + ** Others: None ** + ** ** + ** Outputs: dest: Pointer to the decrypted data buffer ** + ** Return: The protocol discriminator of the message ** + ** that has been decrypted; ** + ** Others: None ** + ** ** + ***************************************************************************/ +static int _nas_message_decrypt( + char *dest, + const char *src, + UInt8_t security_header_type, + UInt32_t code, + UInt8_t seq, + int length, + const emm_security_context_t * const emm_security_context) +{ + nas_stream_cipher_t stream_cipher; + uint32_t count; + uint8_t direction; + + LOG_FUNC_IN; + + int size = 0; + nas_message_security_header_t header; + +#ifdef NAS_MME + direction = SECU_DIRECTION_UPLINK; +#else + direction = SECU_DIRECTION_DOWNLINK; +#endif + + switch (security_header_type) { + case SECURITY_HEADER_TYPE_NOT_PROTECTED: + case SECURITY_HEADER_TYPE_SERVICE_REQUEST: + case SECURITY_HEADER_TYPE_INTEGRITY_PROTECTED: + case SECURITY_HEADER_TYPE_INTEGRITY_PROTECTED_NEW: + LOG_TRACE(DEBUG, + "No decryption of message length %u according to security header type 0x%02x", + length, security_header_type); + memcpy(dest, src, length); + DECODE_U8(dest, *(UInt8_t*)(&header), size); + LOG_FUNC_RETURN (header.protocol_discriminator); + //LOG_FUNC_RETURN (length); + break; + + case SECURITY_HEADER_TYPE_INTEGRITY_PROTECTED_CYPHERED: + case SECURITY_HEADER_TYPE_INTEGRITY_PROTECTED_CYPHERED_NEW: + switch (emm_security_context->selected_algorithms.encryption) { + + case NAS_SECURITY_ALGORITHMS_EEA1: { + if (direction == SECU_DIRECTION_UPLINK) { + count = 0x00000000 || + ((emm_security_context->ul_count.overflow && 0x0000FFFF) << 8) || + (emm_security_context->ul_count.seq_num & 0x000000FF); + } else { + count = 0x00000000 || + ((emm_security_context->dl_count.overflow && 0x0000FFFF) << 8) || + (emm_security_context->dl_count.seq_num & 0x000000FF); + } + + LOG_TRACE(DEBUG, + "NAS_SECURITY_ALGORITHMS_EEA1 dir %s count.seq_num %u count %u", + (direction == SECU_DIRECTION_UPLINK) ? "UPLINK":"DOWNLINK", + (direction == SECU_DIRECTION_UPLINK) ? emm_security_context->ul_count.seq_num:emm_security_context->dl_count.seq_num, + count); + stream_cipher.key = emm_security_context->knas_enc.value; + stream_cipher.key_length = AUTH_KNAS_ENC_SIZE; + stream_cipher.count = count; + stream_cipher.bearer = 0x00; //33.401 section 8.1.1 + stream_cipher.direction = direction; + stream_cipher.message = src; + /* length in bits */ + stream_cipher.blength = length << 3; + nas_stream_encrypt_eea1(&stream_cipher, dest); + /* Decode the first octet (security header type or EPS bearer identity, + * and protocol discriminator) */ + DECODE_U8(dest, *(UInt8_t*)(&header), size); + + LOG_FUNC_RETURN (header.protocol_discriminator); + + } + break; + + case NAS_SECURITY_ALGORITHMS_EEA2: { + if (direction == SECU_DIRECTION_UPLINK) { + count = 0x00000000 || + ((emm_security_context->ul_count.overflow && 0x0000FFFF) << 8) || + (emm_security_context->ul_count.seq_num & 0x000000FF); + } else { + count = 0x00000000 || + ((emm_security_context->dl_count.overflow && 0x0000FFFF) << 8) || + (emm_security_context->dl_count.seq_num & 0x000000FF); + } + + LOG_TRACE(DEBUG, + "NAS_SECURITY_ALGORITHMS_EEA2 dir %s count.seq_num %u count %u", + (direction == SECU_DIRECTION_UPLINK) ? "UPLINK":"DOWNLINK", + (direction == SECU_DIRECTION_UPLINK) ? emm_security_context->ul_count.seq_num:emm_security_context->dl_count.seq_num, + count); + stream_cipher.key = emm_security_context->knas_enc.value; + stream_cipher.key_length = AUTH_KNAS_ENC_SIZE; + stream_cipher.count = count; + stream_cipher.bearer = 0x00; //33.401 section 8.1.1 + stream_cipher.direction = direction; + stream_cipher.message = src; + /* length in bits */ + stream_cipher.blength = length << 3; + nas_stream_encrypt_eea1(&stream_cipher, dest); + /* Decode the first octet (security header type or EPS bearer identity, + * and protocol discriminator) */ + DECODE_U8(dest, *(UInt8_t*)(&header), size); + + LOG_FUNC_RETURN (header.protocol_discriminator); + } + break; + + case NAS_SECURITY_ALGORITHMS_EEA0: + LOG_TRACE(DEBUG, + "NAS_SECURITY_ALGORITHMS_EEA0 dir %d ul_count.seq_num %d dl_count.seq_num %d", + direction, + emm_security_context->ul_count.seq_num, + emm_security_context->dl_count.seq_num); + memcpy(dest, src, length); + /* Decode the first octet (security header type or EPS bearer identity, + * and protocol discriminator) */ + DECODE_U8(dest, *(UInt8_t*)(&header), size); + + LOG_FUNC_RETURN (header.protocol_discriminator); + + break; + + default: + LOG_TRACE(ERROR, + "Unknown Cyphering protection algorithm %d", + emm_security_context->selected_algorithms.encryption); + memcpy(dest, src, length); + /* Decode the first octet (security header type or EPS bearer identity, + * and protocol discriminator) */ + DECODE_U8(dest, *(UInt8_t*)(&header), size); + + LOG_FUNC_RETURN (header.protocol_discriminator); + break; + } + + break; + + default: + LOG_TRACE(ERROR, + "Unknown security header type %u", security_header_type); + LOG_FUNC_RETURN (0); + }; + +} + +/**************************************************************************** + ** ** + ** Name: _nas_message_encrypt() ** + ** ** + ** Description: Encrypt plain NAS message ** + ** ** + ** Inputs src: Pointer to the decrypted data buffer ** + ** security_header_type: The security header type ** + ** code: The message authentication code ** + ** seq: The sequence number ** + ** direction: The sequence number ** + ** length: Maximal capacity of the output buffer ** + ** Others: None ** + ** ** + ** Outputs: dest: Pointer to the encrypted data buffer ** + ** Return: The number of bytes in the output buffer ** + ** if data have been successfully encrypted; ** + ** RETURNerror otherwise. ** + ** Others: None ** + ** ** + ***************************************************************************/ +static int _nas_message_encrypt( + char *dest, + const char *src, + UInt8_t security_header_type, + UInt32_t code, + UInt8_t seq, + int const direction, + int length, + const emm_security_context_t * const emm_security_context) +{ + nas_stream_cipher_t stream_cipher; + uint32_t count; + LOG_FUNC_IN; + + if (!emm_security_context) { + LOG_TRACE(ERROR, + "No security context set for encryption protection algorithm"); + LOG_FUNC_RETURN (0); + } + + switch (security_header_type) { + case SECURITY_HEADER_TYPE_NOT_PROTECTED: + case SECURITY_HEADER_TYPE_SERVICE_REQUEST: + case SECURITY_HEADER_TYPE_INTEGRITY_PROTECTED: + case SECURITY_HEADER_TYPE_INTEGRITY_PROTECTED_NEW: + LOG_TRACE(DEBUG, + "No encryption of message according to security header type 0x%02x", + security_header_type); + memcpy(dest, src, length); + LOG_FUNC_RETURN (length); + break; + + case SECURITY_HEADER_TYPE_INTEGRITY_PROTECTED_CYPHERED: + case SECURITY_HEADER_TYPE_INTEGRITY_PROTECTED_CYPHERED_NEW: + switch (emm_security_context->selected_algorithms.encryption) { + + case NAS_SECURITY_ALGORITHMS_EEA1: { + if (direction == SECU_DIRECTION_UPLINK) { + count = 0x00000000 || + ((emm_security_context->ul_count.overflow && 0x0000FFFF) << 8) || + (emm_security_context->ul_count.seq_num & 0x000000FF); + } else { + count = 0x00000000 || + ((emm_security_context->dl_count.overflow && 0x0000FFFF) << 8) || + (emm_security_context->dl_count.seq_num & 0x000000FF); + } + + LOG_TRACE(DEBUG, + "NAS_SECURITY_ALGORITHMS_EEA1 dir %s count.seq_num %u count %u", + (direction == SECU_DIRECTION_UPLINK) ? "UPLINK":"DOWNLINK", + (direction == SECU_DIRECTION_UPLINK) ? emm_security_context->ul_count.seq_num:emm_security_context->dl_count.seq_num, + count); + stream_cipher.key = emm_security_context->knas_enc.value; + stream_cipher.key_length = AUTH_KNAS_ENC_SIZE; + stream_cipher.count = count; + stream_cipher.bearer = 0x00; //33.401 section 8.1.1 + stream_cipher.direction = direction; + stream_cipher.message = src; + /* length in bits */ + stream_cipher.blength = length << 3; + nas_stream_encrypt_eea1(&stream_cipher, dest); + + LOG_FUNC_RETURN (length); + + } + break; + + case NAS_SECURITY_ALGORITHMS_EEA2: { + if (direction == SECU_DIRECTION_UPLINK) { + count = 0x00000000 || + ((emm_security_context->ul_count.overflow && 0x0000FFFF) << 8) || + (emm_security_context->ul_count.seq_num & 0x000000FF); + } else { + count = 0x00000000 || + ((emm_security_context->dl_count.overflow && 0x0000FFFF) << 8) || + (emm_security_context->dl_count.seq_num & 0x000000FF); + } + + LOG_TRACE(DEBUG, + "NAS_SECURITY_ALGORITHMS_EEA2 dir %s count.seq_num %u count %u", + (direction == SECU_DIRECTION_UPLINK) ? "UPLINK":"DOWNLINK", + (direction == SECU_DIRECTION_UPLINK) ? emm_security_context->ul_count.seq_num:emm_security_context->dl_count.seq_num, + count); + stream_cipher.key = emm_security_context->knas_enc.value; + stream_cipher.key_length = AUTH_KNAS_ENC_SIZE; + stream_cipher.count = count; + stream_cipher.bearer = 0x00; //33.401 section 8.1.1 + stream_cipher.direction = direction; + stream_cipher.message = src; + /* length in bits */ + stream_cipher.blength = length << 3; + nas_stream_encrypt_eea2(&stream_cipher, dest); + + LOG_FUNC_RETURN (length); + + } + break; + + case NAS_SECURITY_ALGORITHMS_EEA0: + LOG_TRACE(DEBUG, + "NAS_SECURITY_ALGORITHMS_EEA0 dir %d ul_count.seq_num %d dl_count.seq_num %d", + direction, + emm_security_context->ul_count.seq_num, + emm_security_context->dl_count.seq_num); + memcpy(dest, src, length); + LOG_FUNC_RETURN (length); + + break; + + default: + LOG_TRACE(ERROR, + "Unknown Cyphering protection algorithm %d", + emm_security_context->selected_algorithms.encryption); + break; + } + + break; + + default: + LOG_TRACE(ERROR, + "Unknown security header type %u", security_header_type); + LOG_FUNC_RETURN (0); + } + + LOG_FUNC_RETURN (length); +} + +/* + * ----------------------------------------------------------------------------- + * Functions used for integrity protection of layer 3 NAS messages + * ----------------------------------------------------------------------------- + */ + +/**************************************************************************** + ** ** + ** Name: _nas_message_get_mac() ** + ** ** + ** Description: Run integrity algorithm onto cyphered or uncyphered NAS ** + ** message encoded in the input buffer and return the compu- ** + ** ted message authentication code ** + ** ** + ** Inputs buffer: Pointer to the integrity protected data ** + ** buffer ** + ** count: Value of the uplink NAS counter ** + ** length: Length of the input buffer ** + ** direction ** + ** Others: None ** + ** ** + ** Outputs: None ** + ** Return: The message authentication code ** + ** Others: None ** + ** ** + ***************************************************************************/ +static UInt32_t _nas_message_get_mac( + const char * const buffer, + int const length, + int const direction, + const emm_security_context_t * const emm_security_context) +{ + + LOG_FUNC_IN; + + if (!emm_security_context) { + LOG_TRACE(DEBUG, + "No security context set for integrity protection algorithm"); +#if defined(NAS_BUILT_IN_EPC) || defined(NAS_BUILT_IN_UE) + LOG_FUNC_RETURN (0); +#else + LOG_FUNC_RETURN (0xabababab); +#endif + } + + switch (emm_security_context->selected_algorithms.integrity) { + + case NAS_SECURITY_ALGORITHMS_EIA1: { + UInt8_t mac[4]; + nas_stream_cipher_t stream_cipher; + UInt32_t count; + UInt32_t *mac32; + + int i,bytes = 0; + + if (direction == SECU_DIRECTION_UPLINK) { + count = 0x00000000 || + ((emm_security_context->ul_count.overflow && 0x0000FFFF) << 8) || + (emm_security_context->ul_count.seq_num & 0x000000FF); + } else { + count = 0x00000000 || + ((emm_security_context->dl_count.overflow && 0x0000FFFF) << 8) || + (emm_security_context->dl_count.seq_num & 0x000000FF); + } + + LOG_TRACE(DEBUG, + "NAS_SECURITY_ALGORITHMS_EIA1 dir %s count.seq_num %u count %u", + (direction == SECU_DIRECTION_UPLINK) ? "UPLINK":"DOWNLINK", + (direction == SECU_DIRECTION_UPLINK) ? emm_security_context->ul_count.seq_num:emm_security_context->dl_count.seq_num, + count); + + fprintf(stderr, "\n[NAS]\t"); + + for (i=0; i < length; i++) { + fprintf(stderr, "%.2hx ", (const unsigned char) buffer[i]); + + /* Add new line when the number of displayed bytes exceeds + * the line's size */ + if ( ++bytes > (16 - 1) ) { + bytes = 0; + fprintf(stderr, "\n[NAS]\t"); + } + } + + if (bytes % 16) { + fprintf(stderr, "\n"); + } + + fprintf(stderr, "\n"); + fflush(stderr); + + stream_cipher.key = emm_security_context->knas_int.value; + stream_cipher.key_length = AUTH_KNAS_INT_SIZE; + stream_cipher.count = count; + stream_cipher.bearer = 0x00; //33.401 section 8.1.1 + stream_cipher.direction = direction; + stream_cipher.message = buffer; + /* length in bits */ + stream_cipher.blength = length << 3; + + nas_stream_encrypt_eia1( + &stream_cipher, + mac); + LOG_TRACE(DEBUG, + "NAS_SECURITY_ALGORITHMS_EIA1 returned MAC %x.%x.%x.%x(%u) for length %d direction %d, count %d", + mac[0], mac[1], mac[2],mac[3], + *((UInt32_t*)&mac), + length, + direction, + count); + mac32 = (UInt32_t*)&mac; + LOG_FUNC_RETURN (ntohl(*mac32)); + } + break; + + case NAS_SECURITY_ALGORITHMS_EIA2: { + UInt8_t mac[4]; + nas_stream_cipher_t stream_cipher; + UInt32_t count; + UInt32_t *mac32; + + if (direction == SECU_DIRECTION_UPLINK) { + count = 0x00000000 || + ((emm_security_context->ul_count.overflow && 0x0000FFFF) << 8) || + (emm_security_context->ul_count.seq_num & 0x000000FF); + } else { + count = 0x00000000 || + ((emm_security_context->dl_count.overflow && 0x0000FFFF) << 8) || + (emm_security_context->dl_count.seq_num & 0x000000FF); + } + + LOG_TRACE(DEBUG, + "NAS_SECURITY_ALGORITHMS_EIA2 dir %s count.seq_num %u count %u", + (direction == SECU_DIRECTION_UPLINK) ? "UPLINK":"DOWNLINK", + (direction == SECU_DIRECTION_UPLINK) ? emm_security_context->ul_count.seq_num:emm_security_context->dl_count.seq_num, + count); + + stream_cipher.key = emm_security_context->knas_int.value; + stream_cipher.key_length = AUTH_KNAS_INT_SIZE; + stream_cipher.count = count; + stream_cipher.bearer = 0x00; //33.401 section 8.1.1 + stream_cipher.direction = direction; + stream_cipher.message = buffer; + /* length in bits */ + stream_cipher.blength = length << 3; + + nas_stream_encrypt_eia2( + &stream_cipher, + mac); + LOG_TRACE(DEBUG, + "NAS_SECURITY_ALGORITHMS_EIA2 returned MAC %x.%x.%x.%x(%u) for length %d direction %d, count %d", + mac[0], mac[1], mac[2],mac[3], + *((UInt32_t*)&mac), + length, + direction, + count); + mac32 = (UInt32_t*)&mac; + LOG_FUNC_RETURN (ntohl(*mac32)); + } + break; + + case NAS_SECURITY_ALGORITHMS_EIA0: + LOG_TRACE(DEBUG, + "NAS_SECURITY_ALGORITHMS_EIA0 dir %s count.seq_num %u", + (direction == SECU_DIRECTION_UPLINK) ? "UPLINK":"DOWNLINK", + (direction == SECU_DIRECTION_UPLINK) ? emm_security_context->ul_count.seq_num:emm_security_context->dl_count.seq_num + ); + +#if defined(NAS_BUILT_IN_EPC) || defined(NAS_BUILT_IN_UE) + LOG_FUNC_RETURN (0); +#else + LOG_FUNC_RETURN (0xabababab); +#endif + break; + + default: + LOG_TRACE(ERROR, + "Unknown integrity protection algorithm %d", + emm_security_context->selected_algorithms.integrity); + break; + } + + LOG_FUNC_RETURN (0); +} + + diff --git a/openair-cn/NAS/COMMON/API/NETWORK/nas_message.h b/openair-cn/NAS/COMMON/API/NETWORK/nas_message.h new file mode 100644 index 0000000000..d7d09f1145 --- /dev/null +++ b/openair-cn/NAS/COMMON/API/NETWORK/nas_message.h @@ -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 . + + 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__*/ diff --git a/openair-cn/NAS/COMMON/API/NETWORK/network_api.c b/openair-cn/NAS/COMMON/API/NETWORK/network_api.c new file mode 100644 index 0000000000..61814c3e11 --- /dev/null +++ b/openair-cn/NAS/COMMON/API/NETWORK/network_api.c @@ -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 . + + 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 // strerror, memset +#include // gai_strerror +#include // errno +#include // 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 *********************/ +/****************************************************************************/ + diff --git a/openair-cn/NAS/COMMON/API/NETWORK/network_api.h b/openair-cn/NAS/COMMON/API/NETWORK/network_api.h new file mode 100644 index 0000000000..f9b04371fe --- /dev/null +++ b/openair-cn/NAS/COMMON/API/NETWORK/network_api.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 . + + 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__*/ diff --git a/openair-cn/NAS/COMMON/COPYING b/openair-cn/NAS/COMMON/COPYING new file mode 100644 index 0000000000..94a9ed024d --- /dev/null +++ b/openair-cn/NAS/COMMON/COPYING @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/openair-cn/NAS/COMMON/EMM/MSG/AttachAccept.c b/openair-cn/NAS/COMMON/EMM/MSG/AttachAccept.c new file mode 100644 index 0000000000..62eab5acb9 --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/AttachAccept.c @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#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); +} + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/AttachAccept.h b/openair-cn/NAS/COMMON/EMM/MSG/AttachAccept.h new file mode 100644 index 0000000000..2c1fc64bae --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/AttachAccept.h @@ -0,0 +1,138 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#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_) */ + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/AttachComplete.c b/openair-cn/NAS/COMMON/EMM/MSG/AttachComplete.c new file mode 100644 index 0000000000..386694eadf --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/AttachComplete.c @@ -0,0 +1,73 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#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; +} + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/AttachComplete.h b/openair-cn/NAS/COMMON/EMM/MSG/AttachComplete.h new file mode 100644 index 0000000000..6856d9fd32 --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/AttachComplete.h @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "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_) */ + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/AttachReject.c b/openair-cn/NAS/COMMON/EMM/MSG/AttachReject.c new file mode 100644 index 0000000000..16621cf25e --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/AttachReject.c @@ -0,0 +1,111 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#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; +} + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/AttachReject.h b/openair-cn/NAS/COMMON/EMM/MSG/AttachReject.h new file mode 100644 index 0000000000..3d12b7fdad --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/AttachReject.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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "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_) */ + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/AttachRequest.c b/openair-cn/NAS/COMMON/EMM/MSG/AttachRequest.c new file mode 100644 index 0000000000..15a29b1f29 --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/AttachRequest.c @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + +#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; +} + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/AttachRequest.h b/openair-cn/NAS/COMMON/EMM/MSG/AttachRequest.h new file mode 100644 index 0000000000..5368df7fc7 --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/AttachRequest.h @@ -0,0 +1,157 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#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_) */ + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/AuthenticationFailure.c b/openair-cn/NAS/COMMON/EMM/MSG/AuthenticationFailure.c new file mode 100644 index 0000000000..979ade2f24 --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/AuthenticationFailure.c @@ -0,0 +1,111 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#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; +} + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/AuthenticationFailure.h b/openair-cn/NAS/COMMON/EMM/MSG/AuthenticationFailure.h new file mode 100644 index 0000000000..8c9b66dd32 --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/AuthenticationFailure.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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "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_) */ + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/AuthenticationReject.c b/openair-cn/NAS/COMMON/EMM/MSG/AuthenticationReject.c new file mode 100644 index 0000000000..1d486e070b --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/AuthenticationReject.c @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#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; +} + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/AuthenticationReject.h b/openair-cn/NAS/COMMON/EMM/MSG/AuthenticationReject.h new file mode 100644 index 0000000000..85111297ee --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/AuthenticationReject.h @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "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_) */ + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/AuthenticationRequest.c b/openair-cn/NAS/COMMON/EMM/MSG/AuthenticationRequest.c new file mode 100644 index 0000000000..e6f10c9ef6 --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/AuthenticationRequest.c @@ -0,0 +1,93 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#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; +} + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/AuthenticationRequest.h b/openair-cn/NAS/COMMON/EMM/MSG/AuthenticationRequest.h new file mode 100644 index 0000000000..1bfe9f1719 --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/AuthenticationRequest.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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "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_) */ + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/AuthenticationResponse.c b/openair-cn/NAS/COMMON/EMM/MSG/AuthenticationResponse.c new file mode 100644 index 0000000000..775932e18f --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/AuthenticationResponse.c @@ -0,0 +1,73 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#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; +} + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/AuthenticationResponse.h b/openair-cn/NAS/COMMON/EMM/MSG/AuthenticationResponse.h new file mode 100644 index 0000000000..2e93301ee7 --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/AuthenticationResponse.h @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "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_) */ + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/COPYING b/openair-cn/NAS/COMMON/EMM/MSG/COPYING new file mode 100644 index 0000000000..94a9ed024d --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/COPYING @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/openair-cn/NAS/COMMON/EMM/MSG/CsServiceNotification.c b/openair-cn/NAS/COMMON/EMM/MSG/CsServiceNotification.c new file mode 100644 index 0000000000..d299fd8d13 --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/CsServiceNotification.c @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#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; +} + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/CsServiceNotification.h b/openair-cn/NAS/COMMON/EMM/MSG/CsServiceNotification.h new file mode 100644 index 0000000000..6fcb5e0bab --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/CsServiceNotification.h @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "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_) */ + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/DetachAccept.c b/openair-cn/NAS/COMMON/EMM/MSG/DetachAccept.c new file mode 100644 index 0000000000..242020c4bf --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/DetachAccept.c @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#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; +} + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/DetachAccept.h b/openair-cn/NAS/COMMON/EMM/MSG/DetachAccept.h new file mode 100644 index 0000000000..2966bbad79 --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/DetachAccept.h @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "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_) */ + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/DetachRequest.c b/openair-cn/NAS/COMMON/EMM/MSG/DetachRequest.c new file mode 100644 index 0000000000..32b9a8f37f --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/DetachRequest.c @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#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; +} + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/DetachRequest.h b/openair-cn/NAS/COMMON/EMM/MSG/DetachRequest.h new file mode 100644 index 0000000000..9577b9a9cd --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/DetachRequest.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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "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_) */ + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/DownlinkNasTransport.c b/openair-cn/NAS/COMMON/EMM/MSG/DownlinkNasTransport.c new file mode 100644 index 0000000000..b4a1658c57 --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/DownlinkNasTransport.c @@ -0,0 +1,73 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#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; +} + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/DownlinkNasTransport.h b/openair-cn/NAS/COMMON/EMM/MSG/DownlinkNasTransport.h new file mode 100644 index 0000000000..4aaf43449b --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/DownlinkNasTransport.h @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "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_) */ + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/EmmInformation.c b/openair-cn/NAS/COMMON/EMM/MSG/EmmInformation.c new file mode 100644 index 0000000000..c7a041ed7d --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/EmmInformation.c @@ -0,0 +1,195 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#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; +} + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/EmmInformation.h b/openair-cn/NAS/COMMON/EMM/MSG/EmmInformation.h new file mode 100644 index 0000000000..ce87feb4e7 --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/EmmInformation.h @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "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_) */ + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/EmmStatus.c b/openair-cn/NAS/COMMON/EMM/MSG/EmmStatus.c new file mode 100644 index 0000000000..ec3154728b --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/EmmStatus.c @@ -0,0 +1,72 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#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; +} + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/EmmStatus.h b/openair-cn/NAS/COMMON/EMM/MSG/EmmStatus.h new file mode 100644 index 0000000000..6fe769dac6 --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/EmmStatus.h @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "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_) */ + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/ExtendedServiceRequest.c b/openair-cn/NAS/COMMON/EMM/MSG/ExtendedServiceRequest.c new file mode 100644 index 0000000000..85e337bc31 --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/ExtendedServiceRequest.c @@ -0,0 +1,91 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#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; +} + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/ExtendedServiceRequest.h b/openair-cn/NAS/COMMON/EMM/MSG/ExtendedServiceRequest.h new file mode 100644 index 0000000000..06d40edc19 --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/ExtendedServiceRequest.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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "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_) */ + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/GutiReallocationCommand.c b/openair-cn/NAS/COMMON/EMM/MSG/GutiReallocationCommand.c new file mode 100644 index 0000000000..e3f7764139 --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/GutiReallocationCommand.c @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#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; +} + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/GutiReallocationCommand.h b/openair-cn/NAS/COMMON/EMM/MSG/GutiReallocationCommand.h new file mode 100644 index 0000000000..7e7ffb7636 --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/GutiReallocationCommand.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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "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_) */ + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/GutiReallocationComplete.c b/openair-cn/NAS/COMMON/EMM/MSG/GutiReallocationComplete.c new file mode 100644 index 0000000000..8c3b0ed9ff --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/GutiReallocationComplete.c @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#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; +} + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/GutiReallocationComplete.h b/openair-cn/NAS/COMMON/EMM/MSG/GutiReallocationComplete.h new file mode 100644 index 0000000000..977e51709a --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/GutiReallocationComplete.h @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "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_) */ + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/IdentityRequest.c b/openair-cn/NAS/COMMON/EMM/MSG/IdentityRequest.c new file mode 100644 index 0000000000..3aafece930 --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/IdentityRequest.c @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#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; +} + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/IdentityRequest.h b/openair-cn/NAS/COMMON/EMM/MSG/IdentityRequest.h new file mode 100644 index 0000000000..1846253389 --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/IdentityRequest.h @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "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_) */ + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/IdentityResponse.c b/openair-cn/NAS/COMMON/EMM/MSG/IdentityResponse.c new file mode 100644 index 0000000000..bbef1794f7 --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/IdentityResponse.c @@ -0,0 +1,73 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#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; +} + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/IdentityResponse.h b/openair-cn/NAS/COMMON/EMM/MSG/IdentityResponse.h new file mode 100644 index 0000000000..cf58487f94 --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/IdentityResponse.h @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "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_) */ + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/Makefile b/openair-cn/NAS/COMMON/EMM/MSG/Makefile new file mode 100644 index 0000000000..0b434ba8ab --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/Makefile @@ -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 . +# +# 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. diff --git a/openair-cn/NAS/COMMON/EMM/MSG/NASSecurityModeCommand.h b/openair-cn/NAS/COMMON/EMM/MSG/NASSecurityModeCommand.h new file mode 100644 index 0000000000..96bef59660 --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/NASSecurityModeCommand.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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "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_) */ + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/NASSecurityModeComplete.h b/openair-cn/NAS/COMMON/EMM/MSG/NASSecurityModeComplete.h new file mode 100644 index 0000000000..5643e0ef8a --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/NASSecurityModeComplete.h @@ -0,0 +1,79 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#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_) */ + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/SecurityModeCommand.c b/openair-cn/NAS/COMMON/EMM/MSG/SecurityModeCommand.c new file mode 100644 index 0000000000..60946cd4ea --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/SecurityModeCommand.c @@ -0,0 +1,179 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#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; +} + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/SecurityModeComplete.c b/openair-cn/NAS/COMMON/EMM/MSG/SecurityModeComplete.c new file mode 100644 index 0000000000..971f94f05f --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/SecurityModeComplete.c @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#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; +} + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/SecurityModeReject.c b/openair-cn/NAS/COMMON/EMM/MSG/SecurityModeReject.c new file mode 100644 index 0000000000..6347772667 --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/SecurityModeReject.c @@ -0,0 +1,72 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#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; +} + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/SecurityModeReject.h b/openair-cn/NAS/COMMON/EMM/MSG/SecurityModeReject.h new file mode 100644 index 0000000000..6dcbeea379 --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/SecurityModeReject.h @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "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_) */ + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/ServiceReject.c b/openair-cn/NAS/COMMON/EMM/MSG/ServiceReject.c new file mode 100644 index 0000000000..21a2d8a2ba --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/ServiceReject.c @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#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; +} + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/ServiceReject.h b/openair-cn/NAS/COMMON/EMM/MSG/ServiceReject.h new file mode 100644 index 0000000000..acafd9247b --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/ServiceReject.h @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "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_) */ + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/ServiceRequest.c b/openair-cn/NAS/COMMON/EMM/MSG/ServiceRequest.c new file mode 100644 index 0000000000..28e22b773d --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/ServiceRequest.c @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#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); +} + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/ServiceRequest.h b/openair-cn/NAS/COMMON/EMM/MSG/ServiceRequest.h new file mode 100644 index 0000000000..7f8f78f95d --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/ServiceRequest.h @@ -0,0 +1,72 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#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_) */ + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateAccept.c b/openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateAccept.c new file mode 100644 index 0000000000..267534f18a --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateAccept.c @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#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; +} + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateAccept.h b/openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateAccept.h new file mode 100644 index 0000000000..1765f38836 --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateAccept.h @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "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_) */ + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateComplete.c b/openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateComplete.c new file mode 100644 index 0000000000..6ef5b1adcb --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateComplete.c @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#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; +} + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateComplete.h b/openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateComplete.h new file mode 100644 index 0000000000..3ebb3fe6fb --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateComplete.h @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "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_) */ + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateReject.c b/openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateReject.c new file mode 100644 index 0000000000..ebb6ffd376 --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateReject.c @@ -0,0 +1,73 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#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; +} + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateReject.h b/openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateReject.h new file mode 100644 index 0000000000..56452a58d4 --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateReject.h @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "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_) */ + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateRequest.c b/openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateRequest.c new file mode 100644 index 0000000000..ca614ce1af --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateRequest.c @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#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; +} + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateRequest.h b/openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateRequest.h new file mode 100644 index 0000000000..d8ce48027b --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/TrackingAreaUpdateRequest.h @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "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_) */ + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/UplinkNasTransport.c b/openair-cn/NAS/COMMON/EMM/MSG/UplinkNasTransport.c new file mode 100644 index 0000000000..ad1fe82b30 --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/UplinkNasTransport.c @@ -0,0 +1,73 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#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; +} + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/UplinkNasTransport.h b/openair-cn/NAS/COMMON/EMM/MSG/UplinkNasTransport.h new file mode 100644 index 0000000000..09f1bd2e00 --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/UplinkNasTransport.h @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "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_) */ + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/emm_cause.h b/openair-cn/NAS/COMMON/EMM/MSG/emm_cause.h new file mode 100644 index 0000000000..c5419201d2 --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/emm_cause.h @@ -0,0 +1,132 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +/***************************************************************************** +Source 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__*/ diff --git a/openair-cn/NAS/COMMON/EMM/MSG/emm_msg.c b/openair-cn/NAS/COMMON/EMM/MSG/emm_msg.c new file mode 100644 index 0000000000..979210c615 --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/emm_msg.c @@ -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 . + + 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); +} + diff --git a/openair-cn/NAS/COMMON/EMM/MSG/emm_msg.h b/openair-cn/NAS/COMMON/EMM/MSG/emm_msg.h new file mode 100644 index 0000000000..bb66c5e68b --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/emm_msg.h @@ -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 . + + 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 + +/****************************************************************************/ +/********************* 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__ */ diff --git a/openair-cn/NAS/COMMON/EMM/MSG/emm_msgDef.h b/openair-cn/NAS/COMMON/EMM/MSG/emm_msgDef.h new file mode 100644 index 0000000000..862204d37e --- /dev/null +++ b/openair-cn/NAS/COMMON/EMM/MSG/emm_msgDef.h @@ -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 . + + 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 +#include + +/****************************************************************************/ +/********************* 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__ */ + diff --git a/openair-cn/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextAccept.c b/openair-cn/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextAccept.c new file mode 100644 index 0000000000..c377e11680 --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextAccept.c @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#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; +} + diff --git a/openair-cn/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextAccept.h b/openair-cn/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextAccept.h new file mode 100644 index 0000000000..c8e1275086 --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextAccept.h @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "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_) */ + diff --git a/openair-cn/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextReject.c b/openair-cn/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextReject.c new file mode 100644 index 0000000000..95c6591281 --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextReject.c @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#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; +} + diff --git a/openair-cn/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextReject.h b/openair-cn/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextReject.h new file mode 100644 index 0000000000..e766ba18fe --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextReject.h @@ -0,0 +1,85 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "ProtocolDiscriminator.h" +#include "EpsBearerIdentity.h" +#include "ProcedureTransactionIdentity.h" +#include "MessageType.h" +#include "EsmCause.h" +#include "ProtocolConfigurationOptions.h" + +#ifndef ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT_H_ +#define ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT_H_ + +/* Minimum length macro. Formed by minimum length of each mandatory field */ +#define ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT_MINIMUM_LENGTH ( \ + ESM_CAUSE_MINIMUM_LENGTH ) + +/* Maximum length macro. Formed by maximum length of each field */ +#define ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT_MAXIMUM_LENGTH ( \ + ESM_CAUSE_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_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT (1<<0) + +typedef enum activate_dedicated_eps_bearer_context_reject_iei_tag { + ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI = 0x27, /* 0x27 = 39 */ +} activate_dedicated_eps_bearer_context_reject_iei; + +/* + * Message name: Activate dedicated EPS bearer context reject + * Description: This message is sent by UE to the network to reject activation of a dedicated EPS bearer context. See table 8.3.2.1. + * Significance: dual + * Direction: UE to network + */ + +typedef struct activate_dedicated_eps_bearer_context_reject_msg_tag { + /* Mandatory fields */ + ProtocolDiscriminator protocoldiscriminator:4; + EpsBearerIdentity epsbeareridentity:4; + ProcedureTransactionIdentity proceduretransactionidentity; + MessageType messagetype; + EsmCause esmcause; + /* Optional fields */ + uint32_t presencemask; + ProtocolConfigurationOptions protocolconfigurationoptions; +} activate_dedicated_eps_bearer_context_reject_msg; + +int decode_activate_dedicated_eps_bearer_context_reject(activate_dedicated_eps_bearer_context_reject_msg *activatededicatedepsbearercontextreject, uint8_t *buffer, uint32_t len); + +int encode_activate_dedicated_eps_bearer_context_reject(activate_dedicated_eps_bearer_context_reject_msg *activatededicatedepsbearercontextreject, uint8_t *buffer, uint32_t len); + +#endif /* ! defined(ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT_H_) */ + diff --git a/openair-cn/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextRequest.c b/openair-cn/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextRequest.c new file mode 100644 index 0000000000..750793784d --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextRequest.c @@ -0,0 +1,252 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#include "TLVEncoder.h" +#include "TLVDecoder.h" +#include "ActivateDedicatedEpsBearerContextRequest.h" + +int decode_activate_dedicated_eps_bearer_context_request(activate_dedicated_eps_bearer_context_request_msg *activate_dedicated_eps_bearer_context_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, ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_MINIMUM_LENGTH, len); + + /* Decoding mandatory fields */ + if ((decoded_result = decode_u8_linked_eps_bearer_identity(&activate_dedicated_eps_bearer_context_request->linkedepsbeareridentity, 0, *(buffer + decoded), len - decoded)) < 0) + return decoded_result; + + decoded++; + + if ((decoded_result = decode_eps_quality_of_service(&activate_dedicated_eps_bearer_context_request->epsqos, 0, buffer + decoded, len - decoded)) < 0) + return decoded_result; + else + decoded += decoded_result; + + if ((decoded_result = decode_traffic_flow_template(&activate_dedicated_eps_bearer_context_request->tft, 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_REQUEST_TRANSACTION_IDENTIFIER_IEI: + if ((decoded_result = + decode_transaction_identifier(&activate_dedicated_eps_bearer_context_request->transactionidentifier, + ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_TRANSACTION_IDENTIFIER_IEI, + buffer + decoded, len - decoded)) <= 0) + return decoded_result; + + decoded += decoded_result; + /* Set corresponding mask to 1 in presencemask */ + activate_dedicated_eps_bearer_context_request->presencemask |= ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_TRANSACTION_IDENTIFIER_PRESENT; + break; + + case ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_QOS_IEI: + if ((decoded_result = + decode_quality_of_service(&activate_dedicated_eps_bearer_context_request->negotiatedqos, + ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_QOS_IEI, + buffer + decoded, len - decoded)) <= 0) + return decoded_result; + + decoded += decoded_result; + /* Set corresponding mask to 1 in presencemask */ + activate_dedicated_eps_bearer_context_request->presencemask |= ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_QOS_PRESENT; + break; + + case ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_IEI: + if ((decoded_result = + decode_llc_service_access_point_identifier(&activate_dedicated_eps_bearer_context_request->negotiatedllcsapi, + ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_IEI, + buffer + decoded, len - decoded)) <= 0) + return decoded_result; + + decoded += decoded_result; + /* Set corresponding mask to 1 in presencemask */ + activate_dedicated_eps_bearer_context_request->presencemask |= ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_PRESENT; + break; + + case ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_IEI: + if ((decoded_result = + decode_radio_priority(&activate_dedicated_eps_bearer_context_request->radiopriority, + ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_IEI, + buffer + decoded, len - decoded)) <= 0) + return decoded_result; + + decoded += decoded_result; + /* Set corresponding mask to 1 in presencemask */ + activate_dedicated_eps_bearer_context_request->presencemask |= ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_PRESENT; + break; + + case ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_IEI: + if ((decoded_result = + decode_packet_flow_identifier(&activate_dedicated_eps_bearer_context_request->packetflowidentifier, + ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_IEI, + buffer + decoded, len - decoded)) <= 0) + return decoded_result; + + decoded += decoded_result; + /* Set corresponding mask to 1 in presencemask */ + activate_dedicated_eps_bearer_context_request->presencemask |= ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_PRESENT; + break; + + case ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI: + if ((decoded_result = + decode_protocol_configuration_options(&activate_dedicated_eps_bearer_context_request->protocolconfigurationoptions, + ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_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_request->presencemask |= ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_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_request(activate_dedicated_eps_bearer_context_request_msg *activate_dedicated_eps_bearer_context_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, ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_MINIMUM_LENGTH, len); + + *(buffer + encoded) = encode_u8_linked_eps_bearer_identity(&activate_dedicated_eps_bearer_context_request->linkedepsbeareridentity) & 0x0f; + encoded++; + + if ((encode_result = + encode_eps_quality_of_service(&activate_dedicated_eps_bearer_context_request->epsqos, + 0, buffer + encoded, len - encoded)) < 0) //Return in case of error + return encode_result; + else + encoded += encode_result; + + if ((encode_result = + encode_traffic_flow_template(&activate_dedicated_eps_bearer_context_request->tft, + 0, buffer + encoded, len - encoded)) < 0) //Return in case of error + return encode_result; + else + encoded += encode_result; + + if ((activate_dedicated_eps_bearer_context_request->presencemask & ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_TRANSACTION_IDENTIFIER_PRESENT) + == ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_TRANSACTION_IDENTIFIER_PRESENT) { + if ((encode_result = + encode_transaction_identifier(&activate_dedicated_eps_bearer_context_request->transactionidentifier, + ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_TRANSACTION_IDENTIFIER_IEI, + buffer + encoded, len - encoded)) < 0) + // Return in case of error + return encode_result; + else + encoded += encode_result; + } + + if ((activate_dedicated_eps_bearer_context_request->presencemask & ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_QOS_PRESENT) + == ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_QOS_PRESENT) { + if ((encode_result = + encode_quality_of_service(&activate_dedicated_eps_bearer_context_request->negotiatedqos, + ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_QOS_IEI, + buffer + encoded, len - encoded)) < 0) + // Return in case of error + return encode_result; + else + encoded += encode_result; + } + + if ((activate_dedicated_eps_bearer_context_request->presencemask & ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_PRESENT) + == ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_PRESENT) { + if ((encode_result = + encode_llc_service_access_point_identifier(&activate_dedicated_eps_bearer_context_request->negotiatedllcsapi, + ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_IEI, + buffer + encoded, len - encoded)) < 0) + // Return in case of error + return encode_result; + else + encoded += encode_result; + } + + if ((activate_dedicated_eps_bearer_context_request->presencemask & ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_PRESENT) + == ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_PRESENT) { + if ((encode_result = + encode_radio_priority(&activate_dedicated_eps_bearer_context_request->radiopriority, + ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_IEI, + buffer + encoded, len - encoded)) < 0) + // Return in case of error + return encode_result; + else + encoded += encode_result; + } + + if ((activate_dedicated_eps_bearer_context_request->presencemask & ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_PRESENT) + == ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_PRESENT) { + if ((encode_result = + encode_packet_flow_identifier(&activate_dedicated_eps_bearer_context_request->packetflowidentifier, + ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_IEI, + buffer + encoded, len - encoded)) < 0) + // Return in case of error + return encode_result; + else + encoded += encode_result; + } + + if ((activate_dedicated_eps_bearer_context_request->presencemask & ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) + == ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { + if ((encode_result = + encode_protocol_configuration_options(&activate_dedicated_eps_bearer_context_request->protocolconfigurationoptions, + ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI, + buffer + encoded, len - encoded)) < 0) + // Return in case of error + return encode_result; + else + encoded += encode_result; + } + + return encoded; +} + diff --git a/openair-cn/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextRequest.h b/openair-cn/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextRequest.h new file mode 100644 index 0000000000..cc7d65555a --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextRequest.h @@ -0,0 +1,116 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "ProtocolDiscriminator.h" +#include "EpsBearerIdentity.h" +#include "ProcedureTransactionIdentity.h" +#include "MessageType.h" +#include "LinkedEpsBearerIdentity.h" +#include "EpsQualityOfService.h" +#include "TrafficFlowTemplate.h" +#include "TransactionIdentifier.h" +#include "QualityOfService.h" +#include "LlcServiceAccessPointIdentifier.h" +#include "RadioPriority.h" +#include "PacketFlowIdentifier.h" +#include "ProtocolConfigurationOptions.h" + +#ifndef ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_H_ +#define ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_H_ + +/* Minimum length macro. Formed by minimum length of each mandatory field */ +#define ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_MINIMUM_LENGTH ( \ + EPS_QUALITY_OF_SERVICE_MINIMUM_LENGTH + \ + TRAFFIC_FLOW_TEMPLATE_MINIMUM_LENGTH ) + +/* Maximum length macro. Formed by maximum length of each field */ +#define ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_MAXIMUM_LENGTH ( \ + EPS_QUALITY_OF_SERVICE_MAXIMUM_LENGTH + \ + TRAFFIC_FLOW_TEMPLATE_MAXIMUM_LENGTH + \ + TRANSACTION_IDENTIFIER_MAXIMUM_LENGTH + \ + QUALITY_OF_SERVICE_MAXIMUM_LENGTH + \ + LLC_SERVICE_ACCESS_POINT_IDENTIFIER_MAXIMUM_LENGTH + \ + RADIO_PRIORITY_MAXIMUM_LENGTH + \ + PACKET_FLOW_IDENTIFIER_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_REQUEST_TRANSACTION_IDENTIFIER_PRESENT (1<<0) +# define ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_QOS_PRESENT (1<<1) +# define ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_PRESENT (1<<2) +# define ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_PRESENT (1<<3) +# define ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_PRESENT (1<<4) +# define ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT (1<<5) + +typedef enum activate_dedicated_eps_bearer_context_request_iei_tag { + ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_TRANSACTION_IDENTIFIER_IEI = 0x5D, /* 0x5D = 93 */ + ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_QOS_IEI = 0x30, /* 0x30 = 48 */ + ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_IEI = 0x32, /* 0x32 = 50 */ + ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_IEI = 0x80, /* 0x80 = 128 */ + ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_IEI = 0x34, /* 0x34 = 52 */ + ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI = 0x27, /* 0x27 = 39 */ +} activate_dedicated_eps_bearer_context_request_iei; + +/* + * Message name: Activate dedicated EPS bearer context request + * Description: This message is sent by the network to the UE to request activation of a dedicated EPS bearer context associated with the same PDN address(es) and APN as an already active default EPS bearer context. See table 8.3.3.1. + * Significance: dual + * Direction: network to UE + */ + +typedef struct activate_dedicated_eps_bearer_context_request_msg_tag { + /* Mandatory fields */ + ProtocolDiscriminator protocoldiscriminator:4; + EpsBearerIdentity epsbeareridentity:4; + ProcedureTransactionIdentity proceduretransactionidentity; + MessageType messagetype; + LinkedEpsBearerIdentity linkedepsbeareridentity; + EpsQualityOfService epsqos; + TrafficFlowTemplate tft; + /* Optional fields */ + uint32_t presencemask; + TransactionIdentifier transactionidentifier; + QualityOfService negotiatedqos; + LlcServiceAccessPointIdentifier negotiatedllcsapi; + RadioPriority radiopriority; + PacketFlowIdentifier packetflowidentifier; + ProtocolConfigurationOptions protocolconfigurationoptions; +} activate_dedicated_eps_bearer_context_request_msg; + +int decode_activate_dedicated_eps_bearer_context_request(activate_dedicated_eps_bearer_context_request_msg *activatededicatedepsbearercontextrequest, uint8_t *buffer, uint32_t len); + +int encode_activate_dedicated_eps_bearer_context_request(activate_dedicated_eps_bearer_context_request_msg *activatededicatedepsbearercontextrequest, uint8_t *buffer, uint32_t len); + +#endif /* ! defined(ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_H_) */ + diff --git a/openair-cn/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextAccept.c b/openair-cn/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextAccept.c new file mode 100644 index 0000000000..a4806d58d4 --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextAccept.c @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#include "TLVEncoder.h" +#include "TLVDecoder.h" +#include "ActivateDefaultEpsBearerContextAccept.h" + +int decode_activate_default_eps_bearer_context_accept(activate_default_eps_bearer_context_accept_msg *activate_default_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_DEFAULT_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_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_IEI: + if ((decoded_result = + decode_protocol_configuration_options(&activate_default_eps_bearer_context_accept->protocolconfigurationoptions, + ACTIVATE_DEFAULT_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_default_eps_bearer_context_accept->presencemask |= ACTIVATE_DEFAULT_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_default_eps_bearer_context_accept(activate_default_eps_bearer_context_accept_msg *activate_default_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_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT_MINIMUM_LENGTH, len); + + if ((activate_default_eps_bearer_context_accept->presencemask & ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) + == ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { + if ((encode_result = + encode_protocol_configuration_options(&activate_default_eps_bearer_context_accept->protocolconfigurationoptions, + ACTIVATE_DEFAULT_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; +} + diff --git a/openair-cn/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextAccept.h b/openair-cn/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextAccept.h new file mode 100644 index 0000000000..c678d9b9d2 --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextAccept.h @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "ProtocolDiscriminator.h" +#include "EpsBearerIdentity.h" +#include "ProcedureTransactionIdentity.h" +#include "MessageType.h" +#include "ProtocolConfigurationOptions.h" + +#ifndef ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT_H_ +#define ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT_H_ + +/* Minimum length macro. Formed by minimum length of each mandatory field */ +#define ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT_MINIMUM_LENGTH (0) + +/* Maximum length macro. Formed by maximum length of each field */ +#define ACTIVATE_DEFAULT_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_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT (1<<0) + +typedef enum activate_default_eps_bearer_context_accept_iei_tag { + ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_IEI = 0x27, /* 0x27 = 39 */ +} activate_default_eps_bearer_context_accept_iei; + +/* + * Message name: Activate default EPS bearer context accept + * Description: This message is sent by the UE to the network to acknowledge activation of a default EPS bearer context. See table 8.3.4.1. + * Significance: dual + * Direction: UE to network + */ + +typedef struct activate_default_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_default_eps_bearer_context_accept_msg; + +int decode_activate_default_eps_bearer_context_accept(activate_default_eps_bearer_context_accept_msg *activatedefaultepsbearercontextaccept, uint8_t *buffer, uint32_t len); + +int encode_activate_default_eps_bearer_context_accept(activate_default_eps_bearer_context_accept_msg *activatedefaultepsbearercontextaccept, uint8_t *buffer, uint32_t len); + +#endif /* ! defined(ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT_H_) */ + diff --git a/openair-cn/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextReject.c b/openair-cn/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextReject.c new file mode 100644 index 0000000000..a8252622c8 --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextReject.c @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#include "TLVEncoder.h" +#include "TLVDecoder.h" +#include "ActivateDefaultEpsBearerContextReject.h" + +int decode_activate_default_eps_bearer_context_reject(activate_default_eps_bearer_context_reject_msg *activate_default_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_DEFAULT_EPS_BEARER_CONTEXT_REJECT_MINIMUM_LENGTH, len); + + /* Decoding mandatory fields */ + if ((decoded_result = decode_esm_cause(&activate_default_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_DEFAULT_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI: + if ((decoded_result = + decode_protocol_configuration_options(&activate_default_eps_bearer_context_reject->protocolconfigurationoptions, + ACTIVATE_DEFAULT_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_default_eps_bearer_context_reject->presencemask |= ACTIVATE_DEFAULT_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_default_eps_bearer_context_reject(activate_default_eps_bearer_context_reject_msg *activate_default_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_DEFAULT_EPS_BEARER_CONTEXT_REJECT_MINIMUM_LENGTH, len); + + if ((encode_result = + encode_esm_cause(&activate_default_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_default_eps_bearer_context_reject->presencemask & ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) + == ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { + if ((encode_result = + encode_protocol_configuration_options(&activate_default_eps_bearer_context_reject->protocolconfigurationoptions, + ACTIVATE_DEFAULT_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; +} + diff --git a/openair-cn/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextReject.h b/openair-cn/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextReject.h new file mode 100644 index 0000000000..2bfe844c6b --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextReject.h @@ -0,0 +1,85 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "ProtocolDiscriminator.h" +#include "EpsBearerIdentity.h" +#include "ProcedureTransactionIdentity.h" +#include "MessageType.h" +#include "EsmCause.h" +#include "ProtocolConfigurationOptions.h" + +#ifndef ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT_H_ +#define ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT_H_ + +/* Minimum length macro. Formed by minimum length of each mandatory field */ +#define ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT_MINIMUM_LENGTH ( \ + ESM_CAUSE_MINIMUM_LENGTH ) + +/* Maximum length macro. Formed by maximum length of each field */ +#define ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT_MAXIMUM_LENGTH ( \ + ESM_CAUSE_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_DEFAULT_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT (1<<0) + +typedef enum activate_default_eps_bearer_context_reject_iei_tag { + ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI = 0x27, /* 0x27 = 39 */ +} activate_default_eps_bearer_context_reject_iei; + +/* + * Message name: Activate default EPS bearer context reject + * Description: This message is sent by UE to the network to reject activation of a default EPS bearer context. See table 8.3.5.1. + * Significance: dual + * Direction: UE to network + */ + +typedef struct activate_default_eps_bearer_context_reject_msg_tag { + /* Mandatory fields */ + ProtocolDiscriminator protocoldiscriminator:4; + EpsBearerIdentity epsbeareridentity:4; + ProcedureTransactionIdentity proceduretransactionidentity; + MessageType messagetype; + EsmCause esmcause; + /* Optional fields */ + uint32_t presencemask; + ProtocolConfigurationOptions protocolconfigurationoptions; +} activate_default_eps_bearer_context_reject_msg; + +int decode_activate_default_eps_bearer_context_reject(activate_default_eps_bearer_context_reject_msg *activatedefaultepsbearercontextreject, uint8_t *buffer, uint32_t len); + +int encode_activate_default_eps_bearer_context_reject(activate_default_eps_bearer_context_reject_msg *activatedefaultepsbearercontextreject, uint8_t *buffer, uint32_t len); + +#endif /* ! defined(ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT_H_) */ + diff --git a/openair-cn/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextRequest.c b/openair-cn/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextRequest.c new file mode 100644 index 0000000000..3dec0a429a --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextRequest.c @@ -0,0 +1,341 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#include "TLVEncoder.h" +#include "TLVDecoder.h" +#include "ActivateDefaultEpsBearerContextRequest.h" + +int decode_activate_default_eps_bearer_context_request(activate_default_eps_bearer_context_request_msg *activate_default_eps_bearer_context_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, ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_MINIMUM_LENGTH, len); + + /* Decoding mandatory fields */ + if ((decoded_result = decode_eps_quality_of_service(&activate_default_eps_bearer_context_request->epsqos, 0, buffer + decoded, len - decoded)) < 0) + return decoded_result; + else + decoded += decoded_result; + + if ((decoded_result = decode_access_point_name(&activate_default_eps_bearer_context_request->accesspointname, 0, buffer + decoded, len - decoded)) < 0) + return decoded_result; + else + decoded += decoded_result; + + if ((decoded_result = decode_pdn_address(&activate_default_eps_bearer_context_request->pdnaddress, 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_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_TRANSACTION_IDENTIFIER_IEI: + if ((decoded_result = + decode_transaction_identifier(&activate_default_eps_bearer_context_request->transactionidentifier, + ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_TRANSACTION_IDENTIFIER_IEI, + buffer + decoded, len - decoded)) <= 0) + return decoded_result; + + decoded += decoded_result; + /* Set corresponding mask to 1 in presencemask */ + activate_default_eps_bearer_context_request->presencemask |= ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_TRANSACTION_IDENTIFIER_PRESENT; + break; + + case ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_QOS_IEI: + if ((decoded_result = + decode_quality_of_service(&activate_default_eps_bearer_context_request->negotiatedqos, + ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_QOS_IEI, + buffer + decoded, len - decoded)) <= 0) + return decoded_result; + + decoded += decoded_result; + /* Set corresponding mask to 1 in presencemask */ + activate_default_eps_bearer_context_request->presencemask |= ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_QOS_PRESENT; + break; + + case ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_IEI: + if ((decoded_result = + decode_llc_service_access_point_identifier(&activate_default_eps_bearer_context_request->negotiatedllcsapi, + ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_IEI, + buffer + decoded, len - decoded)) <= 0) + return decoded_result; + + decoded += decoded_result; + /* Set corresponding mask to 1 in presencemask */ + activate_default_eps_bearer_context_request->presencemask |= ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_PRESENT; + break; + + case ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_IEI: + if ((decoded_result = + decode_radio_priority(&activate_default_eps_bearer_context_request->radiopriority, + ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_IEI, + buffer + decoded, len - decoded)) <= 0) + return decoded_result; + + decoded += decoded_result; + /* Set corresponding mask to 1 in presencemask */ + activate_default_eps_bearer_context_request->presencemask |= ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_PRESENT; + break; + + case ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_IEI: + if ((decoded_result = + decode_packet_flow_identifier(&activate_default_eps_bearer_context_request->packetflowidentifier, + ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_IEI, + buffer + decoded, len - decoded)) <= 0) + return decoded_result; + + decoded += decoded_result; + /* Set corresponding mask to 1 in presencemask */ + activate_default_eps_bearer_context_request->presencemask |= ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_PRESENT; + break; + + case ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_APNAMBR_IEI: + if ((decoded_result = + decode_apn_aggregate_maximum_bit_rate(&activate_default_eps_bearer_context_request->apnambr, + ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_APNAMBR_IEI, + buffer + decoded, len - decoded)) <= 0) + return decoded_result; + + decoded += decoded_result; + /* Set corresponding mask to 1 in presencemask */ + activate_default_eps_bearer_context_request->presencemask |= ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_APNAMBR_PRESENT; + break; + + case ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_ESM_CAUSE_IEI: + if ((decoded_result = + decode_esm_cause(&activate_default_eps_bearer_context_request->esmcause, + ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_ESM_CAUSE_IEI, + buffer + decoded, len - decoded)) <= 0) + return decoded_result; + + decoded += decoded_result; + /* Set corresponding mask to 1 in presencemask */ + activate_default_eps_bearer_context_request->presencemask |= ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_ESM_CAUSE_PRESENT; + break; + + case ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI: + if ((decoded_result = + decode_protocol_configuration_options(&activate_default_eps_bearer_context_request->protocolconfigurationoptions, + ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI, + buffer + decoded, len - decoded)) <= 0) + return decoded_result; + + decoded += decoded_result; + /* Set corresponding mask to 1 in presencemask */ + activate_default_eps_bearer_context_request->presencemask |= ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; + break; + + default: + errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; + return TLV_DECODE_UNEXPECTED_IEI; + } + } + + return decoded; +} + +int encode_activate_default_eps_bearer_context_request(activate_default_eps_bearer_context_request_msg *activate_default_eps_bearer_context_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, ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_MINIMUM_LENGTH, len); + + if ((encode_result = + encode_eps_quality_of_service(&activate_default_eps_bearer_context_request->epsqos, + 0, buffer + encoded, len - encoded)) < 0) { //Return in case of error + LOG_TRACE(ERROR, "ESM ENCODE epsqos"); + return encode_result; + } else + encoded += encode_result; + + if ((encode_result = + encode_access_point_name(&activate_default_eps_bearer_context_request->accesspointname, + 0, buffer + encoded, len - encoded)) < 0) { //Return in case of error + LOG_TRACE(ERROR, "ESM ENCODE accesspointname"); + return encode_result; + } else + encoded += encode_result; + + if ((encode_result = + encode_pdn_address(&activate_default_eps_bearer_context_request->pdnaddress, + 0, buffer + encoded, len - encoded)) < 0) { //Return in case of error + LOG_TRACE(ERROR, "ESM ENCODE pdnaddress"); + return encode_result; + } else + encoded += encode_result; + + if ((activate_default_eps_bearer_context_request->presencemask & ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_TRANSACTION_IDENTIFIER_PRESENT) + == ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_TRANSACTION_IDENTIFIER_PRESENT) { + if ((encode_result = + encode_transaction_identifier(&activate_default_eps_bearer_context_request->transactionidentifier, + ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_TRANSACTION_IDENTIFIER_IEI, + buffer + encoded, len - encoded)) < 0) { + LOG_TRACE(ERROR, "ESM ENCODE transactionidentifier"); + // Return in case of error + return encode_result; + } else + encoded += encode_result; + } + + if ((activate_default_eps_bearer_context_request->presencemask & ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_QOS_PRESENT) + == ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_QOS_PRESENT) { + if ((encode_result = + encode_quality_of_service(&activate_default_eps_bearer_context_request->negotiatedqos, + ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_QOS_IEI, + buffer + encoded, len - encoded)) < 0) { + LOG_TRACE(ERROR, "ESM ENCODE negotiatedqos"); + // Return in case of error + return encode_result; + } else + encoded += encode_result; + } + + if ((activate_default_eps_bearer_context_request->presencemask & ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_PRESENT) + == ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_PRESENT) { + if ((encode_result = + encode_llc_service_access_point_identifier(&activate_default_eps_bearer_context_request->negotiatedllcsapi, + ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_IEI, + buffer + encoded, len - encoded)) < 0) { + LOG_TRACE(ERROR, "ESM ENCODE negotiatedllcsapi"); + // Return in case of error + return encode_result; + } else + encoded += encode_result; + } + + if ((activate_default_eps_bearer_context_request->presencemask & ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_PRESENT) + == ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_PRESENT) { + if ((encode_result = + encode_radio_priority(&activate_default_eps_bearer_context_request->radiopriority, + ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_IEI, + buffer + encoded, len - encoded)) < 0) { + LOG_TRACE(ERROR, "ESM ENCODE radiopriority"); + // Return in case of error + return encode_result; + } else + encoded += encode_result; + } + + if ((activate_default_eps_bearer_context_request->presencemask & ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_PRESENT) + == ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_PRESENT) { + if ((encode_result = + encode_packet_flow_identifier(&activate_default_eps_bearer_context_request->packetflowidentifier, + ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_IEI, + buffer + encoded, len - encoded)) < 0) { + LOG_TRACE(ERROR, "ESM ENCODE packetflowidentifier"); + // Return in case of error + return encode_result; + } else + encoded += encode_result; + } + + if ((activate_default_eps_bearer_context_request->presencemask & ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_APNAMBR_PRESENT) + == ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_APNAMBR_PRESENT) { + if ((encode_result = + encode_apn_aggregate_maximum_bit_rate(&activate_default_eps_bearer_context_request->apnambr, + ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_APNAMBR_IEI, buffer + + encoded, len - encoded)) < 0) { + LOG_TRACE(ERROR, "ESM ENCODE apnambr"); + // Return in case of error + return encode_result; + } else + encoded += encode_result; + } + + if ((activate_default_eps_bearer_context_request->presencemask & ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_ESM_CAUSE_PRESENT) + == ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_ESM_CAUSE_PRESENT) { + if ((encode_result = + encode_esm_cause(&activate_default_eps_bearer_context_request->esmcause, + ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_ESM_CAUSE_IEI, buffer + + encoded, len - encoded)) < 0) { + LOG_TRACE(ERROR, "ESM ENCODE esmcause"); + // Return in case of error + return encode_result; + } else + encoded += encode_result; + } + +#if 0 /* LW: force Protocol Configuration Options to be included in the ESM message */ + { +#define CONFIGURATION_PROTOCOL_PPP 0 + +#define PROTOCOL_ID_IPCP 0x8021 +#define PROTOCOL_ID_DNS_SERVER_IPV4_ADDRESS 0x000D + + /* Force this item to be present */ + activate_default_eps_bearer_context_request->presencemask |= ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; + /* Fill this item with data from PFT trace */ + activate_default_eps_bearer_context_request->protocolconfigurationoptions.configurationprotol = CONFIGURATION_PROTOCOL_PPP; + activate_default_eps_bearer_context_request->protocolconfigurationoptions.protocolid = PROTOCOL_ID_IPCP; + activate_default_eps_bearer_context_request->protocolconfigurationoptions.lengthofprotocolid = 16; /* Size of PROTOCOL_ID_IPCP */ + activate_default_eps_bearer_context_request->protocolconfigurationoptions.protocolidcontents.value = (uint8_t *) + /* PROTOCOL_ID_IPCP data */ + "\x03\x00\x00\x10\x81\x06\xC0\xA8\x0C\x64\x83\x06\xC0\xA8\x6A\x0C"; + /* Additional parameters PROTOCOL_ID_DNS_SERVER_IPV4_ADDRESS data */ + //"\x00\x0d\x04\x52\x61\x00\x78" + /* Additional parameters PROTOCOL_ID_DNS_SERVER_IPV4_ADDRESS data */ + //"\x00\x0d\x04\x52\x61\x01\x78"; + //activate_default_eps_bearer_context_request->protocolconfigurationoptions.protocolidcontents.length = 16 + 7 + 7; + activate_default_eps_bearer_context_request->protocolconfigurationoptions.protocolidcontents.length = 16; + } +#endif + + if ((activate_default_eps_bearer_context_request->presencemask & ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) + == ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { + if ((encode_result = + encode_protocol_configuration_options(&activate_default_eps_bearer_context_request->protocolconfigurationoptions, + ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI, + buffer + encoded, len - encoded)) < 0) { + LOG_TRACE(ERROR, "ESM ENCODE protocolconfigurationoptions"); + // Return in case of error + return encode_result; + } else + encoded += encode_result; + } + + LOG_TRACE(INFO, "ESM ENCODED activate_default_eps_bearer_context_request"); + return encoded; +} + diff --git a/openair-cn/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextRequest.h b/openair-cn/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextRequest.h new file mode 100644 index 0000000000..749c64f93d --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextRequest.h @@ -0,0 +1,128 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "ProtocolDiscriminator.h" +#include "EpsBearerIdentity.h" +#include "ProcedureTransactionIdentity.h" +#include "MessageType.h" +#include "EpsQualityOfService.h" +#include "AccessPointName.h" +#include "PdnAddress.h" +#include "TransactionIdentifier.h" +#include "QualityOfService.h" +#include "LlcServiceAccessPointIdentifier.h" +#include "RadioPriority.h" +#include "PacketFlowIdentifier.h" +#include "ApnAggregateMaximumBitRate.h" +#include "EsmCause.h" +#include "ProtocolConfigurationOptions.h" + +#ifndef ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_H_ +#define ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_H_ + +/* Minimum length macro. Formed by minimum length of each mandatory field */ +#define ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_MINIMUM_LENGTH ( \ + EPS_QUALITY_OF_SERVICE_MINIMUM_LENGTH + \ + ACCESS_POINT_NAME_MINIMUM_LENGTH + \ + PDN_ADDRESS_MINIMUM_LENGTH ) + +/* Maximum length macro. Formed by maximum length of each field */ +#define ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_MAXIMUM_LENGTH ( \ + EPS_QUALITY_OF_SERVICE_MAXIMUM_LENGTH + \ + ACCESS_POINT_NAME_MAXIMUM_LENGTH + \ + PDN_ADDRESS_MAXIMUM_LENGTH + \ + TRANSACTION_IDENTIFIER_MAXIMUM_LENGTH + \ + QUALITY_OF_SERVICE_MAXIMUM_LENGTH + \ + LLC_SERVICE_ACCESS_POINT_IDENTIFIER_MAXIMUM_LENGTH + \ + RADIO_PRIORITY_MAXIMUM_LENGTH + \ + PACKET_FLOW_IDENTIFIER_MAXIMUM_LENGTH + \ + APN_AGGREGATE_MAXIMUM_BIT_RATE_MAXIMUM_LENGTH + \ + ESM_CAUSE_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_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_TRANSACTION_IDENTIFIER_PRESENT (1<<0) +# define ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_QOS_PRESENT (1<<1) +# define ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_PRESENT (1<<2) +# define ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_PRESENT (1<<3) +# define ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_PRESENT (1<<4) +# define ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_APNAMBR_PRESENT (1<<5) +# define ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_ESM_CAUSE_PRESENT (1<<6) +# define ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT (1<<7) + +typedef enum activate_default_eps_bearer_context_request_iei_tag { + ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_TRANSACTION_IDENTIFIER_IEI = 0x5D, /* 0x5D = 93 */ + ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_QOS_IEI = 0x30, /* 0x30 = 48 */ + ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_IEI = 0x32, /* 0x32 = 50 */ + ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_IEI = 0x80, /* 0x80 = 128 */ + ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_IEI = 0x34, /* 0x34 = 52 */ + ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_APNAMBR_IEI = 0x5E, /* 0x5E = 94 */ + ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_ESM_CAUSE_IEI = 0x58, /* 0x58 = 88 */ + ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI = 0x27, /* 0x27 = 39 */ +} activate_default_eps_bearer_context_request_iei; + +/* + * Message name: Activate default EPS bearer context request + * Description: This message is sent by the network to the UE to request activation of a default EPS bearer context. See table 8.3.6.1. + * Significance: dual + * Direction: network to UE + */ + +typedef struct activate_default_eps_bearer_context_request_msg_tag { + /* Mandatory fields */ + ProtocolDiscriminator protocoldiscriminator:4; + EpsBearerIdentity epsbeareridentity:4; + ProcedureTransactionIdentity proceduretransactionidentity; + MessageType messagetype; + EpsQualityOfService epsqos; + AccessPointName accesspointname; + PdnAddress pdnaddress; + /* Optional fields */ + uint32_t presencemask; + TransactionIdentifier transactionidentifier; + QualityOfService negotiatedqos; + LlcServiceAccessPointIdentifier negotiatedllcsapi; + RadioPriority radiopriority; + PacketFlowIdentifier packetflowidentifier; + ApnAggregateMaximumBitRate apnambr; + EsmCause esmcause; + ProtocolConfigurationOptions protocolconfigurationoptions; +} activate_default_eps_bearer_context_request_msg; + +int decode_activate_default_eps_bearer_context_request(activate_default_eps_bearer_context_request_msg *activatedefaultepsbearercontextrequest, uint8_t *buffer, uint32_t len); + +int encode_activate_default_eps_bearer_context_request(activate_default_eps_bearer_context_request_msg *activatedefaultepsbearercontextrequest, uint8_t *buffer, uint32_t len); + +#endif /* ! defined(ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_H_) */ + diff --git a/openair-cn/NAS/COMMON/ESM/MSG/BearerResourceAllocationReject.c b/openair-cn/NAS/COMMON/ESM/MSG/BearerResourceAllocationReject.c new file mode 100644 index 0000000000..9ca43d45f8 --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/BearerResourceAllocationReject.c @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#include "TLVEncoder.h" +#include "TLVDecoder.h" +#include "BearerResourceAllocationReject.h" + +int decode_bearer_resource_allocation_reject(bearer_resource_allocation_reject_msg *bearer_resource_allocation_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, BEARER_RESOURCE_ALLOCATION_REJECT_MINIMUM_LENGTH, len); + + /* Decoding mandatory fields */ + if ((decoded_result = decode_esm_cause(&bearer_resource_allocation_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 BEARER_RESOURCE_ALLOCATION_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI: + if ((decoded_result = + decode_protocol_configuration_options(&bearer_resource_allocation_reject->protocolconfigurationoptions, + BEARER_RESOURCE_ALLOCATION_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI, + buffer + decoded, len - decoded)) <= 0) + return decoded_result; + + decoded += decoded_result; + /* Set corresponding mask to 1 in presencemask */ + bearer_resource_allocation_reject->presencemask |= BEARER_RESOURCE_ALLOCATION_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; + break; + + default: + errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; + return TLV_DECODE_UNEXPECTED_IEI; + } + } + + return decoded; +} + +int encode_bearer_resource_allocation_reject(bearer_resource_allocation_reject_msg *bearer_resource_allocation_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, BEARER_RESOURCE_ALLOCATION_REJECT_MINIMUM_LENGTH, len); + + if ((encode_result = + encode_esm_cause(&bearer_resource_allocation_reject->esmcause, 0, + buffer + encoded, len - encoded)) < 0) //Return in case of error + return encode_result; + else + encoded += encode_result; + + if ((bearer_resource_allocation_reject->presencemask & BEARER_RESOURCE_ALLOCATION_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) + == BEARER_RESOURCE_ALLOCATION_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { + if ((encode_result = + encode_protocol_configuration_options(&bearer_resource_allocation_reject->protocolconfigurationoptions, + BEARER_RESOURCE_ALLOCATION_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI, + buffer + encoded, len - encoded)) < 0) + // Return in case of error + return encode_result; + else + encoded += encode_result; + } + + return encoded; +} + diff --git a/openair-cn/NAS/COMMON/ESM/MSG/BearerResourceAllocationReject.h b/openair-cn/NAS/COMMON/ESM/MSG/BearerResourceAllocationReject.h new file mode 100644 index 0000000000..e31a6f6d8a --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/BearerResourceAllocationReject.h @@ -0,0 +1,85 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "ProtocolDiscriminator.h" +#include "EpsBearerIdentity.h" +#include "ProcedureTransactionIdentity.h" +#include "MessageType.h" +#include "EsmCause.h" +#include "ProtocolConfigurationOptions.h" + +#ifndef BEARER_RESOURCE_ALLOCATION_REJECT_H_ +#define BEARER_RESOURCE_ALLOCATION_REJECT_H_ + +/* Minimum length macro. Formed by minimum length of each mandatory field */ +#define BEARER_RESOURCE_ALLOCATION_REJECT_MINIMUM_LENGTH ( \ + ESM_CAUSE_MINIMUM_LENGTH ) + +/* Maximum length macro. Formed by maximum length of each field */ +#define BEARER_RESOURCE_ALLOCATION_REJECT_MAXIMUM_LENGTH ( \ + ESM_CAUSE_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 BEARER_RESOURCE_ALLOCATION_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT (1<<0) + +typedef enum bearer_resource_allocation_reject_iei_tag { + BEARER_RESOURCE_ALLOCATION_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI = 0x27, /* 0x27 = 39 */ +} bearer_resource_allocation_reject_iei; + +/* + * Message name: Bearer resource allocation reject + * Description: This message is sent by the network to the UE to reject the allocation of a dedicated bearer resource. See table 8.3.7.1. + * Significance: dual + * Direction: network to UE + */ + +typedef struct bearer_resource_allocation_reject_msg_tag { + /* Mandatory fields */ + ProtocolDiscriminator protocoldiscriminator:4; + EpsBearerIdentity epsbeareridentity:4; + ProcedureTransactionIdentity proceduretransactionidentity; + MessageType messagetype; + EsmCause esmcause; + /* Optional fields */ + uint32_t presencemask; + ProtocolConfigurationOptions protocolconfigurationoptions; +} bearer_resource_allocation_reject_msg; + +int decode_bearer_resource_allocation_reject(bearer_resource_allocation_reject_msg *bearerresourceallocationreject, uint8_t *buffer, uint32_t len); + +int encode_bearer_resource_allocation_reject(bearer_resource_allocation_reject_msg *bearerresourceallocationreject, uint8_t *buffer, uint32_t len); + +#endif /* ! defined(BEARER_RESOURCE_ALLOCATION_REJECT_H_) */ + diff --git a/openair-cn/NAS/COMMON/ESM/MSG/BearerResourceAllocationRequest.c b/openair-cn/NAS/COMMON/ESM/MSG/BearerResourceAllocationRequest.c new file mode 100644 index 0000000000..73968f489b --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/BearerResourceAllocationRequest.c @@ -0,0 +1,132 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#include "TLVEncoder.h" +#include "TLVDecoder.h" +#include "BearerResourceAllocationRequest.h" + +int decode_bearer_resource_allocation_request(bearer_resource_allocation_request_msg *bearer_resource_allocation_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, BEARER_RESOURCE_ALLOCATION_REQUEST_MINIMUM_LENGTH, len); + + /* Decoding mandatory fields */ + if ((decoded_result = decode_u8_linked_eps_bearer_identity(&bearer_resource_allocation_request->linkedepsbeareridentity, 0, *(buffer + decoded) >> 4, len - decoded)) < 0) + return decoded_result; + + decoded++; + + if ((decoded_result = decode_traffic_flow_aggregate_description(&bearer_resource_allocation_request->trafficflowaggregate, 0, buffer + decoded, len - decoded)) < 0) + return decoded_result; + else + decoded += decoded_result; + + if ((decoded_result = decode_eps_quality_of_service(&bearer_resource_allocation_request->requiredtrafficflowqos, 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 BEARER_RESOURCE_ALLOCATION_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI: + if ((decoded_result = + decode_protocol_configuration_options(&bearer_resource_allocation_request->protocolconfigurationoptions, + BEARER_RESOURCE_ALLOCATION_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI, + buffer + decoded, len - decoded)) <= 0) + return decoded_result; + + decoded += decoded_result; + /* Set corresponding mask to 1 in presencemask */ + bearer_resource_allocation_request->presencemask |= BEARER_RESOURCE_ALLOCATION_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; + break; + + default: + errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; + return TLV_DECODE_UNEXPECTED_IEI; + } + } + + return decoded; +} + +int encode_bearer_resource_allocation_request(bearer_resource_allocation_request_msg *bearer_resource_allocation_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, BEARER_RESOURCE_ALLOCATION_REQUEST_MINIMUM_LENGTH, len); + + *(buffer + encoded) = ((encode_u8_linked_eps_bearer_identity(&bearer_resource_allocation_request->linkedepsbeareridentity) & 0x0f) << 4) | 0x00; + encoded++; + + if ((encode_result = + encode_traffic_flow_aggregate_description(&bearer_resource_allocation_request->trafficflowaggregate, + 0, buffer + encoded, len - encoded)) < 0) //Return in case of error + return encode_result; + else + encoded += encode_result; + + if ((encode_result = + encode_eps_quality_of_service(&bearer_resource_allocation_request->requiredtrafficflowqos, + 0, buffer + encoded, len - encoded)) < 0) //Return in case of error + return encode_result; + else + encoded += encode_result; + + if ((bearer_resource_allocation_request->presencemask & BEARER_RESOURCE_ALLOCATION_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) + == BEARER_RESOURCE_ALLOCATION_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { + if ((encode_result = + encode_protocol_configuration_options(&bearer_resource_allocation_request->protocolconfigurationoptions, + BEARER_RESOURCE_ALLOCATION_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI, + buffer + encoded, len - encoded)) < 0) + // Return in case of error + return encode_result; + else + encoded += encode_result; + } + + return encoded; +} + diff --git a/openair-cn/NAS/COMMON/ESM/MSG/BearerResourceAllocationRequest.h b/openair-cn/NAS/COMMON/ESM/MSG/BearerResourceAllocationRequest.h new file mode 100644 index 0000000000..48a28c5090 --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/BearerResourceAllocationRequest.h @@ -0,0 +1,91 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "ProtocolDiscriminator.h" +#include "EpsBearerIdentity.h" +#include "ProcedureTransactionIdentity.h" +#include "MessageType.h" +#include "LinkedEpsBearerIdentity.h" +#include "TrafficFlowAggregateDescription.h" +#include "EpsQualityOfService.h" +#include "ProtocolConfigurationOptions.h" + +#ifndef BEARER_RESOURCE_ALLOCATION_REQUEST_H_ +#define BEARER_RESOURCE_ALLOCATION_REQUEST_H_ + +/* Minimum length macro. Formed by minimum length of each mandatory field */ +#define BEARER_RESOURCE_ALLOCATION_REQUEST_MINIMUM_LENGTH ( \ + TRAFFIC_FLOW_AGGREGATE_DESCRIPTION_MINIMUM_LENGTH + \ + EPS_QUALITY_OF_SERVICE_MINIMUM_LENGTH ) + +/* Maximum length macro. Formed by maximum length of each field */ +#define BEARER_RESOURCE_ALLOCATION_REQUEST_MAXIMUM_LENGTH ( \ + TRAFFIC_FLOW_AGGREGATE_DESCRIPTION_MAXIMUM_LENGTH + \ + EPS_QUALITY_OF_SERVICE_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 BEARER_RESOURCE_ALLOCATION_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT (1<<0) + +typedef enum bearer_resource_allocation_request_iei_tag { + BEARER_RESOURCE_ALLOCATION_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI = 0x27, /* 0x27 = 39 */ +} bearer_resource_allocation_request_iei; + +/* + * Message name: Bearer resource allocation request + * Description: This message is sent by the UE to the network to request the allocation of a dedicated bearer resource. See table 8.3.8.1. + * Significance: dual + * Direction: UE to network + */ + +typedef struct bearer_resource_allocation_request_msg_tag { + /* Mandatory fields */ + ProtocolDiscriminator protocoldiscriminator:4; + EpsBearerIdentity epsbeareridentity:4; + ProcedureTransactionIdentity proceduretransactionidentity; + MessageType messagetype; + LinkedEpsBearerIdentity linkedepsbeareridentity; + TrafficFlowAggregateDescription trafficflowaggregate; + EpsQualityOfService requiredtrafficflowqos; + /* Optional fields */ + uint32_t presencemask; + ProtocolConfigurationOptions protocolconfigurationoptions; +} bearer_resource_allocation_request_msg; + +int decode_bearer_resource_allocation_request(bearer_resource_allocation_request_msg *bearerresourceallocationrequest, uint8_t *buffer, uint32_t len); + +int encode_bearer_resource_allocation_request(bearer_resource_allocation_request_msg *bearerresourceallocationrequest, uint8_t *buffer, uint32_t len); + +#endif /* ! defined(BEARER_RESOURCE_ALLOCATION_REQUEST_H_) */ + diff --git a/openair-cn/NAS/COMMON/ESM/MSG/BearerResourceModificationReject.c b/openair-cn/NAS/COMMON/ESM/MSG/BearerResourceModificationReject.c new file mode 100644 index 0000000000..52fbc55b69 --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/BearerResourceModificationReject.c @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#include "TLVEncoder.h" +#include "TLVDecoder.h" +#include "BearerResourceModificationReject.h" + +int decode_bearer_resource_modification_reject(bearer_resource_modification_reject_msg *bearer_resource_modification_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, BEARER_RESOURCE_MODIFICATION_REJECT_MINIMUM_LENGTH, len); + + /* Decoding mandatory fields */ + if ((decoded_result = decode_esm_cause(&bearer_resource_modification_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 BEARER_RESOURCE_MODIFICATION_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI: + if ((decoded_result = + decode_protocol_configuration_options(&bearer_resource_modification_reject->protocolconfigurationoptions, + BEARER_RESOURCE_MODIFICATION_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI, + buffer + decoded, len - decoded)) <= 0) + return decoded_result; + + decoded += decoded_result; + /* Set corresponding mask to 1 in presencemask */ + bearer_resource_modification_reject->presencemask |= BEARER_RESOURCE_MODIFICATION_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; + break; + + default: + errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; + return TLV_DECODE_UNEXPECTED_IEI; + } + } + + return decoded; +} + +int encode_bearer_resource_modification_reject(bearer_resource_modification_reject_msg *bearer_resource_modification_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, BEARER_RESOURCE_MODIFICATION_REJECT_MINIMUM_LENGTH, len); + + if ((encode_result = + encode_esm_cause(&bearer_resource_modification_reject->esmcause, 0, + buffer + encoded, len - encoded)) < 0) //Return in case of error + return encode_result; + else + encoded += encode_result; + + if ((bearer_resource_modification_reject->presencemask & BEARER_RESOURCE_MODIFICATION_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) + == BEARER_RESOURCE_MODIFICATION_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { + if ((encode_result = + encode_protocol_configuration_options(&bearer_resource_modification_reject->protocolconfigurationoptions, + BEARER_RESOURCE_MODIFICATION_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI, + buffer + encoded, len - encoded)) < 0) + // Return in case of error + return encode_result; + else + encoded += encode_result; + } + + return encoded; +} + diff --git a/openair-cn/NAS/COMMON/ESM/MSG/BearerResourceModificationReject.h b/openair-cn/NAS/COMMON/ESM/MSG/BearerResourceModificationReject.h new file mode 100644 index 0000000000..07a9d00e08 --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/BearerResourceModificationReject.h @@ -0,0 +1,85 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "ProtocolDiscriminator.h" +#include "EpsBearerIdentity.h" +#include "ProcedureTransactionIdentity.h" +#include "MessageType.h" +#include "EsmCause.h" +#include "ProtocolConfigurationOptions.h" + +#ifndef BEARER_RESOURCE_MODIFICATION_REJECT_H_ +#define BEARER_RESOURCE_MODIFICATION_REJECT_H_ + +/* Minimum length macro. Formed by minimum length of each mandatory field */ +#define BEARER_RESOURCE_MODIFICATION_REJECT_MINIMUM_LENGTH ( \ + ESM_CAUSE_MINIMUM_LENGTH ) + +/* Maximum length macro. Formed by maximum length of each field */ +#define BEARER_RESOURCE_MODIFICATION_REJECT_MAXIMUM_LENGTH ( \ + ESM_CAUSE_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 BEARER_RESOURCE_MODIFICATION_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT (1<<0) + +typedef enum bearer_resource_modification_reject_iei_tag { + BEARER_RESOURCE_MODIFICATION_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI = 0x27, /* 0x27 = 39 */ +} bearer_resource_modification_reject_iei; + +/* + * Message name: Bearer resource modification reject + * Description: This message is sent by the network to the UE to reject the modification of a dedicated bearer resource. See table 8.3.9.1. + * Significance: dual + * Direction: network to UE + */ + +typedef struct bearer_resource_modification_reject_msg_tag { + /* Mandatory fields */ + ProtocolDiscriminator protocoldiscriminator:4; + EpsBearerIdentity epsbeareridentity:4; + ProcedureTransactionIdentity proceduretransactionidentity; + MessageType messagetype; + EsmCause esmcause; + /* Optional fields */ + uint32_t presencemask; + ProtocolConfigurationOptions protocolconfigurationoptions; +} bearer_resource_modification_reject_msg; + +int decode_bearer_resource_modification_reject(bearer_resource_modification_reject_msg *bearerresourcemodificationreject, uint8_t *buffer, uint32_t len); + +int encode_bearer_resource_modification_reject(bearer_resource_modification_reject_msg *bearerresourcemodificationreject, uint8_t *buffer, uint32_t len); + +#endif /* ! defined(BEARER_RESOURCE_MODIFICATION_REJECT_H_) */ + diff --git a/openair-cn/NAS/COMMON/ESM/MSG/BearerResourceModificationRequest.c b/openair-cn/NAS/COMMON/ESM/MSG/BearerResourceModificationRequest.c new file mode 100644 index 0000000000..a3b821ee47 --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/BearerResourceModificationRequest.c @@ -0,0 +1,168 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#include "TLVEncoder.h" +#include "TLVDecoder.h" +#include "BearerResourceModificationRequest.h" + +int decode_bearer_resource_modification_request(bearer_resource_modification_request_msg *bearer_resource_modification_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, BEARER_RESOURCE_MODIFICATION_REQUEST_MINIMUM_LENGTH, len); + + /* Decoding mandatory fields */ + if ((decoded_result = decode_u8_linked_eps_bearer_identity(&bearer_resource_modification_request->epsbeareridentityforpacketfilter, 0, *(buffer + decoded) >> 4, len - decoded)) < 0) + return decoded_result; + + decoded++; + + if ((decoded_result = decode_traffic_flow_aggregate_description(&bearer_resource_modification_request->trafficflowaggregate, 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 BEARER_RESOURCE_MODIFICATION_REQUEST_REQUIRED_TRAFFIC_FLOW_QOS_IEI: + if ((decoded_result = + decode_eps_quality_of_service(&bearer_resource_modification_request->requiredtrafficflowqos, + BEARER_RESOURCE_MODIFICATION_REQUEST_REQUIRED_TRAFFIC_FLOW_QOS_IEI, + buffer + decoded, len - decoded)) <= 0) + return decoded_result; + + decoded += decoded_result; + /* Set corresponding mask to 1 in presencemask */ + bearer_resource_modification_request->presencemask |= BEARER_RESOURCE_MODIFICATION_REQUEST_REQUIRED_TRAFFIC_FLOW_QOS_PRESENT; + break; + + case BEARER_RESOURCE_MODIFICATION_REQUEST_ESM_CAUSE_IEI: + if ((decoded_result = + decode_esm_cause(&bearer_resource_modification_request->esmcause, + BEARER_RESOURCE_MODIFICATION_REQUEST_ESM_CAUSE_IEI, buffer + + decoded, len - decoded)) <= 0) + return decoded_result; + + decoded += decoded_result; + /* Set corresponding mask to 1 in presencemask */ + bearer_resource_modification_request->presencemask |= BEARER_RESOURCE_MODIFICATION_REQUEST_ESM_CAUSE_PRESENT; + break; + + case BEARER_RESOURCE_MODIFICATION_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI: + if ((decoded_result = + decode_protocol_configuration_options(&bearer_resource_modification_request->protocolconfigurationoptions, + BEARER_RESOURCE_MODIFICATION_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI, + buffer + decoded, len - decoded)) <= 0) + return decoded_result; + + decoded += decoded_result; + /* Set corresponding mask to 1 in presencemask */ + bearer_resource_modification_request->presencemask |= BEARER_RESOURCE_MODIFICATION_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; + break; + + default: + errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; + return TLV_DECODE_UNEXPECTED_IEI; + } + } + + return decoded; +} + +int encode_bearer_resource_modification_request(bearer_resource_modification_request_msg *bearer_resource_modification_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, BEARER_RESOURCE_MODIFICATION_REQUEST_MINIMUM_LENGTH, len); + + *(buffer + encoded) = ((encode_u8_linked_eps_bearer_identity(&bearer_resource_modification_request->epsbeareridentityforpacketfilter) & 0x0f) << 4) | 0x00; + encoded++; + + if ((encode_result = + encode_traffic_flow_aggregate_description(&bearer_resource_modification_request->trafficflowaggregate, + 0, buffer + encoded, len - encoded)) < 0) //Return in case of error + return encode_result; + else + encoded += encode_result; + + if ((bearer_resource_modification_request->presencemask & BEARER_RESOURCE_MODIFICATION_REQUEST_REQUIRED_TRAFFIC_FLOW_QOS_PRESENT) + == BEARER_RESOURCE_MODIFICATION_REQUEST_REQUIRED_TRAFFIC_FLOW_QOS_PRESENT) { + if ((encode_result = + encode_eps_quality_of_service(&bearer_resource_modification_request->requiredtrafficflowqos, + BEARER_RESOURCE_MODIFICATION_REQUEST_REQUIRED_TRAFFIC_FLOW_QOS_IEI, + buffer + encoded, len - encoded)) < 0) + // Return in case of error + return encode_result; + else + encoded += encode_result; + } + + if ((bearer_resource_modification_request->presencemask & BEARER_RESOURCE_MODIFICATION_REQUEST_ESM_CAUSE_PRESENT) + == BEARER_RESOURCE_MODIFICATION_REQUEST_ESM_CAUSE_PRESENT) { + if ((encode_result = + encode_esm_cause(&bearer_resource_modification_request->esmcause, + BEARER_RESOURCE_MODIFICATION_REQUEST_ESM_CAUSE_IEI, buffer + + encoded, len - encoded)) < 0) + // Return in case of error + return encode_result; + else + encoded += encode_result; + } + + if ((bearer_resource_modification_request->presencemask & BEARER_RESOURCE_MODIFICATION_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) + == BEARER_RESOURCE_MODIFICATION_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { + if ((encode_result = + encode_protocol_configuration_options(&bearer_resource_modification_request->protocolconfigurationoptions, + BEARER_RESOURCE_MODIFICATION_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI, + buffer + encoded, len - encoded)) < 0) + // Return in case of error + return encode_result; + else + encoded += encode_result; + } + + return encoded; +} + diff --git a/openair-cn/NAS/COMMON/ESM/MSG/BearerResourceModificationRequest.h b/openair-cn/NAS/COMMON/ESM/MSG/BearerResourceModificationRequest.h new file mode 100644 index 0000000000..f17a89b348 --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/BearerResourceModificationRequest.h @@ -0,0 +1,97 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "ProtocolDiscriminator.h" +#include "EpsBearerIdentity.h" +#include "ProcedureTransactionIdentity.h" +#include "MessageType.h" +#include "LinkedEpsBearerIdentity.h" +#include "TrafficFlowAggregateDescription.h" +#include "EpsQualityOfService.h" +#include "EsmCause.h" +#include "ProtocolConfigurationOptions.h" + +#ifndef BEARER_RESOURCE_MODIFICATION_REQUEST_H_ +#define BEARER_RESOURCE_MODIFICATION_REQUEST_H_ + +/* Minimum length macro. Formed by minimum length of each mandatory field */ +#define BEARER_RESOURCE_MODIFICATION_REQUEST_MINIMUM_LENGTH ( \ + TRAFFIC_FLOW_AGGREGATE_DESCRIPTION_MINIMUM_LENGTH ) + +/* Maximum length macro. Formed by maximum length of each field */ +#define BEARER_RESOURCE_MODIFICATION_REQUEST_MAXIMUM_LENGTH ( \ + TRAFFIC_FLOW_AGGREGATE_DESCRIPTION_MAXIMUM_LENGTH + \ + EPS_QUALITY_OF_SERVICE_MAXIMUM_LENGTH + \ + ESM_CAUSE_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 BEARER_RESOURCE_MODIFICATION_REQUEST_REQUIRED_TRAFFIC_FLOW_QOS_PRESENT (1<<0) +# define BEARER_RESOURCE_MODIFICATION_REQUEST_ESM_CAUSE_PRESENT (1<<1) +# define BEARER_RESOURCE_MODIFICATION_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT (1<<2) + +typedef enum bearer_resource_modification_request_iei_tag { + BEARER_RESOURCE_MODIFICATION_REQUEST_REQUIRED_TRAFFIC_FLOW_QOS_IEI = 0x5B, /* 0x5B = 91 */ + BEARER_RESOURCE_MODIFICATION_REQUEST_ESM_CAUSE_IEI = 0x58, /* 0x58 = 88 */ + BEARER_RESOURCE_MODIFICATION_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI = 0x27, /* 0x27 = 39 */ +} bearer_resource_modification_request_iei; + +/* + * Message name: Bearer resource modification request + * Description: This message is sent by the UE to the network to request the modification of a dedicated bearer resource. See table 8.3.10.1. + * Significance: dual + * Direction: UE to network + */ + +typedef struct bearer_resource_modification_request_msg_tag { + /* Mandatory fields */ + ProtocolDiscriminator protocoldiscriminator:4; + EpsBearerIdentity epsbeareridentity:4; + ProcedureTransactionIdentity proceduretransactionidentity; + MessageType messagetype; + LinkedEpsBearerIdentity epsbeareridentityforpacketfilter; + TrafficFlowAggregateDescription trafficflowaggregate; + /* Optional fields */ + uint32_t presencemask; + EpsQualityOfService requiredtrafficflowqos; + EsmCause esmcause; + ProtocolConfigurationOptions protocolconfigurationoptions; +} bearer_resource_modification_request_msg; + +int decode_bearer_resource_modification_request(bearer_resource_modification_request_msg *bearerresourcemodificationrequest, uint8_t *buffer, uint32_t len); + +int encode_bearer_resource_modification_request(bearer_resource_modification_request_msg *bearerresourcemodificationrequest, uint8_t *buffer, uint32_t len); + +#endif /* ! defined(BEARER_RESOURCE_MODIFICATION_REQUEST_H_) */ + diff --git a/openair-cn/NAS/COMMON/ESM/MSG/COPYING b/openair-cn/NAS/COMMON/ESM/MSG/COPYING new file mode 100644 index 0000000000..94a9ed024d --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/COPYING @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/openair-cn/NAS/COMMON/ESM/MSG/DeactivateEpsBearerContextAccept.c b/openair-cn/NAS/COMMON/ESM/MSG/DeactivateEpsBearerContextAccept.c new file mode 100644 index 0000000000..38383ecc07 --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/DeactivateEpsBearerContextAccept.c @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#include "TLVEncoder.h" +#include "TLVDecoder.h" +#include "DeactivateEpsBearerContextAccept.h" + +int decode_deactivate_eps_bearer_context_accept(deactivate_eps_bearer_context_accept_msg *deactivate_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, DEACTIVATE_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 DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_IEI: + if ((decoded_result = + decode_protocol_configuration_options(&deactivate_eps_bearer_context_accept->protocolconfigurationoptions, + DEACTIVATE_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 */ + deactivate_eps_bearer_context_accept->presencemask |= DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; + break; + + default: + errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; + return TLV_DECODE_UNEXPECTED_IEI; + } + } + + return decoded; +} + +int encode_deactivate_eps_bearer_context_accept(deactivate_eps_bearer_context_accept_msg *deactivate_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, DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT_MINIMUM_LENGTH, len); + + if ((deactivate_eps_bearer_context_accept->presencemask & DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) + == DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { + if ((encode_result = + encode_protocol_configuration_options(&deactivate_eps_bearer_context_accept->protocolconfigurationoptions, + DEACTIVATE_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; +} + diff --git a/openair-cn/NAS/COMMON/ESM/MSG/DeactivateEpsBearerContextAccept.h b/openair-cn/NAS/COMMON/ESM/MSG/DeactivateEpsBearerContextAccept.h new file mode 100644 index 0000000000..0ef58548f5 --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/DeactivateEpsBearerContextAccept.h @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "ProtocolDiscriminator.h" +#include "EpsBearerIdentity.h" +#include "ProcedureTransactionIdentity.h" +#include "MessageType.h" +#include "ProtocolConfigurationOptions.h" + +#ifndef DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT_H_ +#define DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT_H_ + +/* Minimum length macro. Formed by minimum length of each mandatory field */ +#define DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT_MINIMUM_LENGTH (0) + +/* Maximum length macro. Formed by maximum length of each field */ +#define DEACTIVATE_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 DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT (1<<0) + +typedef enum deactivate_eps_bearer_context_accept_iei_tag { + DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_IEI = 0x27, /* 0x27 = 39 */ +} deactivate_eps_bearer_context_accept_iei; + +/* + * Message name: Deactivate EPS bearer context accept + * Description: This message is sent by the UE to acknowledge deactivation of the EPS bearer context requested in the corresponding Deactivate EPS bearer context request message. See table 8.3.11.1. + * Significance: dual + * Direction: UE to network + */ + +typedef struct deactivate_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; +} deactivate_eps_bearer_context_accept_msg; + +int decode_deactivate_eps_bearer_context_accept(deactivate_eps_bearer_context_accept_msg *deactivateepsbearercontextaccept, uint8_t *buffer, uint32_t len); + +int encode_deactivate_eps_bearer_context_accept(deactivate_eps_bearer_context_accept_msg *deactivateepsbearercontextaccept, uint8_t *buffer, uint32_t len); + +#endif /* ! defined(DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT_H_) */ + diff --git a/openair-cn/NAS/COMMON/ESM/MSG/DeactivateEpsBearerContextRequest.c b/openair-cn/NAS/COMMON/ESM/MSG/DeactivateEpsBearerContextRequest.c new file mode 100644 index 0000000000..6030a119a3 --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/DeactivateEpsBearerContextRequest.c @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#include "TLVEncoder.h" +#include "TLVDecoder.h" +#include "DeactivateEpsBearerContextRequest.h" + +int decode_deactivate_eps_bearer_context_request(deactivate_eps_bearer_context_request_msg *deactivate_eps_bearer_context_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, DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_MINIMUM_LENGTH, len); + + /* Decoding mandatory fields */ + if ((decoded_result = decode_esm_cause(&deactivate_eps_bearer_context_request->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 DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI: + if ((decoded_result = + decode_protocol_configuration_options(&deactivate_eps_bearer_context_request->protocolconfigurationoptions, + DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI, + buffer + decoded, len - decoded)) <= 0) + return decoded_result; + + decoded += decoded_result; + /* Set corresponding mask to 1 in presencemask */ + deactivate_eps_bearer_context_request->presencemask |= DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; + break; + + default: + errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; + return TLV_DECODE_UNEXPECTED_IEI; + } + } + + return decoded; +} + +int encode_deactivate_eps_bearer_context_request(deactivate_eps_bearer_context_request_msg *deactivate_eps_bearer_context_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, DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_MINIMUM_LENGTH, len); + + if ((encode_result = + encode_esm_cause(&deactivate_eps_bearer_context_request->esmcause, 0, + buffer + encoded, len - encoded)) < 0) //Return in case of error + return encode_result; + else + encoded += encode_result; + + if ((deactivate_eps_bearer_context_request->presencemask & DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) + == DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { + if ((encode_result = + encode_protocol_configuration_options(&deactivate_eps_bearer_context_request->protocolconfigurationoptions, + DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI, + buffer + encoded, len - encoded)) < 0) + // Return in case of error + return encode_result; + else + encoded += encode_result; + } + + return encoded; +} + diff --git a/openair-cn/NAS/COMMON/ESM/MSG/DeactivateEpsBearerContextRequest.h b/openair-cn/NAS/COMMON/ESM/MSG/DeactivateEpsBearerContextRequest.h new file mode 100644 index 0000000000..b85c5710e8 --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/DeactivateEpsBearerContextRequest.h @@ -0,0 +1,85 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "ProtocolDiscriminator.h" +#include "EpsBearerIdentity.h" +#include "ProcedureTransactionIdentity.h" +#include "MessageType.h" +#include "EsmCause.h" +#include "ProtocolConfigurationOptions.h" + +#ifndef DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_H_ +#define DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_H_ + +/* Minimum length macro. Formed by minimum length of each mandatory field */ +#define DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_MINIMUM_LENGTH ( \ + ESM_CAUSE_MINIMUM_LENGTH ) + +/* Maximum length macro. Formed by maximum length of each field */ +#define DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_MAXIMUM_LENGTH ( \ + ESM_CAUSE_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 DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT (1<<0) + +typedef enum deactivate_eps_bearer_context_request_iei_tag { + DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI = 0x27, /* 0x27 = 39 */ +} deactivate_eps_bearer_context_request_iei; + +/* + * Message name: Deactivate EPS bearer context request + * Description: This message is sent by the network to request deactivation of an active EPS bearer context. See table 8.3.12.1. + * Significance: dual + * Direction: network to UE + */ + +typedef struct deactivate_eps_bearer_context_request_msg_tag { + /* Mandatory fields */ + ProtocolDiscriminator protocoldiscriminator:4; + EpsBearerIdentity epsbeareridentity:4; + ProcedureTransactionIdentity proceduretransactionidentity; + MessageType messagetype; + EsmCause esmcause; + /* Optional fields */ + uint32_t presencemask; + ProtocolConfigurationOptions protocolconfigurationoptions; +} deactivate_eps_bearer_context_request_msg; + +int decode_deactivate_eps_bearer_context_request(deactivate_eps_bearer_context_request_msg *deactivateepsbearercontextrequest, uint8_t *buffer, uint32_t len); + +int encode_deactivate_eps_bearer_context_request(deactivate_eps_bearer_context_request_msg *deactivateepsbearercontextrequest, uint8_t *buffer, uint32_t len); + +#endif /* ! defined(DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_H_) */ + diff --git a/openair-cn/NAS/COMMON/ESM/MSG/EsmInformationRequest.c b/openair-cn/NAS/COMMON/ESM/MSG/EsmInformationRequest.c new file mode 100644 index 0000000000..0f3d22f63f --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/EsmInformationRequest.c @@ -0,0 +1,59 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#include "TLVEncoder.h" +#include "TLVDecoder.h" +#include "EsmInformationRequest.h" + +int decode_esm_information_request(esm_information_request_msg *esm_information_request, 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, ESM_INFORMATION_REQUEST_MINIMUM_LENGTH, len); + + /* Decoding mandatory fields */ + return decoded; +} + +int encode_esm_information_request(esm_information_request_msg *esm_information_request, uint8_t *buffer, uint32_t len) +{ + int encoded = 0; + + /* Checking IEI and pointer */ + CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, ESM_INFORMATION_REQUEST_MINIMUM_LENGTH, len); + + return encoded; +} + diff --git a/openair-cn/NAS/COMMON/ESM/MSG/EsmInformationRequest.h b/openair-cn/NAS/COMMON/ESM/MSG/EsmInformationRequest.h new file mode 100644 index 0000000000..21bf9bc0ca --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/EsmInformationRequest.h @@ -0,0 +1,67 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "ProtocolDiscriminator.h" +#include "EpsBearerIdentity.h" +#include "ProcedureTransactionIdentity.h" +#include "MessageType.h" + +#ifndef ESM_INFORMATION_REQUEST_H_ +#define ESM_INFORMATION_REQUEST_H_ + +/* Minimum length macro. Formed by minimum length of each mandatory field */ +#define ESM_INFORMATION_REQUEST_MINIMUM_LENGTH (0) + +/* Maximum length macro. Formed by maximum length of each field */ +#define ESM_INFORMATION_REQUEST_MAXIMUM_LENGTH (0) + +/* + * Message name: ESM information request + * Description: This message is sent by the network to the UE to request the UE to provide ESM information, i.e. protocol configuration options or APN or both. See table 8.3.13.1. + * Significance: dual + * Direction: network to UE + */ + +typedef struct esm_information_request_msg_tag { + /* Mandatory fields */ + ProtocolDiscriminator protocoldiscriminator:4; + EpsBearerIdentity epsbeareridentity:4; + ProcedureTransactionIdentity proceduretransactionidentity; + MessageType messagetype; +} esm_information_request_msg; + +int decode_esm_information_request(esm_information_request_msg *esminformationrequest, uint8_t *buffer, uint32_t len); + +int encode_esm_information_request(esm_information_request_msg *esminformationrequest, uint8_t *buffer, uint32_t len); + +#endif /* ! defined(ESM_INFORMATION_REQUEST_H_) */ + diff --git a/openair-cn/NAS/COMMON/ESM/MSG/EsmInformationResponse.c b/openair-cn/NAS/COMMON/ESM/MSG/EsmInformationResponse.c new file mode 100644 index 0000000000..1609de75f4 --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/EsmInformationResponse.c @@ -0,0 +1,124 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#include "TLVEncoder.h" +#include "TLVDecoder.h" +#include "EsmInformationResponse.h" + +int decode_esm_information_response(esm_information_response_msg *esm_information_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, ESM_INFORMATION_RESPONSE_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 ESM_INFORMATION_RESPONSE_ACCESS_POINT_NAME_IEI: + if ((decoded_result = + decode_access_point_name(&esm_information_response->accesspointname, + ESM_INFORMATION_RESPONSE_ACCESS_POINT_NAME_IEI, buffer + + decoded, len - decoded)) <= 0) + return decoded_result; + + decoded += decoded_result; + /* Set corresponding mask to 1 in presencemask */ + esm_information_response->presencemask |= ESM_INFORMATION_RESPONSE_ACCESS_POINT_NAME_PRESENT; + break; + + case ESM_INFORMATION_RESPONSE_PROTOCOL_CONFIGURATION_OPTIONS_IEI: + if ((decoded_result = + decode_protocol_configuration_options(&esm_information_response->protocolconfigurationoptions, + ESM_INFORMATION_RESPONSE_PROTOCOL_CONFIGURATION_OPTIONS_IEI, + buffer + decoded, len - decoded)) <= 0) + return decoded_result; + + decoded += decoded_result; + /* Set corresponding mask to 1 in presencemask */ + esm_information_response->presencemask |= ESM_INFORMATION_RESPONSE_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; + break; + + default: + errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; + return TLV_DECODE_UNEXPECTED_IEI; + } + } + + return decoded; +} + +int encode_esm_information_response(esm_information_response_msg *esm_information_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, ESM_INFORMATION_RESPONSE_MINIMUM_LENGTH, len); + + if ((esm_information_response->presencemask & ESM_INFORMATION_RESPONSE_ACCESS_POINT_NAME_PRESENT) + == ESM_INFORMATION_RESPONSE_ACCESS_POINT_NAME_PRESENT) { + if ((encode_result = + encode_access_point_name(&esm_information_response->accesspointname, + ESM_INFORMATION_RESPONSE_ACCESS_POINT_NAME_IEI, buffer + encoded, + len - encoded)) < 0) + // Return in case of error + return encode_result; + else + encoded += encode_result; + } + + if ((esm_information_response->presencemask & ESM_INFORMATION_RESPONSE_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) + == ESM_INFORMATION_RESPONSE_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { + if ((encode_result = + encode_protocol_configuration_options(&esm_information_response->protocolconfigurationoptions, + ESM_INFORMATION_RESPONSE_PROTOCOL_CONFIGURATION_OPTIONS_IEI, + buffer + encoded, len - encoded)) < 0) + // Return in case of error + return encode_result; + else + encoded += encode_result; + } + + return encoded; +} + diff --git a/openair-cn/NAS/COMMON/ESM/MSG/EsmInformationResponse.h b/openair-cn/NAS/COMMON/ESM/MSG/EsmInformationResponse.h new file mode 100644 index 0000000000..186c582e91 --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/EsmInformationResponse.h @@ -0,0 +1,86 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "ProtocolDiscriminator.h" +#include "EpsBearerIdentity.h" +#include "ProcedureTransactionIdentity.h" +#include "MessageType.h" +#include "AccessPointName.h" +#include "ProtocolConfigurationOptions.h" + +#ifndef ESM_INFORMATION_RESPONSE_H_ +#define ESM_INFORMATION_RESPONSE_H_ + +/* Minimum length macro. Formed by minimum length of each mandatory field */ +#define ESM_INFORMATION_RESPONSE_MINIMUM_LENGTH (0) + +/* Maximum length macro. Formed by maximum length of each field */ +#define ESM_INFORMATION_RESPONSE_MAXIMUM_LENGTH ( \ + ACCESS_POINT_NAME_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 ESM_INFORMATION_RESPONSE_ACCESS_POINT_NAME_PRESENT (1<<0) +# define ESM_INFORMATION_RESPONSE_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT (1<<1) + +typedef enum esm_information_response_iei_tag { + ESM_INFORMATION_RESPONSE_ACCESS_POINT_NAME_IEI = 0x28, /* 0x28 = 40 */ + ESM_INFORMATION_RESPONSE_PROTOCOL_CONFIGURATION_OPTIONS_IEI = 0x27, /* 0x27 = 39 */ +} esm_information_response_iei; + +/* + * Message name: ESM information response + * Description: This message is sent by the UE to the network in response to an ESM INFORMATION REQUEST message and provides the requested ESM information. See table 8.3.14.1. + * Significance: dual + * Direction: UE to network + */ + +typedef struct esm_information_response_msg_tag { + /* Mandatory fields */ + ProtocolDiscriminator protocoldiscriminator:4; + EpsBearerIdentity epsbeareridentity:4; + ProcedureTransactionIdentity proceduretransactionidentity; + MessageType messagetype; + /* Optional fields */ + uint32_t presencemask; + AccessPointName accesspointname; + ProtocolConfigurationOptions protocolconfigurationoptions; +} esm_information_response_msg; + +int decode_esm_information_response(esm_information_response_msg *esminformationresponse, uint8_t *buffer, uint32_t len); + +int encode_esm_information_response(esm_information_response_msg *esminformationresponse, uint8_t *buffer, uint32_t len); + +#endif /* ! defined(ESM_INFORMATION_RESPONSE_H_) */ + diff --git a/openair-cn/NAS/COMMON/ESM/MSG/EsmStatus.c b/openair-cn/NAS/COMMON/ESM/MSG/EsmStatus.c new file mode 100644 index 0000000000..0297b0eecd --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/EsmStatus.c @@ -0,0 +1,72 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#include "TLVEncoder.h" +#include "TLVDecoder.h" +#include "EsmStatus.h" + +int decode_esm_status(esm_status_msg *esm_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, ESM_STATUS_MINIMUM_LENGTH, len); + + /* Decoding mandatory fields */ + if ((decoded_result = decode_esm_cause(&esm_status->esmcause, 0, buffer + decoded, len - decoded)) < 0) + return decoded_result; + else + decoded += decoded_result; + + return decoded; +} + +int encode_esm_status(esm_status_msg *esm_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, ESM_STATUS_MINIMUM_LENGTH, len); + + if ((encode_result = encode_esm_cause(&esm_status->esmcause, 0, buffer + + encoded, len - encoded)) < 0) //Return in case of error + return encode_result; + else + encoded += encode_result; + + return encoded; +} + diff --git a/openair-cn/NAS/COMMON/ESM/MSG/EsmStatus.h b/openair-cn/NAS/COMMON/ESM/MSG/EsmStatus.h new file mode 100644 index 0000000000..5bbce9e06d --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/EsmStatus.h @@ -0,0 +1,72 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "ProtocolDiscriminator.h" +#include "EpsBearerIdentity.h" +#include "ProcedureTransactionIdentity.h" +#include "MessageType.h" +#include "EsmCause.h" + +#ifndef ESM_STATUS_H_ +#define ESM_STATUS_H_ + +/* Minimum length macro. Formed by minimum length of each mandatory field */ +#define ESM_STATUS_MINIMUM_LENGTH ( \ + ESM_CAUSE_MINIMUM_LENGTH ) + +/* Maximum length macro. Formed by maximum length of each field */ +#define ESM_STATUS_MAXIMUM_LENGTH ( \ + ESM_CAUSE_MAXIMUM_LENGTH ) + + +/* + * Message name: ESM status + * Description: This message is sent by the network or the UE to pass information on the status of the indicated EPS bearer context and report certain error conditions (e.g. as listed in clause 7). See table 8.3.15.1. + * Significance: dual + * Direction: both + */ + +typedef struct esm_status_msg_tag { + /* Mandatory fields */ + ProtocolDiscriminator protocoldiscriminator:4; + EpsBearerIdentity epsbeareridentity:4; + ProcedureTransactionIdentity proceduretransactionidentity; + MessageType messagetype; + EsmCause esmcause; +} esm_status_msg; + +int decode_esm_status(esm_status_msg *esmstatus, uint8_t *buffer, uint32_t len); + +int encode_esm_status(esm_status_msg *esmstatus, uint8_t *buffer, uint32_t len); + +#endif /* ! defined(ESM_STATUS_H_) */ + diff --git a/openair-cn/NAS/COMMON/ESM/MSG/Makefile b/openair-cn/NAS/COMMON/ESM/MSG/Makefile new file mode 100644 index 0000000000..8786e88c13 --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/Makefile @@ -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 . +# +# 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 = $(LIBESMMSG) +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. diff --git a/openair-cn/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextAccept.c b/openair-cn/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextAccept.c new file mode 100644 index 0000000000..b7da151edb --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextAccept.c @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#include "TLVEncoder.h" +#include "TLVDecoder.h" +#include "ModifyEpsBearerContextAccept.h" + +int decode_modify_eps_bearer_context_accept(modify_eps_bearer_context_accept_msg *modify_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, MODIFY_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 MODIFY_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_IEI: + if ((decoded_result = + decode_protocol_configuration_options(&modify_eps_bearer_context_accept->protocolconfigurationoptions, + MODIFY_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 */ + modify_eps_bearer_context_accept->presencemask |= MODIFY_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; + break; + + default: + errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; + return TLV_DECODE_UNEXPECTED_IEI; + } + } + + return decoded; +} + +int encode_modify_eps_bearer_context_accept(modify_eps_bearer_context_accept_msg *modify_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, MODIFY_EPS_BEARER_CONTEXT_ACCEPT_MINIMUM_LENGTH, len); + + if ((modify_eps_bearer_context_accept->presencemask & MODIFY_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) + == MODIFY_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { + if ((encode_result = + encode_protocol_configuration_options(&modify_eps_bearer_context_accept->protocolconfigurationoptions, + MODIFY_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; +} + diff --git a/openair-cn/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextAccept.h b/openair-cn/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextAccept.h new file mode 100644 index 0000000000..e80a7f8dbc --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextAccept.h @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "ProtocolDiscriminator.h" +#include "EpsBearerIdentity.h" +#include "ProcedureTransactionIdentity.h" +#include "MessageType.h" +#include "ProtocolConfigurationOptions.h" + +#ifndef MODIFY_EPS_BEARER_CONTEXT_ACCEPT_H_ +#define MODIFY_EPS_BEARER_CONTEXT_ACCEPT_H_ + +/* Minimum length macro. Formed by minimum length of each mandatory field */ +#define MODIFY_EPS_BEARER_CONTEXT_ACCEPT_MINIMUM_LENGTH (0) + +/* Maximum length macro. Formed by maximum length of each field */ +#define MODIFY_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 MODIFY_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT (1<<0) + +typedef enum modify_eps_bearer_context_accept_iei_tag { + MODIFY_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_IEI = 0x27, /* 0x27 = 39 */ +} modify_eps_bearer_context_accept_iei; + +/* + * Message name: Modify EPS bearer context accept + * Description: This message is sent by the UE to the network to acknowledge the modification of an active EPS bearer context. See table 8.3.16.1. + * Significance: dual + * Direction: UE to network + */ + +typedef struct modify_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; +} modify_eps_bearer_context_accept_msg; + +int decode_modify_eps_bearer_context_accept(modify_eps_bearer_context_accept_msg *modifyepsbearercontextaccept, uint8_t *buffer, uint32_t len); + +int encode_modify_eps_bearer_context_accept(modify_eps_bearer_context_accept_msg *modifyepsbearercontextaccept, uint8_t *buffer, uint32_t len); + +#endif /* ! defined(MODIFY_EPS_BEARER_CONTEXT_ACCEPT_H_) */ + diff --git a/openair-cn/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextReject.c b/openair-cn/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextReject.c new file mode 100644 index 0000000000..c3b216bb24 --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextReject.c @@ -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 . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#include "TLVEncoder.h" +#include "TLVDecoder.h" +#include "ModifyEpsBearerContextReject.h" + +int decode_modify_eps_bearer_context_reject(modify_eps_bearer_context_reject_msg *modify_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, MODIFY_EPS_BEARER_CONTEXT_REJECT_MINIMUM_LENGTH, len); + + /* Decoding mandatory fields */ + if ((decoded_result = decode_esm_cause(&modify_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 MODIFY_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI: + if ((decoded_result = + decode_protocol_configuration_options(&modify_eps_bearer_context_reject->protocolconfigurationoptions, + MODIFY_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 */ + modify_eps_bearer_context_reject->presencemask |= MODIFY_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; + break; + + default: + errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; + return TLV_DECODE_UNEXPECTED_IEI; + } + } + + return decoded; +} + +int encode_modify_eps_bearer_context_reject(modify_eps_bearer_context_reject_msg *modify_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, MODIFY_EPS_BEARER_CONTEXT_REJECT_MINIMUM_LENGTH, len); + + if ((encode_result = + encode_esm_cause(&modify_eps_bearer_context_reject->esmcause, 0, + buffer + encoded, len - encoded)) < 0) //Return in case of error + return encode_result; + else + encoded += encode_result; + + if ((modify_eps_bearer_context_reject->presencemask & MODIFY_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) + == MODIFY_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { + if ((encode_result = + encode_protocol_configuration_options(&modify_eps_bearer_context_reject->protocolconfigurationoptions, + MODIFY_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; +} + diff --git a/openair-cn/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextReject.h b/openair-cn/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextReject.h new file mode 100644 index 0000000000..2c023c914b --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextReject.h @@ -0,0 +1,85 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "ProtocolDiscriminator.h" +#include "EpsBearerIdentity.h" +#include "ProcedureTransactionIdentity.h" +#include "MessageType.h" +#include "EsmCause.h" +#include "ProtocolConfigurationOptions.h" + +#ifndef MODIFY_EPS_BEARER_CONTEXT_REJECT_H_ +#define MODIFY_EPS_BEARER_CONTEXT_REJECT_H_ + +/* Minimum length macro. Formed by minimum length of each mandatory field */ +#define MODIFY_EPS_BEARER_CONTEXT_REJECT_MINIMUM_LENGTH ( \ + ESM_CAUSE_MINIMUM_LENGTH ) + +/* Maximum length macro. Formed by maximum length of each field */ +#define MODIFY_EPS_BEARER_CONTEXT_REJECT_MAXIMUM_LENGTH ( \ + ESM_CAUSE_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 MODIFY_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT (1<<0) + +typedef enum modify_eps_bearer_context_reject_iei_tag { + MODIFY_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI = 0x27, /* 0x27 = 39 */ +} modify_eps_bearer_context_reject_iei; + +/* + * Message name: Modify EPS bearer context reject + * Description: This message is sent by the UE or the network to reject a modification of an active EPS bearer context. See table 8.3.17.1. + * Significance: dual + * Direction: UE to network + */ + +typedef struct modify_eps_bearer_context_reject_msg_tag { + /* Mandatory fields */ + ProtocolDiscriminator protocoldiscriminator:4; + EpsBearerIdentity epsbeareridentity:4; + ProcedureTransactionIdentity proceduretransactionidentity; + MessageType messagetype; + EsmCause esmcause; + /* Optional fields */ + uint32_t presencemask; + ProtocolConfigurationOptions protocolconfigurationoptions; +} modify_eps_bearer_context_reject_msg; + +int decode_modify_eps_bearer_context_reject(modify_eps_bearer_context_reject_msg *modifyepsbearercontextreject, uint8_t *buffer, uint32_t len); + +int encode_modify_eps_bearer_context_reject(modify_eps_bearer_context_reject_msg *modifyepsbearercontextreject, uint8_t *buffer, uint32_t len); + +#endif /* ! defined(MODIFY_EPS_BEARER_CONTEXT_REJECT_H_) */ + diff --git a/openair-cn/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextRequest.c b/openair-cn/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextRequest.c new file mode 100644 index 0000000000..62e7fc8a22 --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextRequest.c @@ -0,0 +1,268 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#include "TLVEncoder.h" +#include "TLVDecoder.h" +#include "ModifyEpsBearerContextRequest.h" + +int decode_modify_eps_bearer_context_request(modify_eps_bearer_context_request_msg *modify_eps_bearer_context_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, MODIFY_EPS_BEARER_CONTEXT_REQUEST_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 MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEW_EPS_QOS_IEI: + if ((decoded_result = + decode_eps_quality_of_service(&modify_eps_bearer_context_request->newepsqos, + MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEW_EPS_QOS_IEI, buffer + + decoded, len - decoded)) <= 0) + return decoded_result; + + decoded += decoded_result; + /* Set corresponding mask to 1 in presencemask */ + modify_eps_bearer_context_request->presencemask |= MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEW_EPS_QOS_PRESENT; + break; + + case MODIFY_EPS_BEARER_CONTEXT_REQUEST_TFT_IEI: + if ((decoded_result = + decode_traffic_flow_template(&modify_eps_bearer_context_request->tft, + MODIFY_EPS_BEARER_CONTEXT_REQUEST_TFT_IEI, buffer + + decoded, len - decoded)) <= 0) + return decoded_result; + + decoded += decoded_result; + /* Set corresponding mask to 1 in presencemask */ + modify_eps_bearer_context_request->presencemask |= MODIFY_EPS_BEARER_CONTEXT_REQUEST_TFT_PRESENT; + break; + + case MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEW_QOS_IEI: + if ((decoded_result = + decode_quality_of_service(&modify_eps_bearer_context_request->newqos, + MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEW_QOS_IEI, buffer + + decoded, len - decoded)) <= 0) + return decoded_result; + + decoded += decoded_result; + /* Set corresponding mask to 1 in presencemask */ + modify_eps_bearer_context_request->presencemask |= MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEW_QOS_PRESENT; + break; + + case MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_IEI: + if ((decoded_result = + decode_llc_service_access_point_identifier(&modify_eps_bearer_context_request->negotiatedllcsapi, + MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_IEI, + buffer + decoded, len - decoded)) <= 0) + return decoded_result; + + decoded += decoded_result; + /* Set corresponding mask to 1 in presencemask */ + modify_eps_bearer_context_request->presencemask |= MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_PRESENT; + break; + + case MODIFY_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_IEI: + if ((decoded_result = + decode_radio_priority(&modify_eps_bearer_context_request->radiopriority, + MODIFY_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_IEI, + buffer + decoded, len - decoded)) <= 0) + return decoded_result; + + decoded += decoded_result; + /* Set corresponding mask to 1 in presencemask */ + modify_eps_bearer_context_request->presencemask |= MODIFY_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_PRESENT; + break; + + case MODIFY_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_IEI: + if ((decoded_result = + decode_packet_flow_identifier(&modify_eps_bearer_context_request->packetflowidentifier, + MODIFY_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_IEI, + buffer + decoded, len - decoded)) <= 0) + return decoded_result; + + decoded += decoded_result; + /* Set corresponding mask to 1 in presencemask */ + modify_eps_bearer_context_request->presencemask |= MODIFY_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_PRESENT; + break; + + case MODIFY_EPS_BEARER_CONTEXT_REQUEST_APNAMBR_IEI: + if ((decoded_result = + decode_apn_aggregate_maximum_bit_rate(&modify_eps_bearer_context_request->apnambr, + MODIFY_EPS_BEARER_CONTEXT_REQUEST_APNAMBR_IEI, buffer + + decoded, len - decoded)) <= 0) + return decoded_result; + + decoded += decoded_result; + /* Set corresponding mask to 1 in presencemask */ + modify_eps_bearer_context_request->presencemask |= MODIFY_EPS_BEARER_CONTEXT_REQUEST_APNAMBR_PRESENT; + break; + + case MODIFY_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI: + if ((decoded_result = + decode_protocol_configuration_options(&modify_eps_bearer_context_request->protocolconfigurationoptions, + MODIFY_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI, + buffer + decoded, len - decoded)) <= 0) + return decoded_result; + + decoded += decoded_result; + /* Set corresponding mask to 1 in presencemask */ + modify_eps_bearer_context_request->presencemask |= MODIFY_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; + break; + + default: + errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; + return TLV_DECODE_UNEXPECTED_IEI; + } + } + + return decoded; +} + +int encode_modify_eps_bearer_context_request(modify_eps_bearer_context_request_msg *modify_eps_bearer_context_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, MODIFY_EPS_BEARER_CONTEXT_REQUEST_MINIMUM_LENGTH, len); + + if ((modify_eps_bearer_context_request->presencemask & MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEW_EPS_QOS_PRESENT) + == MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEW_EPS_QOS_PRESENT) { + if ((encode_result = + encode_eps_quality_of_service(&modify_eps_bearer_context_request->newepsqos, + MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEW_EPS_QOS_IEI, buffer + + encoded, len - encoded)) < 0) + // Return in case of error + return encode_result; + else + encoded += encode_result; + } + + if ((modify_eps_bearer_context_request->presencemask & MODIFY_EPS_BEARER_CONTEXT_REQUEST_TFT_PRESENT) + == MODIFY_EPS_BEARER_CONTEXT_REQUEST_TFT_PRESENT) { + if ((encode_result = + encode_traffic_flow_template(&modify_eps_bearer_context_request->tft, + MODIFY_EPS_BEARER_CONTEXT_REQUEST_TFT_IEI, buffer + encoded, len - + encoded)) < 0) + // Return in case of error + return encode_result; + else + encoded += encode_result; + } + + if ((modify_eps_bearer_context_request->presencemask & MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEW_QOS_PRESENT) + == MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEW_QOS_PRESENT) { + if ((encode_result = + encode_quality_of_service(&modify_eps_bearer_context_request->newqos, + MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEW_QOS_IEI, buffer + encoded, + len - encoded)) < 0) + // Return in case of error + return encode_result; + else + encoded += encode_result; + } + + if ((modify_eps_bearer_context_request->presencemask & MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_PRESENT) + == MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_PRESENT) { + if ((encode_result = + encode_llc_service_access_point_identifier(&modify_eps_bearer_context_request->negotiatedllcsapi, + MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_IEI, buffer + + encoded, len - encoded)) < 0) + // Return in case of error + return encode_result; + else + encoded += encode_result; + } + + if ((modify_eps_bearer_context_request->presencemask & MODIFY_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_PRESENT) + == MODIFY_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_PRESENT) { + if ((encode_result = + encode_radio_priority(&modify_eps_bearer_context_request->radiopriority, + MODIFY_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_IEI, buffer + + encoded, len - encoded)) < 0) + // Return in case of error + return encode_result; + else + encoded += encode_result; + } + + if ((modify_eps_bearer_context_request->presencemask & MODIFY_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_PRESENT) + == MODIFY_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_PRESENT) { + if ((encode_result = + encode_packet_flow_identifier(&modify_eps_bearer_context_request->packetflowidentifier, + MODIFY_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_IEI, + buffer + encoded, len - encoded)) < 0) + // Return in case of error + return encode_result; + else + encoded += encode_result; + } + + if ((modify_eps_bearer_context_request->presencemask & MODIFY_EPS_BEARER_CONTEXT_REQUEST_APNAMBR_PRESENT) + == MODIFY_EPS_BEARER_CONTEXT_REQUEST_APNAMBR_PRESENT) { + if ((encode_result = + encode_apn_aggregate_maximum_bit_rate(&modify_eps_bearer_context_request->apnambr, + MODIFY_EPS_BEARER_CONTEXT_REQUEST_APNAMBR_IEI, buffer + encoded, + len - encoded)) < 0) + // Return in case of error + return encode_result; + else + encoded += encode_result; + } + + if ((modify_eps_bearer_context_request->presencemask & MODIFY_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) + == MODIFY_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { + if ((encode_result = + encode_protocol_configuration_options(&modify_eps_bearer_context_request->protocolconfigurationoptions, + MODIFY_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI, + buffer + encoded, len - encoded)) < 0) + // Return in case of error + return encode_result; + else + encoded += encode_result; + } + + return encoded; +} + diff --git a/openair-cn/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextRequest.h b/openair-cn/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextRequest.h new file mode 100644 index 0000000000..1c2f24950c --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextRequest.h @@ -0,0 +1,116 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "ProtocolDiscriminator.h" +#include "EpsBearerIdentity.h" +#include "ProcedureTransactionIdentity.h" +#include "MessageType.h" +#include "EpsQualityOfService.h" +#include "TrafficFlowTemplate.h" +#include "QualityOfService.h" +#include "LlcServiceAccessPointIdentifier.h" +#include "RadioPriority.h" +#include "PacketFlowIdentifier.h" +#include "ApnAggregateMaximumBitRate.h" +#include "ProtocolConfigurationOptions.h" + +#ifndef MODIFY_EPS_BEARER_CONTEXT_REQUEST_H_ +#define MODIFY_EPS_BEARER_CONTEXT_REQUEST_H_ + +/* Minimum length macro. Formed by minimum length of each mandatory field */ +#define MODIFY_EPS_BEARER_CONTEXT_REQUEST_MINIMUM_LENGTH (0) + +/* Maximum length macro. Formed by maximum length of each field */ +#define MODIFY_EPS_BEARER_CONTEXT_REQUEST_MAXIMUM_LENGTH ( \ + EPS_QUALITY_OF_SERVICE_MAXIMUM_LENGTH + \ + TRAFFIC_FLOW_TEMPLATE_MAXIMUM_LENGTH + \ + QUALITY_OF_SERVICE_MAXIMUM_LENGTH + \ + LLC_SERVICE_ACCESS_POINT_IDENTIFIER_MAXIMUM_LENGTH + \ + RADIO_PRIORITY_MAXIMUM_LENGTH + \ + PACKET_FLOW_IDENTIFIER_MAXIMUM_LENGTH + \ + APN_AGGREGATE_MAXIMUM_BIT_RATE_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 MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEW_EPS_QOS_PRESENT (1<<0) +# define MODIFY_EPS_BEARER_CONTEXT_REQUEST_TFT_PRESENT (1<<1) +# define MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEW_QOS_PRESENT (1<<2) +# define MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_PRESENT (1<<3) +# define MODIFY_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_PRESENT (1<<4) +# define MODIFY_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_PRESENT (1<<5) +# define MODIFY_EPS_BEARER_CONTEXT_REQUEST_APNAMBR_PRESENT (1<<6) +# define MODIFY_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT (1<<7) + +typedef enum modify_eps_bearer_context_request_iei_tag { + MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEW_EPS_QOS_IEI = 0x5B, /* 0x5B = 91 */ + MODIFY_EPS_BEARER_CONTEXT_REQUEST_TFT_IEI = 0x36, /* 0x36 = 54 */ + MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEW_QOS_IEI = 0x30, /* 0x30 = 48 */ + MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_IEI = 0x32, /* 0x32 = 50 */ + MODIFY_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_IEI = 0x80, /* 0x80 = 128 */ + MODIFY_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_IEI = 0x34, /* 0x34 = 52 */ + MODIFY_EPS_BEARER_CONTEXT_REQUEST_APNAMBR_IEI = 0x5E, /* 0x5E = 94 */ + MODIFY_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI = 0x27, /* 0x27 = 39 */ +} modify_eps_bearer_context_request_iei; + +/* + * Message name: Modify EPS bearer context request + * Description: This message is sent by the network to the UE to request modification of an active EPS bearer context. See table 8.3.18.1. + * Significance: dual + * Direction: network to UE + */ + +typedef struct modify_eps_bearer_context_request_msg_tag { + /* Mandatory fields */ + ProtocolDiscriminator protocoldiscriminator:4; + EpsBearerIdentity epsbeareridentity:4; + ProcedureTransactionIdentity proceduretransactionidentity; + MessageType messagetype; + /* Optional fields */ + uint32_t presencemask; + EpsQualityOfService newepsqos; + TrafficFlowTemplate tft; + QualityOfService newqos; + LlcServiceAccessPointIdentifier negotiatedllcsapi; + RadioPriority radiopriority; + PacketFlowIdentifier packetflowidentifier; + ApnAggregateMaximumBitRate apnambr; + ProtocolConfigurationOptions protocolconfigurationoptions; +} modify_eps_bearer_context_request_msg; + +int decode_modify_eps_bearer_context_request(modify_eps_bearer_context_request_msg *modifyepsbearercontextrequest, uint8_t *buffer, uint32_t len); + +int encode_modify_eps_bearer_context_request(modify_eps_bearer_context_request_msg *modifyepsbearercontextrequest, uint8_t *buffer, uint32_t len); + +#endif /* ! defined(MODIFY_EPS_BEARER_CONTEXT_REQUEST_H_) */ + diff --git a/openair-cn/NAS/COMMON/ESM/MSG/PdnConnectivityReject.c b/openair-cn/NAS/COMMON/ESM/MSG/PdnConnectivityReject.c new file mode 100644 index 0000000000..6d08e046cc --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/PdnConnectivityReject.c @@ -0,0 +1,111 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#include "TLVEncoder.h" +#include "TLVDecoder.h" +#include "PdnConnectivityReject.h" + +int decode_pdn_connectivity_reject(pdn_connectivity_reject_msg *pdn_connectivity_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, PDN_CONNECTIVITY_REJECT_MINIMUM_LENGTH, len); + + /* Decoding mandatory fields */ + if ((decoded_result = decode_esm_cause(&pdn_connectivity_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 PDN_CONNECTIVITY_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI: + if ((decoded_result = + decode_protocol_configuration_options(&pdn_connectivity_reject->protocolconfigurationoptions, + PDN_CONNECTIVITY_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI, + buffer + decoded, len - decoded)) <= 0) + return decoded_result; + + decoded += decoded_result; + /* Set corresponding mask to 1 in presencemask */ + pdn_connectivity_reject->presencemask |= PDN_CONNECTIVITY_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; + break; + + default: + errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; + return TLV_DECODE_UNEXPECTED_IEI; + } + } + + return decoded; +} + +int encode_pdn_connectivity_reject(pdn_connectivity_reject_msg *pdn_connectivity_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, PDN_CONNECTIVITY_REJECT_MINIMUM_LENGTH, len); + + if ((encode_result = encode_esm_cause(&pdn_connectivity_reject->esmcause, 0, + buffer + encoded, len - encoded)) < 0) //Return in case of error + return encode_result; + else + encoded += encode_result; + + if ((pdn_connectivity_reject->presencemask & PDN_CONNECTIVITY_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) + == PDN_CONNECTIVITY_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { + if ((encode_result = + encode_protocol_configuration_options(&pdn_connectivity_reject->protocolconfigurationoptions, + PDN_CONNECTIVITY_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI, buffer + + encoded, len - encoded)) < 0) + // Return in case of error + return encode_result; + else + encoded += encode_result; + } + + return encoded; +} + diff --git a/openair-cn/NAS/COMMON/ESM/MSG/PdnConnectivityReject.h b/openair-cn/NAS/COMMON/ESM/MSG/PdnConnectivityReject.h new file mode 100644 index 0000000000..9712f2118c --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/PdnConnectivityReject.h @@ -0,0 +1,85 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "ProtocolDiscriminator.h" +#include "EpsBearerIdentity.h" +#include "ProcedureTransactionIdentity.h" +#include "MessageType.h" +#include "EsmCause.h" +#include "ProtocolConfigurationOptions.h" + +#ifndef PDN_CONNECTIVITY_REJECT_H_ +#define PDN_CONNECTIVITY_REJECT_H_ + +/* Minimum length macro. Formed by minimum length of each mandatory field */ +#define PDN_CONNECTIVITY_REJECT_MINIMUM_LENGTH ( \ + ESM_CAUSE_MINIMUM_LENGTH ) + +/* Maximum length macro. Formed by maximum length of each field */ +#define PDN_CONNECTIVITY_REJECT_MAXIMUM_LENGTH ( \ + ESM_CAUSE_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 PDN_CONNECTIVITY_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT (1<<0) + +typedef enum pdn_connectivity_reject_iei_tag { + PDN_CONNECTIVITY_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI = 0x27, /* 0x27 = 39 */ +} pdn_connectivity_reject_iei; + +/* + * Message name: PDN connectivity reject + * Description: This message is sent by the network to the UE to reject establishment of a PDN connection. See table 8.3.19.1. + * Significance: dual + * Direction: network to UE + */ + +typedef struct pdn_connectivity_reject_msg_tag { + /* Mandatory fields */ + ProtocolDiscriminator protocoldiscriminator:4; + EpsBearerIdentity epsbeareridentity:4; + ProcedureTransactionIdentity proceduretransactionidentity; + MessageType messagetype; + EsmCause esmcause; + /* Optional fields */ + uint32_t presencemask; + ProtocolConfigurationOptions protocolconfigurationoptions; +} pdn_connectivity_reject_msg; + +int decode_pdn_connectivity_reject(pdn_connectivity_reject_msg *pdnconnectivityreject, uint8_t *buffer, uint32_t len); + +int encode_pdn_connectivity_reject(pdn_connectivity_reject_msg *pdnconnectivityreject, uint8_t *buffer, uint32_t len); + +#endif /* ! defined(PDN_CONNECTIVITY_REJECT_H_) */ + diff --git a/openair-cn/NAS/COMMON/ESM/MSG/PdnConnectivityRequest.c b/openair-cn/NAS/COMMON/ESM/MSG/PdnConnectivityRequest.c new file mode 100644 index 0000000000..6ff9acab12 --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/PdnConnectivityRequest.c @@ -0,0 +1,159 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#include "TLVEncoder.h" +#include "TLVDecoder.h" +#include "PdnConnectivityRequest.h" + +int decode_pdn_connectivity_request(pdn_connectivity_request_msg *pdn_connectivity_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, PDN_CONNECTIVITY_REQUEST_MINIMUM_LENGTH, len); + + /* Decoding mandatory fields */ + if ((decoded_result = decode_u8_request_type(&pdn_connectivity_request->pdntype, 0, *(buffer + decoded) >> 4, len - decoded)) < 0) + return decoded_result; + + if ((decoded_result = decode_u8_pdn_type(&pdn_connectivity_request->requesttype, 0, *(buffer + decoded) & 0x0f, 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 PDN_CONNECTIVITY_REQUEST_ESM_INFORMATION_TRANSFER_FLAG_IEI: + if ((decoded_result = + decode_esm_information_transfer_flag(&pdn_connectivity_request->esminformationtransferflag, + PDN_CONNECTIVITY_REQUEST_ESM_INFORMATION_TRANSFER_FLAG_IEI, + buffer + decoded, len - decoded)) <= 0) + return decoded_result; + + decoded += decoded_result; + /* Set corresponding mask to 1 in presencemask */ + pdn_connectivity_request->presencemask |= PDN_CONNECTIVITY_REQUEST_ESM_INFORMATION_TRANSFER_FLAG_PRESENT; + break; + + case PDN_CONNECTIVITY_REQUEST_ACCESS_POINT_NAME_IEI: + if ((decoded_result = + decode_access_point_name(&pdn_connectivity_request->accesspointname, + PDN_CONNECTIVITY_REQUEST_ACCESS_POINT_NAME_IEI, buffer + + decoded, len - decoded)) <= 0) + return decoded_result; + + decoded += decoded_result; + /* Set corresponding mask to 1 in presencemask */ + pdn_connectivity_request->presencemask |= PDN_CONNECTIVITY_REQUEST_ACCESS_POINT_NAME_PRESENT; + break; + + case PDN_CONNECTIVITY_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI: + if ((decoded_result = + decode_protocol_configuration_options(&pdn_connectivity_request->protocolconfigurationoptions, + PDN_CONNECTIVITY_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI, + buffer + decoded, len - decoded)) <= 0) + return decoded_result; + + decoded += decoded_result; + /* Set corresponding mask to 1 in presencemask */ + pdn_connectivity_request->presencemask |= PDN_CONNECTIVITY_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; + break; + + default: + errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; + return TLV_DECODE_UNEXPECTED_IEI; + } + } + + return decoded; +} + +int encode_pdn_connectivity_request(pdn_connectivity_request_msg *pdn_connectivity_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, PDN_CONNECTIVITY_REQUEST_MINIMUM_LENGTH, len); + + *(buffer + encoded) = ((encode_u8_pdn_type(&pdn_connectivity_request->pdntype) & 0x0f) << 4) | (encode_u8_request_type(&pdn_connectivity_request->requesttype) & 0x0f); + encoded++; + + if ((pdn_connectivity_request->presencemask & PDN_CONNECTIVITY_REQUEST_ESM_INFORMATION_TRANSFER_FLAG_PRESENT) + == PDN_CONNECTIVITY_REQUEST_ESM_INFORMATION_TRANSFER_FLAG_PRESENT) { + if ((encode_result = + encode_esm_information_transfer_flag(&pdn_connectivity_request->esminformationtransferflag, + PDN_CONNECTIVITY_REQUEST_ESM_INFORMATION_TRANSFER_FLAG_IEI, buffer + + encoded, len - encoded)) < 0) + // Return in case of error + return encode_result; + else + encoded += encode_result; + } + + if ((pdn_connectivity_request->presencemask & PDN_CONNECTIVITY_REQUEST_ACCESS_POINT_NAME_PRESENT) + == PDN_CONNECTIVITY_REQUEST_ACCESS_POINT_NAME_PRESENT) { + if ((encode_result = + encode_access_point_name(&pdn_connectivity_request->accesspointname, + PDN_CONNECTIVITY_REQUEST_ACCESS_POINT_NAME_IEI, buffer + encoded, + len - encoded)) < 0) + // Return in case of error + return encode_result; + else + encoded += encode_result; + } + + if ((pdn_connectivity_request->presencemask & PDN_CONNECTIVITY_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) + == PDN_CONNECTIVITY_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { + if ((encode_result = + encode_protocol_configuration_options(&pdn_connectivity_request->protocolconfigurationoptions, + PDN_CONNECTIVITY_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI, + buffer + encoded, len - encoded)) < 0) + // Return in case of error + return encode_result; + else + encoded += encode_result; + } + + return encoded; +} + diff --git a/openair-cn/NAS/COMMON/ESM/MSG/PdnConnectivityRequest.h b/openair-cn/NAS/COMMON/ESM/MSG/PdnConnectivityRequest.h new file mode 100644 index 0000000000..2a30138f9e --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/PdnConnectivityRequest.h @@ -0,0 +1,97 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "ProtocolDiscriminator.h" +#include "EpsBearerIdentity.h" +#include "ProcedureTransactionIdentity.h" +#include "MessageType.h" +#include "NasRequestType.h" +#include "PdnType.h" +#include "EsmInformationTransferFlag.h" +#include "AccessPointName.h" +#include "ProtocolConfigurationOptions.h" + +#ifndef PDN_CONNECTIVITY_REQUEST_H_ +#define PDN_CONNECTIVITY_REQUEST_H_ + +/* Minimum length macro. Formed by minimum length of each mandatory field */ +#define PDN_CONNECTIVITY_REQUEST_MINIMUM_LENGTH ( \ + PDN_TYPE_MINIMUM_LENGTH ) + +/* Maximum length macro. Formed by maximum length of each field */ +#define PDN_CONNECTIVITY_REQUEST_MAXIMUM_LENGTH ( \ + PDN_TYPE_MAXIMUM_LENGTH + \ + ESM_INFORMATION_TRANSFER_FLAG_MAXIMUM_LENGTH + \ + ACCESS_POINT_NAME_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 PDN_CONNECTIVITY_REQUEST_ESM_INFORMATION_TRANSFER_FLAG_PRESENT (1<<0) +# define PDN_CONNECTIVITY_REQUEST_ACCESS_POINT_NAME_PRESENT (1<<1) +# define PDN_CONNECTIVITY_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT (1<<2) + +typedef enum pdn_connectivity_request_iei_tag { + PDN_CONNECTIVITY_REQUEST_ESM_INFORMATION_TRANSFER_FLAG_IEI = 0xD0, /* 0xD0 = 208 */ + PDN_CONNECTIVITY_REQUEST_ACCESS_POINT_NAME_IEI = 0x28, /* 0x28 = 40 */ + PDN_CONNECTIVITY_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI = 0x27, /* 0x27 = 39 */ +} pdn_connectivity_request_iei; + +/* + * Message name: PDN connectivity request + * Description: This message is sent by the UE to the network to initiate establishment of a PDN connection. See table 8.3.20.1. + * Significance: dual + * Direction: UE to network + */ + +typedef struct pdn_connectivity_request_msg_tag { + /* Mandatory fields */ + ProtocolDiscriminator protocoldiscriminator:4; + EpsBearerIdentity epsbeareridentity:4; + ProcedureTransactionIdentity proceduretransactionidentity; + MessageType messagetype; + RequestType requesttype; + PdnType pdntype; + /* Optional fields */ + uint32_t presencemask; + EsmInformationTransferFlag esminformationtransferflag; + AccessPointName accesspointname; + ProtocolConfigurationOptions protocolconfigurationoptions; +} pdn_connectivity_request_msg; + +int decode_pdn_connectivity_request(pdn_connectivity_request_msg *pdnconnectivityrequest, uint8_t *buffer, uint32_t len); + +int encode_pdn_connectivity_request(pdn_connectivity_request_msg *pdnconnectivityrequest, uint8_t *buffer, uint32_t len); + +#endif /* ! defined(PDN_CONNECTIVITY_REQUEST_H_) */ + diff --git a/openair-cn/NAS/COMMON/ESM/MSG/PdnDisconnectReject.c b/openair-cn/NAS/COMMON/ESM/MSG/PdnDisconnectReject.c new file mode 100644 index 0000000000..0e710bf968 --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/PdnDisconnectReject.c @@ -0,0 +1,111 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#include "TLVEncoder.h" +#include "TLVDecoder.h" +#include "PdnDisconnectReject.h" + +int decode_pdn_disconnect_reject(pdn_disconnect_reject_msg *pdn_disconnect_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, PDN_DISCONNECT_REJECT_MINIMUM_LENGTH, len); + + /* Decoding mandatory fields */ + if ((decoded_result = decode_esm_cause(&pdn_disconnect_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 PDN_DISCONNECT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI: + if ((decoded_result = + decode_protocol_configuration_options(&pdn_disconnect_reject->protocolconfigurationoptions, + PDN_DISCONNECT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI, + buffer + decoded, len - decoded)) <= 0) + return decoded_result; + + decoded += decoded_result; + /* Set corresponding mask to 1 in presencemask */ + pdn_disconnect_reject->presencemask |= PDN_DISCONNECT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; + break; + + default: + errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; + return TLV_DECODE_UNEXPECTED_IEI; + } + } + + return decoded; +} + +int encode_pdn_disconnect_reject(pdn_disconnect_reject_msg *pdn_disconnect_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, PDN_DISCONNECT_REJECT_MINIMUM_LENGTH, len); + + if ((encode_result = encode_esm_cause(&pdn_disconnect_reject->esmcause, 0, + buffer + encoded, len - encoded)) < 0) //Return in case of error + return encode_result; + else + encoded += encode_result; + + if ((pdn_disconnect_reject->presencemask & PDN_DISCONNECT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) + == PDN_DISCONNECT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { + if ((encode_result = + encode_protocol_configuration_options(&pdn_disconnect_reject->protocolconfigurationoptions, + PDN_DISCONNECT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI, buffer + + encoded, len - encoded)) < 0) + // Return in case of error + return encode_result; + else + encoded += encode_result; + } + + return encoded; +} + diff --git a/openair-cn/NAS/COMMON/ESM/MSG/PdnDisconnectReject.h b/openair-cn/NAS/COMMON/ESM/MSG/PdnDisconnectReject.h new file mode 100644 index 0000000000..3d6508a869 --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/PdnDisconnectReject.h @@ -0,0 +1,85 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "ProtocolDiscriminator.h" +#include "EpsBearerIdentity.h" +#include "ProcedureTransactionIdentity.h" +#include "MessageType.h" +#include "EsmCause.h" +#include "ProtocolConfigurationOptions.h" + +#ifndef PDN_DISCONNECT_REJECT_H_ +#define PDN_DISCONNECT_REJECT_H_ + +/* Minimum length macro. Formed by minimum length of each mandatory field */ +#define PDN_DISCONNECT_REJECT_MINIMUM_LENGTH ( \ + ESM_CAUSE_MINIMUM_LENGTH ) + +/* Maximum length macro. Formed by maximum length of each field */ +#define PDN_DISCONNECT_REJECT_MAXIMUM_LENGTH ( \ + ESM_CAUSE_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 PDN_DISCONNECT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT (1<<0) + +typedef enum pdn_disconnect_reject_iei_tag { + PDN_DISCONNECT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI = 0x27, /* 0x27 = 39 */ +} pdn_disconnect_reject_iei; + +/* + * Message name: PDN disconnect reject + * Description: This message is sent by the network to the UE to reject release of a PDN connection. See table 8.3.21.1. + * Significance: dual + * Direction: network to UE + */ + +typedef struct pdn_disconnect_reject_msg_tag { + /* Mandatory fields */ + ProtocolDiscriminator protocoldiscriminator:4; + EpsBearerIdentity epsbeareridentity:4; + ProcedureTransactionIdentity proceduretransactionidentity; + MessageType messagetype; + EsmCause esmcause; + /* Optional fields */ + uint32_t presencemask; + ProtocolConfigurationOptions protocolconfigurationoptions; +} pdn_disconnect_reject_msg; + +int decode_pdn_disconnect_reject(pdn_disconnect_reject_msg *pdndisconnectreject, uint8_t *buffer, uint32_t len); + +int encode_pdn_disconnect_reject(pdn_disconnect_reject_msg *pdndisconnectreject, uint8_t *buffer, uint32_t len); + +#endif /* ! defined(PDN_DISCONNECT_REJECT_H_) */ + diff --git a/openair-cn/NAS/COMMON/ESM/MSG/PdnDisconnectRequest.c b/openair-cn/NAS/COMMON/ESM/MSG/PdnDisconnectRequest.c new file mode 100644 index 0000000000..2127384006 --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/PdnDisconnectRequest.c @@ -0,0 +1,108 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include +#include + + +#include "TLVEncoder.h" +#include "TLVDecoder.h" +#include "PdnDisconnectRequest.h" + +int decode_pdn_disconnect_request(pdn_disconnect_request_msg *pdn_disconnect_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, PDN_DISCONNECT_REQUEST_MINIMUM_LENGTH, len); + + /* Decoding mandatory fields */ + if ((decoded_result = decode_u8_linked_eps_bearer_identity(&pdn_disconnect_request->linkedepsbeareridentity, 0, *(buffer + decoded) & 0x0f, 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 PDN_DISCONNECT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI: + if ((decoded_result = + decode_protocol_configuration_options(&pdn_disconnect_request->protocolconfigurationoptions, + PDN_DISCONNECT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI, + buffer + decoded, len - decoded)) <= 0) + return decoded_result; + + decoded += decoded_result; + /* Set corresponding mask to 1 in presencemask */ + pdn_disconnect_request->presencemask |= PDN_DISCONNECT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; + break; + + default: + errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; + return TLV_DECODE_UNEXPECTED_IEI; + } + } + + return decoded; +} + +int encode_pdn_disconnect_request(pdn_disconnect_request_msg *pdn_disconnect_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, PDN_DISCONNECT_REQUEST_MINIMUM_LENGTH, len); + + *(buffer + encoded) = (encode_u8_linked_eps_bearer_identity(&pdn_disconnect_request->linkedepsbeareridentity) & 0x0f); + encoded++; + + if ((pdn_disconnect_request->presencemask & PDN_DISCONNECT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) + == PDN_DISCONNECT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { + if ((encode_result = + encode_protocol_configuration_options(&pdn_disconnect_request->protocolconfigurationoptions, + PDN_DISCONNECT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI, buffer + + encoded, len - encoded)) < 0) + // Return in case of error + return encode_result; + else + encoded += encode_result; + } + + return encoded; +} + diff --git a/openair-cn/NAS/COMMON/ESM/MSG/PdnDisconnectRequest.h b/openair-cn/NAS/COMMON/ESM/MSG/PdnDisconnectRequest.h new file mode 100644 index 0000000000..449a088c6a --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/PdnDisconnectRequest.h @@ -0,0 +1,85 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +#include +#include +#include + +#include "ProtocolDiscriminator.h" +#include "EpsBearerIdentity.h" +#include "ProcedureTransactionIdentity.h" +#include "MessageType.h" +#include "LinkedEpsBearerIdentity.h" +#include "ProtocolConfigurationOptions.h" + +#ifndef PDN_DISCONNECT_REQUEST_H_ +#define PDN_DISCONNECT_REQUEST_H_ + +/* Minimum length macro. Formed by minimum length of each mandatory field */ +#define PDN_DISCONNECT_REQUEST_MINIMUM_LENGTH ( \ + LINKED_EPS_BEARER_IDENTITY_MINIMUM_LENGTH ) + +/* Maximum length macro. Formed by maximum length of each field */ +#define PDN_DISCONNECT_REQUEST_MAXIMUM_LENGTH ( \ + LINKED_EPS_BEARER_IDENTITY_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 PDN_DISCONNECT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT (1<<0) + +typedef enum pdn_disconnect_request_iei_tag { + PDN_DISCONNECT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI = 0x27, /* 0x27 = 39 */ +} pdn_disconnect_request_iei; + +/* + * Message name: PDN disconnect request + * Description: This message is sent by the UE to the network to initiate release of a PDN connection. See table 8.3.22.1. + * Significance: dual + * Direction: UE to network + */ + +typedef struct pdn_disconnect_request_msg_tag { + /* Mandatory fields */ + ProtocolDiscriminator protocoldiscriminator:4; + EpsBearerIdentity epsbeareridentity:4; + ProcedureTransactionIdentity proceduretransactionidentity; + MessageType messagetype; + LinkedEpsBearerIdentity linkedepsbeareridentity; + /* Optional fields */ + uint32_t presencemask; + ProtocolConfigurationOptions protocolconfigurationoptions; +} pdn_disconnect_request_msg; + +int decode_pdn_disconnect_request(pdn_disconnect_request_msg *pdndisconnectrequest, uint8_t *buffer, uint32_t len); + +int encode_pdn_disconnect_request(pdn_disconnect_request_msg *pdndisconnectrequest, uint8_t *buffer, uint32_t len); + +#endif /* ! defined(PDN_DISCONNECT_REQUEST_H_) */ + diff --git a/openair-cn/NAS/COMMON/ESM/MSG/esm_cause.h b/openair-cn/NAS/COMMON/ESM/MSG/esm_cause.h new file mode 100644 index 0000000000..65063a8dda --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/esm_cause.h @@ -0,0 +1,129 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +/***************************************************************************** +Source esm_cause.h + +Version 0.1 + +Date 2013/02/06 + +Product NAS stack + +Subsystem EPS Session Management + +Author Frederic Maurel + +Description Defines error cause code returned upon receiving unknown, + unforeseen, and erroneous EPS session management protocol + data. + +*****************************************************************************/ +#ifndef __ESM_CAUSE_H__ +#define __ESM_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 session management procedure + * has been successfully processed + */ +#define ESM_CAUSE_SUCCESS (-1) + +/* + * Causes related to nature of request (TS 24.301 - Annex B1) + */ +#define ESM_CAUSE_OPERATOR_DETERMINED_BARRING 8 +#define ESM_CAUSE_INSUFFICIENT_RESOURCES 26 +#define ESM_CAUSE_UNKNOWN_ACCESS_POINT_NAME 27 +#define ESM_CAUSE_UNKNOWN_PDN_TYPE 28 +#define ESM_CAUSE_USER_AUTHENTICATION_FAILED 29 +#define ESM_CAUSE_REQUEST_REJECTED_BY_GW 30 +#define ESM_CAUSE_REQUEST_REJECTED_UNSPECIFIED 31 +#define ESM_CAUSE_SERVICE_OPTION_NOT_SUPPORTED 32 +#define ESM_CAUSE_REQUESTED_SERVICE_OPTION_NOT_SUBSCRIBED 33 +#define ESM_CAUSE_SERVICE_OPTION_TEMPORARILY_OUT_OF_ORDER 34 +#define ESM_CAUSE_PTI_ALREADY_IN_USE 35 +#define ESM_CAUSE_REGULAR_DEACTIVATION 36 +#define ESM_CAUSE_EPS_QOS_NOT_ACCEPTED 37 +#define ESM_CAUSE_NETWORK_FAILURE 38 +#define ESM_CAUSE_REACTIVATION_REQUESTED 39 +#define ESM_CAUSE_SEMANTIC_ERROR_IN_THE_TFT_OPERATION 41 +#define ESM_CAUSE_SYNTACTICAL_ERROR_IN_THE_TFT_OPERATION 42 +#define ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY 43 +#define ESM_CAUSE_SEMANTIC_ERRORS_IN_PACKET_FILTER 44 +#define ESM_CAUSE_SYNTACTICAL_ERROR_IN_PACKET_FILTER 45 +#define ESM_CAUSE_PTI_MISMATCH 47 +#define ESM_CAUSE_LAST_PDN_DISCONNECTION_NOT_ALLOWED 49 +#define ESM_CAUSE_PDN_TYPE_IPV4_ONLY_ALLOWED 50 +#define ESM_CAUSE_PDN_TYPE_IPV6_ONLY_ALLOWED 51 +#define ESM_CAUSE_SINGLE_ADDRESS_BEARERS_ONLY_ALLOWED 52 +#define ESM_CAUSE_ESM_INFORMATION_NOT_RECEIVED 53 +#define ESM_CAUSE_PDN_CONNECTION_DOES_NOT_EXIST 54 +#define ESM_CAUSE_MULTIPLE_PDN_CONNECTIONS_NOT_ALLOWED 55 +#define ESM_CAUSE_COLLISION_WITH_NETWORK_INITIATED_REQUEST 56 +#define ESM_CAUSE_UNSUPPORTED_QCI_VALUE 59 +#define ESM_CAUSE_BEARER_HANDLING_NOT_SUPPORTED 60 +#define ESM_CAUSE_INVALID_PTI_VALUE 81 +#define ESM_CAUSE_APN_RESTRICTION_VALUE_NOT_COMPATIBLE 112 + +/* + * Protocol errors (e.g., unknown message) class (TS 24.301 - Annex B2) + */ +#define ESM_CAUSE_SEMANTICALLY_INCORRECT 95 +#define ESM_CAUSE_INVALID_MANDATORY_INFO 96 +#define ESM_CAUSE_MESSAGE_TYPE_NOT_IMPLEMENTED 97 +#define ESM_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE 98 +#define ESM_CAUSE_IE_NOT_IMPLEMENTED 99 +#define ESM_CAUSE_CONDITIONAL_IE_ERROR 100 +#define ESM_CAUSE_MESSAGE_NOT_COMPATIBLE 101 +#define ESM_CAUSE_PROTOCOL_ERROR 111 + +/* + * TS 24.301 - Table 9.9.4.4.1 + * Any other value received by the UE shall be treated as cause code #34, + * "service option temporarily out of order". + * 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 /* __ESM_CAUSE_H__*/ diff --git a/openair-cn/NAS/COMMON/ESM/MSG/esm_msg.c b/openair-cn/NAS/COMMON/ESM/MSG/esm_msg.c new file mode 100644 index 0000000000..2f5dbc8727 --- /dev/null +++ b/openair-cn/NAS/COMMON/ESM/MSG/esm_msg.c @@ -0,0 +1,484 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ +/***************************************************************************** +Source esm_msg.c + +Version 0.1 + +Date 2012/09/27 + +Product NAS stack + +Subsystem EPS Session Management + +Author Frederic Maurel, Sebastien Roux + +Description Defines EPS Session Management messages + +*****************************************************************************/ + +#include "esm_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 _esm_msg_decode_header(esm_msg_header_t *header, const uint8_t *buffer, uint32_t len); +static int _esm_msg_encode_header(const esm_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: esm_msg_decode() ** + ** ** + ** Description: Decode EPS Session Management messages ** + ** ** + ** Inputs: buffer: Pointer to the buffer containing the ESM ** + ** message ** + ** len: Number of bytes that should be decoded ** + ** Others: None ** + ** ** + ** Outputs: msg: The ESM 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 esm_msg_decode(ESM_msg *msg, uint8_t *buffer, uint32_t len) +{ + 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)