diff --git a/lib/asn/src/Makefile.am b/lib/asn/src/Makefile.am index f78e3345f5..68ef80e16d 100644 --- a/lib/asn/src/Makefile.am +++ b/lib/asn/src/Makefile.am @@ -5,12 +5,11 @@ SUBDIRS = asn1c noinst_LTLIBRARIES = libasn.la libasn_la_SOURCES = \ - s1ap_ies_defs.h s1ap_common.h + s1ap_ies_defs.h s1ap_message.h nodist_libasn_la_SOURCES = \ - s1ap_common.c \ - s1ap_ies_encoder.c s1ap_ies_decoder.c s1ap_ies_xer_print.c \ - s1ap_mme_encoder.c s1ap_mme_decoder.c + s1ap_encoder.c s1ap_decoder.c \ + s1ap_ies_encoder.c s1ap_ies_decoder.c s1ap_ies_xer_print.c libasn_la_DEPENDENCIES = \ $(top_srcdir)/lib/asn/src/asn1c/libasn1c.la diff --git a/lib/asn/src/s1ap_common.h b/lib/asn/src/s1ap_asn1c.h similarity index 62% rename from lib/asn/src/s1ap_common.h rename to lib/asn/src/s1ap_asn1c.h index 70e51fe938..52e70869bc 100644 --- a/lib/asn/src/s1ap_common.h +++ b/lib/asn/src/s1ap_asn1c.h @@ -1,475 +1,367 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the Apache License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ +#ifndef _S1AP_ASN1C_H__ +#define _S1AP_ASN1C_H__ - -/** @defgroup _s1ap_impl_ S1AP Layer Reference Implementation - * @ingroup _ref_implementation_ - * @{ - */ - -#if HAVE_CONFIG_H_ -# include "config.h" +#if HAVE_CONFIG_H +#include "config.h" #endif -#ifndef FILE_S1AP_COMMON_SEEN -#define FILE_S1AP_COMMON_SEEN - -/* Defined in asn_internal.h */ -// extern int asn_debug_indent; -extern int asn_debug; - -#if defined(EMIT_ASN_DEBUG_EXTERN) -inline void ASN_DEBUG(const char *fmt, ...); -#endif - -#include "S1ap-Criticality.h" -#include "S1ap-Presence.h" -#include "S1ap-PrivateIE-ID.h" -#include "S1ap-ProcedureCode.h" -#include "S1ap-ProtocolExtensionID.h" -#include "S1ap-ProtocolIE-ID.h" -#include "S1ap-TriggeringMessage.h" #include "S1ap-AllocationAndRetentionPriority.h" -#include "S1ap-Bearers-SubjectToStatusTransfer-List.h" -#include "S1ap-Bearers-SubjectToStatusTransfer-Item.h" -#include "S1ap-BitRate.h" +#include "S1ap-AreaScopeOfMDT.h" #include "S1ap-BPLMNs.h" +#include "S1ap-Bearers-SubjectToStatusTransfer-Item.h" +#include "S1ap-Bearers-SubjectToStatusTransfer-List.h" +#include "S1ap-BitRate.h" +#include "S1ap-BroadcastCancelledAreaList.h" #include "S1ap-BroadcastCompletedAreaList.h" +#include "S1ap-CGI.h" +#include "S1ap-CI.h" +#include "S1ap-CNDomain.h" +#include "S1ap-COUNTvalue.h" +#include "S1ap-CSFallbackIndicator.h" +#include "S1ap-CSG-Id.h" +#include "S1ap-CSG-IdList-Item.h" +#include "S1ap-CSG-IdList.h" +#include "S1ap-CSGMembershipStatus.h" +#include "S1ap-CancelledCellinEAI-Item.h" +#include "S1ap-CancelledCellinEAI.h" +#include "S1ap-CancelledCellinTAI-Item.h" +#include "S1ap-CancelledCellinTAI.h" #include "S1ap-Cause.h" #include "S1ap-CauseMisc.h" +#include "S1ap-CauseNas.h" #include "S1ap-CauseProtocol.h" #include "S1ap-CauseRadioNetwork.h" #include "S1ap-CauseTransport.h" -#include "S1ap-CauseNas.h" -#include "S1ap-CellIdentity.h" -#include "S1ap-CellID-Broadcast.h" -#include "S1ap-CellID-Broadcast-Item.h" -#include "S1ap-Cdma2000PDU.h" -#include "S1ap-Cdma2000RATType.h" -#include "S1ap-Cdma2000SectorID.h" -#include "S1ap-Cdma2000HOStatus.h" #include "S1ap-Cdma2000HORequiredIndication.h" -#include "S1ap-Cdma2000OneXSRVCCInfo.h" +#include "S1ap-Cdma2000HOStatus.h" #include "S1ap-Cdma2000OneXMEID.h" #include "S1ap-Cdma2000OneXMSI.h" #include "S1ap-Cdma2000OneXPilot.h" #include "S1ap-Cdma2000OneXRAND.h" +#include "S1ap-Cdma2000OneXSRVCCInfo.h" +#include "S1ap-Cdma2000PDU.h" +#include "S1ap-Cdma2000RATType.h" +#include "S1ap-Cdma2000SectorID.h" #include "S1ap-Cell-Size.h" +#include "S1ap-CellAccessMode.h" +#include "S1ap-CellBasedMDT.h" +#include "S1ap-CellID-Broadcast-Item.h" +#include "S1ap-CellID-Broadcast.h" +#include "S1ap-CellID-Cancelled-Item.h" +#include "S1ap-CellID-Cancelled.h" +#include "S1ap-CellIdListforMDT.h" +#include "S1ap-CellIdentity.h" +#include "S1ap-CellTrafficTrace.h" #include "S1ap-CellType.h" -#include "S1ap-CGI.h" -#include "S1ap-CI.h" -#include "S1ap-CNDomain.h" -#include "S1ap-CSFallbackIndicator.h" -#include "S1ap-CSG-Id.h" -#include "S1ap-CSG-IdList.h" -#include "S1ap-CSG-IdList-Item.h" -#include "S1ap-COUNTvalue.h" -#include "S1ap-DataCodingScheme.h" -#include "S1ap-DL-Forwarding.h" -#include "S1ap-Direct-Forwarding-Path-Availability.h" -#include "S1ap-ECGIList.h" -#include "S1ap-EmergencyAreaIDList.h" -#include "S1ap-EmergencyAreaID.h" -#include "S1ap-EmergencyAreaID-Broadcast.h" -#include "S1ap-EmergencyAreaID-Broadcast-Item.h" -#include "S1ap-CompletedCellinEAI.h" #include "S1ap-CompletedCellinEAI-Item.h" -#include "S1ap-ENB-ID.h" -#include "S1ap-GERAN-Cell-ID.h" -#include "S1ap-Global-ENB-ID.h" -#include "S1ap-ENB-StatusTransfer-TransparentContainer.h" -#include "S1ap-ENBname.h" -#include "S1ap-ENBX2TLAs.h" -#include "S1ap-EncryptionAlgorithms.h" -#include "S1ap-EPLMNs.h" -#include "S1ap-EventType.h" +#include "S1ap-CompletedCellinEAI.h" +#include "S1ap-CompletedCellinTAI-Item.h" +#include "S1ap-CompletedCellinTAI.h" +#include "S1ap-ConcurrentWarningMessageIndicator.h" +#include "S1ap-Correlation-ID.h" +#include "S1ap-Criticality.h" +#include "S1ap-CriticalityDiagnostics-IE-Item.h" +#include "S1ap-CriticalityDiagnostics-IE-List.h" +#include "S1ap-CriticalityDiagnostics.h" +#include "S1ap-DL-Forwarding.h" +#include "S1ap-Data-Forwarding-Not-Possible.h" +#include "S1ap-DataCodingScheme.h" +#include "S1ap-DeactivateTrace.h" +#include "S1ap-Direct-Forwarding-Path-Availability.h" +#include "S1ap-DownlinkNASTransport.h" +#include "S1ap-DownlinkNonUEAssociatedLPPaTransport.h" +#include "S1ap-DownlinkS1cdma2000tunneling.h" +#include "S1ap-DownlinkUEAssociatedLPPaTransport.h" #include "S1ap-E-RAB-ID.h" +#include "S1ap-E-RABAdmittedItem.h" +#include "S1ap-E-RABAdmittedList.h" +#include "S1ap-E-RABDataForwardingItem.h" +#include "S1ap-E-RABDataForwardingList.h" +#include "S1ap-E-RABFailedToSetupItemHOReqAck.h" +#include "S1ap-E-RABFailedtoSetupListHOReqAck.h" #include "S1ap-E-RABInformationList.h" #include "S1ap-E-RABInformationListItem.h" -#include "S1ap-E-RABList.h" #include "S1ap-E-RABItem.h" #include "S1ap-E-RABLevelQoSParameters.h" +#include "S1ap-E-RABList.h" +#include "S1ap-E-RABModifyItemBearerModRes.h" +#include "S1ap-E-RABModifyListBearerModRes.h" +#include "S1ap-E-RABModifyRequest.h" +#include "S1ap-E-RABModifyResponse.h" +#include "S1ap-E-RABReleaseCommand.h" +#include "S1ap-E-RABReleaseIndication.h" +#include "S1ap-E-RABReleaseItemBearerRelComp.h" +#include "S1ap-E-RABReleaseListBearerRelComp.h" +#include "S1ap-E-RABReleaseResponse.h" +#include "S1ap-E-RABSetupItemBearerSURes.h" +#include "S1ap-E-RABSetupItemCtxtSURes.h" +#include "S1ap-E-RABSetupListBearerSURes.h" +#include "S1ap-E-RABSetupListCtxtSURes.h" +#include "S1ap-E-RABSetupRequest.h" +#include "S1ap-E-RABSetupResponse.h" +#include "S1ap-E-RABToBeModifiedItemBearerModReq.h" +#include "S1ap-E-RABToBeModifiedListBearerModReq.h" +#include "S1ap-E-RABToBeSetupItemBearerSUReq.h" +#include "S1ap-E-RABToBeSetupItemCtxtSUReq.h" +#include "S1ap-E-RABToBeSetupItemHOReq.h" +#include "S1ap-E-RABToBeSetupListBearerSUReq.h" +#include "S1ap-E-RABToBeSetupListCtxtSUReq.h" +#include "S1ap-E-RABToBeSetupListHOReq.h" +#include "S1ap-E-RABToBeSwitchedDLItem.h" +#include "S1ap-E-RABToBeSwitchedDLList.h" +#include "S1ap-E-RABToBeSwitchedULItem.h" +#include "S1ap-E-RABToBeSwitchedULList.h" +#include "S1ap-E-UTRAN-Trace-ID.h" +#include "S1ap-ECGIList.h" +#include "S1ap-ENB-ID.h" +#include "S1ap-ENB-StatusTransfer-TransparentContainer.h" +#include "S1ap-ENB-UE-S1AP-ID.h" +#include "S1ap-ENBConfigurationTransfer.h" +#include "S1ap-ENBConfigurationUpdate.h" +#include "S1ap-ENBConfigurationUpdateAcknowledge.h" +#include "S1ap-ENBConfigurationUpdateFailure.h" +#include "S1ap-ENBDirectInformationTransfer.h" +#include "S1ap-ENBStatusTransfer.h" +#include "S1ap-ENBX2ExtTLA.h" +#include "S1ap-ENBX2ExtTLAs.h" +#include "S1ap-ENBX2GTPTLAs.h" +#include "S1ap-ENBX2TLAs.h" +#include "S1ap-ENBname.h" +#include "S1ap-EPLMNs.h" #include "S1ap-EUTRAN-CGI.h" +#include "S1ap-EUTRANRoundTripDelayEstimationInfo.h" +#include "S1ap-EmergencyAreaID-Broadcast-Item.h" +#include "S1ap-EmergencyAreaID-Broadcast.h" +#include "S1ap-EmergencyAreaID-Cancelled-Item.h" +#include "S1ap-EmergencyAreaID-Cancelled.h" +#include "S1ap-EmergencyAreaID.h" +#include "S1ap-EmergencyAreaIDList.h" +#include "S1ap-EncryptionAlgorithms.h" +#include "S1ap-ErrorIndication.h" +#include "S1ap-EventType.h" #include "S1ap-ExtendedRNC-ID.h" +#include "S1ap-ExtendedRepetitionPeriod.h" #include "S1ap-ForbiddenInterRATs.h" -#include "S1ap-ForbiddenTAs.h" -#include "S1ap-ForbiddenTAs-Item.h" -#include "S1ap-ForbiddenTACs.h" -#include "S1ap-ForbiddenLAs.h" -#include "S1ap-ForbiddenLAs-Item.h" #include "S1ap-ForbiddenLACs.h" +#include "S1ap-ForbiddenLAs-Item.h" +#include "S1ap-ForbiddenLAs.h" +#include "S1ap-ForbiddenTACs.h" +#include "S1ap-ForbiddenTAs-Item.h" +#include "S1ap-ForbiddenTAs.h" #include "S1ap-GBR-QosInformation.h" +#include "S1ap-GERAN-Cell-ID.h" #include "S1ap-GTP-TEID.h" #include "S1ap-GUMMEI.h" +#include "S1ap-GUMMEIList.h" +#include "S1ap-GWContextReleaseIndication.h" +#include "S1ap-Global-ENB-ID.h" +#include "S1ap-HFN.h" +#include "S1ap-HandoverCancel.h" +#include "S1ap-HandoverCancelAcknowledge.h" +#include "S1ap-HandoverCommand.h" +#include "S1ap-HandoverFailure.h" +#include "S1ap-HandoverNotify.h" +#include "S1ap-HandoverPreparationFailure.h" +#include "S1ap-HandoverRequest.h" +#include "S1ap-HandoverRequestAcknowledge.h" +#include "S1ap-HandoverRequired.h" #include "S1ap-HandoverRestrictionList.h" #include "S1ap-HandoverType.h" -#include "S1ap-HFN.h" +#include "S1ap-IE.h" #include "S1ap-IMSI.h" +#include "S1ap-ImmediateMDT.h" +#include "S1ap-InitialContextSetupFailure.h" +#include "S1ap-InitialContextSetupRequest.h" +#include "S1ap-InitialContextSetupResponse.h" +#include "S1ap-InitialUEMessage.h" +#include "S1ap-InitiatingMessage.h" #include "S1ap-IntegrityProtectionAlgorithms.h" +#include "S1ap-Inter-SystemInformationTransferType.h" #include "S1ap-InterfacesToTrace.h" +#include "S1ap-KillRequest.h" +#include "S1ap-KillResponse.h" +#include "S1ap-L3-Information.h" #include "S1ap-LAC.h" #include "S1ap-LAI.h" +#include "S1ap-LPPa-PDU.h" #include "S1ap-LastVisitedCell-Item.h" #include "S1ap-LastVisitedEUTRANCellInformation.h" -#include "S1ap-LastVisitedUTRANCellInformation.h" #include "S1ap-LastVisitedGERANCellInformation.h" -#include "S1ap-L3-Information.h" -#include "S1ap-MessageIdentifier.h" -#include "S1ap-MMEname.h" -#include "S1ap-MME-Group-ID.h" -#include "S1ap-MME-Code.h" +#include "S1ap-LastVisitedUTRANCellInformation.h" +#include "S1ap-LocationReport.h" +#include "S1ap-LocationReportingControl.h" +#include "S1ap-LocationReportingFailureIndication.h" +#include "S1ap-LoggedMDT.h" +#include "S1ap-LoggingDuration.h" +#include "S1ap-LoggingInterval.h" #include "S1ap-M-TMSI.h" +#include "S1ap-MDT-Activation.h" +#include "S1ap-MDT-Configuration.h" +#include "S1ap-MDTMode.h" +#include "S1ap-MME-Code.h" +#include "S1ap-MME-Group-ID.h" +#include "S1ap-MME-UE-S1AP-ID.h" +#include "S1ap-MMEConfigurationTransfer.h" +#include "S1ap-MMEConfigurationUpdate.h" +#include "S1ap-MMEConfigurationUpdateAcknowledge.h" +#include "S1ap-MMEConfigurationUpdateFailure.h" +#include "S1ap-MMEDirectInformationTransfer.h" +#include "S1ap-MMERelaySupportIndicator.h" +#include "S1ap-MMEStatusTransfer.h" +#include "S1ap-MMEname.h" #include "S1ap-MSClassmark2.h" #include "S1ap-MSClassmark3.h" +#include "S1ap-ManagementBasedMDTAllowed.h" +#include "S1ap-MeasurementThresholdA2.h" +#include "S1ap-MeasurementsToActivate.h" +#include "S1ap-MessageIdentifier.h" #include "S1ap-NAS-PDU.h" +#include "S1ap-NASNonDeliveryIndication.h" #include "S1ap-NASSecurityParametersfromE-UTRAN.h" #include "S1ap-NASSecurityParameterstoE-UTRAN.h" -#include "S1ap-NumberofBroadcastRequest.h" #include "S1ap-NumberOfBroadcasts.h" +#include "S1ap-NumberofBroadcastRequest.h" #include "S1ap-OldBSS-ToNewBSS-Information.h" #include "S1ap-OverloadAction.h" #include "S1ap-OverloadResponse.h" -#include "S1ap-PagingDRX.h" +#include "S1ap-OverloadStart.h" +#include "S1ap-OverloadStop.h" #include "S1ap-PDCP-SN.h" #include "S1ap-PLMNidentity.h" +#include "S1ap-PS-ServiceNotAvailable.h" +#include "S1ap-Paging.h" +#include "S1ap-PagingDRX.h" +#include "S1ap-PagingPriority.h" +#include "S1ap-PathSwitchRequest.h" +#include "S1ap-PathSwitchRequestAcknowledge.h" +#include "S1ap-PathSwitchRequestFailure.h" +#include "S1ap-PeriodicReportingMDT.h" #include "S1ap-Pre-emptionCapability.h" #include "S1ap-Pre-emptionVulnerability.h" +#include "S1ap-Presence.h" #include "S1ap-PriorityLevel.h" +#include "S1ap-PrivacyIndicator.h" +#include "S1ap-PrivateIE-ID.h" +#include "S1ap-PrivateMessage.h" +#include "S1ap-ProcedureCode.h" +#include "S1ap-ProtocolExtensionID.h" +#include "S1ap-ProtocolIE-ID.h" #include "S1ap-QCI.h" -#include "S1ap-ReceiveStatusofULPDCPSDUs.h" -#include "S1ap-RelativeMMECapacity.h" #include "S1ap-RAC.h" -#include "S1ap-RequestType.h" -#include "S1ap-RIMTransfer.h" #include "S1ap-RIMInformation.h" #include "S1ap-RIMRoutingAddress.h" -#include "S1ap-ReportArea.h" -#include "S1ap-RepetitionPeriod.h" +#include "S1ap-RIMTransfer.h" #include "S1ap-RNC-ID.h" #include "S1ap-RRC-Container.h" #include "S1ap-RRC-Establishment-Cause.h" -#include "S1ap-SecurityKey.h" -#include "S1ap-SecurityContext.h" -#include "S1ap-SerialNumber.h" -#include "S1ap-SONInformation.h" -#include "S1ap-SONInformationRequest.h" -#include "S1ap-SONInformationReply.h" +#include "S1ap-ReceiveStatusofULPDCPSDUs.h" +#include "S1ap-RelativeMMECapacity.h" +#include "S1ap-RelayNode-Indicator.h" +#include "S1ap-RepetitionPeriod.h" +#include "S1ap-ReportAmountMDT.h" +#include "S1ap-ReportArea.h" +#include "S1ap-ReportIntervalMDT.h" +#include "S1ap-ReportingTriggerMDT.h" +#include "S1ap-RequestType.h" +#include "S1ap-Reset.h" +#include "S1ap-ResetAcknowledge.h" +#include "S1ap-ResetAll.h" +#include "S1ap-ResetType.h" +#include "S1ap-Routing-ID.h" +#include "S1ap-S-TMSI.h" +#include "S1ap-S1SetupFailure.h" +#include "S1ap-S1SetupRequest.h" +#include "S1ap-S1SetupResponse.h" #include "S1ap-SONConfigurationTransfer.h" -#include "S1ap-Source-ToTarget-TransparentContainer.h" -#include "S1ap-SourceBSS-ToTargetBSS-TransparentContainer.h" -#include "S1ap-SourceeNB-ID.h" -#include "S1ap-SRVCCOperationPossible.h" +#include "S1ap-SONInformation.h" +#include "S1ap-SONInformationReply.h" +#include "S1ap-SONInformationRequest.h" #include "S1ap-SRVCCHOIndication.h" -#include "S1ap-SourceeNB-ToTargeteNB-TransparentContainer.h" -#include "S1ap-SourceRNC-ToTargetRNC-TransparentContainer.h" +#include "S1ap-SRVCCOperationPossible.h" +#include "S1ap-SecurityContext.h" +#include "S1ap-SecurityKey.h" +#include "S1ap-SerialNumber.h" #include "S1ap-ServedGUMMEIs.h" #include "S1ap-ServedGUMMEIsItem.h" #include "S1ap-ServedGroupIDs.h" #include "S1ap-ServedMMECs.h" #include "S1ap-ServedPLMNs.h" +#include "S1ap-Source-ToTarget-TransparentContainer.h" +#include "S1ap-SourceBSS-ToTargetBSS-TransparentContainer.h" +#include "S1ap-SourceRNC-ToTargetRNC-TransparentContainer.h" +#include "S1ap-SourceeNB-ID.h" +#include "S1ap-SourceeNB-ToTargeteNB-TransparentContainer.h" +#include "S1ap-StratumLevel.h" #include "S1ap-SubscriberProfileIDforRFP.h" -#include "S1ap-SupportedTAs.h" +#include "S1ap-SuccessfulOutcome.h" #include "S1ap-SupportedTAs-Item.h" -#include "S1ap-S-TMSI.h" +#include "S1ap-SupportedTAs.h" +#include "S1ap-SynchronizationStatus.h" +#include "S1ap-TABasedMDT.h" #include "S1ap-TAC.h" +#include "S1ap-TAI-Broadcast-Item.h" +#include "S1ap-TAI-Broadcast.h" +#include "S1ap-TAI-Cancelled-Item.h" +#include "S1ap-TAI-Cancelled.h" +#include "S1ap-TAI.h" #include "S1ap-TAIItem.h" #include "S1ap-TAIList.h" #include "S1ap-TAIListforWarning.h" -#include "S1ap-TAI.h" -#include "S1ap-TAI-Broadcast.h" -#include "S1ap-TAI-Broadcast-Item.h" -#include "S1ap-CompletedCellinTAI.h" -#include "S1ap-CompletedCellinTAI-Item.h" -#include "S1ap-TargetID.h" -#include "S1ap-TargeteNB-ID.h" -#include "S1ap-TargetRNC-ID.h" -#include "S1ap-TargeteNB-ToSourceeNB-TransparentContainer.h" +#include "S1ap-TAListforMDT.h" +#include "S1ap-TBCD-STRING.h" #include "S1ap-Target-ToSource-TransparentContainer.h" -#include "S1ap-TargetRNC-ToSourceRNC-TransparentContainer.h" #include "S1ap-TargetBSS-ToSourceBSS-TransparentContainer.h" -#include "S1ap-TimeToWait.h" +#include "S1ap-TargetID.h" +#include "S1ap-TargetRNC-ID.h" +#include "S1ap-TargetRNC-ToSourceRNC-TransparentContainer.h" +#include "S1ap-TargeteNB-ID.h" +#include "S1ap-TargeteNB-ToSourceeNB-TransparentContainer.h" +#include "S1ap-Threshold-RSRP.h" +#include "S1ap-Threshold-RSRQ.h" +#include "S1ap-ThresholdEventA2.h" #include "S1ap-Time-UE-StayedInCell.h" -#include "S1ap-TransportLayerAddress.h" +#include "S1ap-TimeSynchronizationInfo.h" +#include "S1ap-TimeToWait.h" #include "S1ap-TraceActivation.h" #include "S1ap-TraceDepth.h" -#include "S1ap-E-UTRAN-Trace-ID.h" +#include "S1ap-TraceFailureIndication.h" +#include "S1ap-TraceStart.h" +#include "S1ap-TrafficLoadReductionIndication.h" +#include "S1ap-TransportLayerAddress.h" +#include "S1ap-TriggeringMessage.h" #include "S1ap-TypeOfError.h" -#include "S1ap-UEAggregateMaximumBitrate.h" -#include "S1ap-UE-associatedLogicalS1-ConnectionItem.h" -#include "S1ap-UEIdentityIndexValue.h" #include "S1ap-UE-HistoryInformation.h" +#include "S1ap-UE-S1AP-ID-pair.h" +#include "S1ap-UE-S1AP-IDs.h" +#include "S1ap-UE-associatedLogicalS1-ConnectionItem.h" +#include "S1ap-UE-associatedLogicalS1-ConnectionListRes.h" +#include "S1ap-UE-associatedLogicalS1-ConnectionListResAck.h" +#include "S1ap-UEAggregateMaximumBitrate.h" +#include "S1ap-UECapabilityInfoIndication.h" +#include "S1ap-UEContextModificationFailure.h" +#include "S1ap-UEContextModificationRequest.h" +#include "S1ap-UEContextModificationResponse.h" +#include "S1ap-UEContextReleaseCommand.h" +#include "S1ap-UEContextReleaseComplete.h" +#include "S1ap-UEContextReleaseRequest.h" +#include "S1ap-UEIdentityIndexValue.h" #include "S1ap-UEPagingID.h" #include "S1ap-UERadioCapability.h" #include "S1ap-UESecurityCapabilities.h" -#include "S1ap-WarningAreaList.h" -#include "S1ap-WarningType.h" -#include "S1ap-WarningSecurityInfo.h" -#include "S1ap-WarningMessageContents.h" -#include "S1ap-X2TNLConfigurationInfo.h" -#include "S1ap-CriticalityDiagnostics.h" -#include "S1ap-CriticalityDiagnostics-IE-List.h" -#include "S1ap-CriticalityDiagnostics-IE-Item.h" -#include "S1ap-ResetType.h" -#include "S1ap-Inter-SystemInformationTransferType.h" -#include "S1ap-UE-S1AP-IDs.h" -#include "S1ap-UE-S1AP-ID-pair.h" -#include "S1ap-MME-UE-S1AP-ID.h" -#include "S1ap-ENB-UE-S1AP-ID.h" -#include "S1ap-TBCD-STRING.h" -#include "S1ap-InitiatingMessage.h" -#include "S1ap-SuccessfulOutcome.h" #include "S1ap-UnsuccessfulOutcome.h" -#include "S1ap-HandoverRequired.h" -#include "S1ap-HandoverCommand.h" -#include "S1ap-HandoverNotify.h" -#include "S1ap-HandoverPreparationFailure.h" -#include "S1ap-HandoverRequest.h" -#include "S1ap-HandoverRequestAcknowledge.h" -#include "S1ap-HandoverFailure.h" -#include "S1ap-PathSwitchRequest.h" -#include "S1ap-PathSwitchRequestAcknowledge.h" -#include "S1ap-PathSwitchRequestFailure.h" -#include "S1ap-E-RABSetupRequest.h" -#include "S1ap-E-RABSetupResponse.h" -#include "S1ap-E-RABModifyRequest.h" -#include "S1ap-E-RABModifyResponse.h" -#include "S1ap-E-RABReleaseIndication.h" -#include "S1ap-E-RABReleaseCommand.h" -#include "S1ap-E-RABReleaseResponse.h" -#include "S1ap-InitialContextSetupRequest.h" -#include "S1ap-InitialContextSetupResponse.h" -#include "S1ap-InitialContextSetupFailure.h" -#include "S1ap-UEContextReleaseRequest.h" -#include "S1ap-Paging.h" -#include "S1ap-DownlinkNASTransport.h" -#include "S1ap-InitialUEMessage.h" #include "S1ap-UplinkNASTransport.h" -#include "S1ap-NASNonDeliveryIndication.h" -#include "S1ap-HandoverCancel.h" -#include "S1ap-HandoverCancelAcknowledge.h" -#include "S1ap-Reset.h" -#include "S1ap-ResetAcknowledge.h" -#include "S1ap-S1SetupResponse.h" -#include "S1ap-S1SetupRequest.h" -#include "S1ap-S1SetupFailure.h" -#include "S1ap-ErrorIndication.h" -#include "S1ap-ENBConfigurationUpdate.h" -#include "S1ap-ENBConfigurationUpdateAcknowledge.h" -#include "S1ap-ENBConfigurationUpdateFailure.h" -#include "S1ap-MMEConfigurationUpdate.h" -#include "S1ap-MMEConfigurationUpdateAcknowledge.h" -#include "S1ap-MMEConfigurationUpdateFailure.h" -#include "S1ap-DownlinkS1cdma2000tunneling.h" +#include "S1ap-UplinkNonUEAssociatedLPPaTransport.h" #include "S1ap-UplinkS1cdma2000tunneling.h" -#include "S1ap-UEContextModificationRequest.h" -#include "S1ap-UEContextModificationResponse.h" -#include "S1ap-UEContextModificationFailure.h" -#include "S1ap-UECapabilityInfoIndication.h" -#include "S1ap-UEContextReleaseCommand.h" -#include "S1ap-UEContextReleaseComplete.h" -#include "S1ap-ENBStatusTransfer.h" -#include "S1ap-MMEStatusTransfer.h" -#include "S1ap-DeactivateTrace.h" -#include "S1ap-TraceStart.h" -#include "S1ap-TraceFailureIndication.h" -#include "S1ap-CellTrafficTrace.h" -#include "S1ap-LocationReportingControl.h" -#include "S1ap-LocationReportingFailureIndication.h" -#include "S1ap-LocationReport.h" -#include "S1ap-OverloadStart.h" -#include "S1ap-OverloadStop.h" +#include "S1ap-UplinkUEAssociatedLPPaTransport.h" +#include "S1ap-WarningAreaList.h" +#include "S1ap-WarningMessageContents.h" +#include "S1ap-WarningSecurityInfo.h" +#include "S1ap-WarningType.h" #include "S1ap-WriteReplaceWarningRequest.h" #include "S1ap-WriteReplaceWarningResponse.h" -#include "S1ap-ENBDirectInformationTransfer.h" -#include "S1ap-MMEDirectInformationTransfer.h" -#include "S1ap-ENBConfigurationTransfer.h" -#include "S1ap-MMEConfigurationTransfer.h" -#include "S1ap-PrivateMessage.h" -#include "S1ap-E-RABReleaseItemBearerRelComp.h" -#include "S1ap-E-RABToBeSwitchedDLList.h" -#include "S1ap-E-RABToBeSwitchedDLItem.h" -#include "S1ap-E-RABToBeSwitchedULList.h" -#include "S1ap-E-RABToBeSwitchedULItem.h" -#include "S1ap-E-RABToBeSetupListBearerSUReq.h" -#include "S1ap-E-RABToBeSetupItemBearerSUReq.h" -#include "S1ap-E-RABDataForwardingList.h" -#include "S1ap-E-RABDataForwardingItem.h" -#include "S1ap-E-RABToBeSetupListHOReq.h" -#include "S1ap-E-RABToBeSetupItemHOReq.h" -#include "S1ap-E-RABAdmittedList.h" -#include "S1ap-E-RABAdmittedItem.h" -#include "S1ap-E-RABFailedtoSetupListHOReqAck.h" -#include "S1ap-E-RABToBeSetupItemCtxtSUReq.h" -#include "S1ap-E-RABToBeSetupListCtxtSUReq.h" -#include "S1ap-E-RABSetupItemBearerSURes.h" -#include "S1ap-E-RABSetupListBearerSURes.h" -#include "S1ap-E-RABSetupItemCtxtSURes.h" -#include "S1ap-E-RABSetupListCtxtSURes.h" -#include "S1ap-E-RABReleaseListBearerRelComp.h" -#include "S1ap-E-RABModifyItemBearerModRes.h" -#include "S1ap-E-RABModifyListBearerModRes.h" -#include "S1ap-E-RABFailedToSetupItemHOReqAck.h" -#include "S1ap-E-RABToBeModifiedItemBearerModReq.h" -#include "S1ap-E-RABToBeModifiedListBearerModReq.h" -#include "S1ap-UE-associatedLogicalS1-ConnectionListResAck.h" -#include "S1ap-IE.h" +#include "S1ap-X2TNLConfigurationInfo.h" + #include "S1AP-PDU.h" -// UPDATE RELEASE 9 -# include "S1ap-BroadcastCancelledAreaList.h" -# include "S1ap-CancelledCellinEAI.h" -# include "S1ap-CancelledCellinEAI-Item.h" -# include "S1ap-CancelledCellinTAI.h" -# include "S1ap-CancelledCellinTAI-Item.h" -# include "S1ap-CellAccessMode.h" -# include "S1ap-CellID-Cancelled.h" -# include "S1ap-CellID-Cancelled-Item.h" -# include "S1ap-ConcurrentWarningMessageIndicator.h" -# include "S1ap-CSGMembershipStatus.h" -# include "S1ap-Data-Forwarding-Not-Possible.h" -# include "S1ap-EmergencyAreaID-Cancelled.h" -# include "S1ap-EmergencyAreaID-Cancelled-Item.h" -# include "S1ap-E-RABList.h" -# include "S1ap-EUTRANRoundTripDelayEstimationInfo.h" -# include "S1ap-ExtendedRepetitionPeriod.h" -# include "S1ap-LPPa-PDU.h" -# include "S1ap-PS-ServiceNotAvailable.h" -# include "S1ap-Routing-ID.h" -# include "S1ap-StratumLevel.h" -# include "S1ap-SynchronizationStatus.h" -# include "S1ap-TimeSynchronizationInfo.h" -# include "S1ap-TAI-Cancelled.h" -# include "S1ap-TAI-Cancelled-Item.h" -# include "S1ap-KillRequest.h" -# include "S1ap-KillResponse.h" -# include "S1ap-DownlinkUEAssociatedLPPaTransport.h" -# include "S1ap-UplinkUEAssociatedLPPaTransport.h" -# include "S1ap-DownlinkNonUEAssociatedLPPaTransport.h" -# include "S1ap-UplinkNonUEAssociatedLPPaTransport.h" - -// UPDATE RELEASE 10 -# include "S1ap-PagingPriority.h" -# include "S1ap-RelayNode-Indicator.h" -# include "S1ap-GWContextReleaseIndication.h" -# include "S1ap-MMERelaySupportIndicator.h" -# include "S1ap-ManagementBasedMDTAllowed.h" -# include "S1ap-PrivacyIndicator.h" -# include "S1ap-TrafficLoadReductionIndication.h" -# include "S1ap-GUMMEIList.h" - -/* Checking version of ASN1C compiler */ -#if (ASN1C_ENVIRONMENT_VERSION < ASN1C_MINIMUM_VERSION) -# error "You are compiling s1ap with the wrong version of ASN1C" #endif - -extern int asn_debug; -extern int asn1_xer_print; -extern void free_wrapper(void *ptr); - -#if 0 /* modified by acetcom */ -# include "mme_default_values.h" -# include "common_types.h" -#endif - -//Forward declaration -struct s1ap_message_s; - -/** \brief Function callback prototype. - **/ -#if 0 /* modified by acetcom */ -typedef int (*s1ap_message_decoded_callback)( - const sctp_assoc_id_t assoc_id, - const sctp_stream_id_t stream, - struct s1ap_message_s *message_p -); -#endif - -/** \brief Encode a successfull outcome message - \param buffer pointer to buffer in which data will be encoded - \param length pointer to the length of buffer - \param procedureCode Procedure code for the message - \param criticality Criticality of the message - \param td ASN1C type descriptor of the sptr - \param sptr Dereferenced pointer to the structure to encode - @returns size in bytes encded on success or 0 on failure - **/ -ssize_t s1ap_generate_successfull_outcome( - uint8_t **buffer, - uint32_t *length, - e_S1ap_ProcedureCode procedureCode, - S1ap_Criticality_t criticality, - asn_TYPE_descriptor_t *td, - void *sptr); - -/** \brief Encode an initiating message - \param buffer pointer to buffer in which data will be encoded - \param length pointer to the length of buffer - \param procedureCode Procedure code for the message - \param criticality Criticality of the message - \param td ASN1C type descriptor of the sptr - \param sptr Dereferenced pointer to the structure to encode - @returns size in bytes encded on success or 0 on failure - **/ -ssize_t s1ap_generate_initiating_message( - uint8_t **buffer, - uint32_t *length, - e_S1ap_ProcedureCode procedureCode, - S1ap_Criticality_t criticality, - asn_TYPE_descriptor_t *td, - void *sptr); - -/** \brief Encode an unsuccessfull outcome message - \param buffer pointer to buffer in which data will be encoded - \param length pointer to the length of buffer - \param procedureCode Procedure code for the message - \param criticality Criticality of the message - \param td ASN1C type descriptor of the sptr - \param sptr Dereferenced pointer to the structure to encode - @returns size in bytes encded on success or 0 on failure - **/ -ssize_t s1ap_generate_unsuccessfull_outcome( - uint8_t **buffer, - uint32_t *length, - e_S1ap_ProcedureCode procedureCode, - S1ap_Criticality_t criticality, - asn_TYPE_descriptor_t *td, - void *sptr); - -/** \brief Generate a new IE - \param id Protocol ie id of the IE - \param criticality Criticality of the IE - \param type ASN1 type descriptor of the IE value - \param sptr Structure to be encoded in the value field - @returns a pointer to the newly created IE structure or NULL in case of failure - **/ -S1ap_IE_t *s1ap_new_ie(S1ap_ProtocolIE_ID_t id, - S1ap_Criticality_t criticality, - asn_TYPE_descriptor_t *type, - void *sptr); - -/** \brief Handle criticality - \param criticality Criticality of the IE - @returns void - **/ -void s1ap_handle_criticality(S1ap_Criticality_t criticality); - -#endif /* FILE_S1AP_COMMON_SEEN */ diff --git a/lib/asn/src/s1ap_common.c b/lib/asn/src/s1ap_common.c deleted file mode 100644 index 5186772b73..0000000000 --- a/lib/asn/src/s1ap_common.c +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the Apache License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - - -/*! \file s1ap_common.c - \brief s1ap procedures for both eNB and MME - \author Sebastien ROUX - \date 2012 - \version 0.1 -*/ - -#include "s1ap_common.h" -#include "S1AP-PDU.h" -#if 0 /* modified by acetcom */ -#include "dynamic_memory_check.h" -#include "log.h" -#else -#include "core_debug.h" -#endif - -int asn_debug = 0; -int asn1_xer_print = 0; - -void free_wrapper(void *ptr) -{ - free(ptr); - ptr = NULL; -} - -ssize_t -s1ap_generate_initiating_message ( - uint8_t ** buffer, - uint32_t * length, - e_S1ap_ProcedureCode procedureCode, - S1ap_Criticality_t criticality, - asn_TYPE_descriptor_t * td, - void *sptr) -{ - S1AP_PDU_t pdu; - ssize_t encoded; - - memset (&pdu, 0, sizeof (S1AP_PDU_t)); - pdu.present = S1AP_PDU_PR_initiatingMessage; - pdu.choice.initiatingMessage.procedureCode = procedureCode; - pdu.choice.initiatingMessage.criticality = criticality; - ANY_fromType_aper (&pdu.choice.initiatingMessage.value, td, sptr); - - if (asn1_xer_print) { - xer_fprint (stdout, &asn_DEF_S1AP_PDU, (void *)&pdu); - } - - /* - * We can safely free list of IE from sptr - */ - ASN_STRUCT_FREE_CONTENTS_ONLY (*td, sptr); - - if ((encoded = aper_encode_to_new_buffer (&asn_DEF_S1AP_PDU, 0, &pdu, (void **)buffer)) < 0) { - d_error("Encoding of %s failed\n", td->name); - return -1; - } - - *length = encoded; - return encoded; -} - -ssize_t -s1ap_generate_successfull_outcome ( - uint8_t ** buffer, - uint32_t * length, - e_S1ap_ProcedureCode procedureCode, - S1ap_Criticality_t criticality, - asn_TYPE_descriptor_t * td, - void *sptr) -{ - S1AP_PDU_t pdu; - ssize_t encoded; - - memset (&pdu, 0, sizeof (S1AP_PDU_t)); - pdu.present = S1AP_PDU_PR_successfulOutcome; - pdu.choice.successfulOutcome.procedureCode = procedureCode; - pdu.choice.successfulOutcome.criticality = criticality; - ANY_fromType_aper (&pdu.choice.successfulOutcome.value, td, sptr); - - if (asn1_xer_print) { - xer_fprint (stdout, &asn_DEF_S1AP_PDU, (void *)&pdu); - } - - /* - * We can safely free list of IE from sptr - */ - ASN_STRUCT_FREE_CONTENTS_ONLY (*td, sptr); - - if ((encoded = aper_encode_to_new_buffer (&asn_DEF_S1AP_PDU, 0, &pdu, (void **)buffer)) < 0) { - d_error("Encoding of %s failed\n", td->name); - return -1; - } - - *length = encoded; - return encoded; -} - -ssize_t -s1ap_generate_unsuccessfull_outcome ( - uint8_t ** buffer, - uint32_t * length, - e_S1ap_ProcedureCode procedureCode, - S1ap_Criticality_t criticality, - asn_TYPE_descriptor_t * td, - void *sptr) -{ - S1AP_PDU_t pdu; - ssize_t encoded; - - memset (&pdu, 0, sizeof (S1AP_PDU_t)); - pdu.present = S1AP_PDU_PR_unsuccessfulOutcome; - pdu.choice.successfulOutcome.procedureCode = procedureCode; - pdu.choice.successfulOutcome.criticality = criticality; - ANY_fromType_aper (&pdu.choice.successfulOutcome.value, td, sptr); - - if (asn1_xer_print) { - xer_fprint (stdout, &asn_DEF_S1AP_PDU, (void *)&pdu); - } - - /* - * We can safely free list of IE from sptr - */ - ASN_STRUCT_FREE_CONTENTS_ONLY (*td, sptr); - - if ((encoded = aper_encode_to_new_buffer (&asn_DEF_S1AP_PDU, 0, &pdu, (void **)buffer)) < 0) { - d_error("Encoding of %s failed\n", td->name); - return -1; - } - - *length = encoded; - return encoded; -} - -S1ap_IE_t * -s1ap_new_ie ( - S1ap_ProtocolIE_ID_t id, - S1ap_Criticality_t criticality, - asn_TYPE_descriptor_t * type, - void *sptr) -{ - S1ap_IE_t *buff; - - if ((buff = malloc (sizeof (S1ap_IE_t))) == NULL) { - // Possible error on malloc - return NULL; - } - - memset ((void *)buff, 0, sizeof (S1ap_IE_t)); - buff->id = id; - buff->criticality = criticality; - - if (ANY_fromType_aper (&buff->value, type, sptr) < 0) { - d_error("Encoding of %s failed\n", type->name); - free_wrapper (buff); - return NULL; - } - - if (asn1_xer_print) - if (xer_fprint (stdout, &asn_DEF_S1ap_IE, buff) < 0) { - free_wrapper (buff); - return NULL; - } - - return buff; -} - -void -s1ap_handle_criticality ( - S1ap_Criticality_t criticality) -{ -} diff --git a/lib/asn/src/s1ap_decoder.c b/lib/asn/src/s1ap_decoder.c new file mode 100644 index 0000000000..f9d39696d0 --- /dev/null +++ b/lib/asn/src/s1ap_decoder.c @@ -0,0 +1,227 @@ +#include "core_debug.h" + +#include "s1ap_codecs.h" + +void free_wrapper(void *ptr) +{ + free(ptr); + ptr = NULL; +} + +static status_t s1ap_decode_initiating(s1ap_message *message, + S1ap_InitiatingMessage_t *initiating_p) +{ + status_t ret; + char *message_string = NULL; + + d_assert(initiating_p != NULL, return -1, "Null param"); + message_string = calloc (10000, sizeof (char)); + s1ap_string_total_size = 0; + + switch (initiating_p->procedureCode) + { + case S1ap_ProcedureCode_id_uplinkNASTransport: + { + ret = s1ap_decode_s1ap_uplinknastransport_ies( + &message->msg.s1ap_UplinkNASTransport_IEs, + &initiating_p->value); + s1ap_xer_print_s1ap_uplinknastransport(s1ap_xer__print2sp, + message_string, message); + } + break; + + case S1ap_ProcedureCode_id_S1Setup: + { + ret = s1ap_decode_s1ap_s1setuprequesties( + &message->msg.s1ap_S1SetupRequestIEs, + &initiating_p->value); + s1ap_xer_print_s1ap_s1setuprequest(s1ap_xer__print2sp, + message_string, message); + } + break; + + case S1ap_ProcedureCode_id_initialUEMessage: + { + ret = s1ap_decode_s1ap_initialuemessage_ies( + &message->msg.s1ap_InitialUEMessage_IEs, + &initiating_p->value); + s1ap_xer_print_s1ap_initialuemessage(s1ap_xer__print2sp, + message_string, message); + } + break; + + case S1ap_ProcedureCode_id_UEContextReleaseRequest: + { + ret = s1ap_decode_s1ap_uecontextreleaserequest_ies( + &message->msg.s1ap_UEContextReleaseRequest_IEs, &initiating_p->value); + s1ap_xer_print_s1ap_uecontextreleaserequest( + s1ap_xer__print2sp, message_string, message); + } + break; + + case S1ap_ProcedureCode_id_UECapabilityInfoIndication: + { + ret = s1ap_decode_s1ap_uecapabilityinfoindicationies( + &message->msg.s1ap_UECapabilityInfoIndicationIEs, + &initiating_p->value); + s1ap_xer_print_s1ap_uecapabilityinfoindication( + s1ap_xer__print2sp, message_string, message); + } + break; + + case S1ap_ProcedureCode_id_NASNonDeliveryIndication: + { + ret = s1ap_decode_s1ap_nasnondeliveryindication_ies( + &message->msg.s1ap_NASNonDeliveryIndication_IEs, + &initiating_p->value); + s1ap_xer_print_s1ap_nasnondeliveryindication( + s1ap_xer__print2sp, message_string, message); + } + break; + + default: + { + d_error("Unknown procedure ID (%d) for initiating message\n", + (int)initiating_p->procedureCode); + d_assert(0, return CORE_ERROR, + "Unknown procedure ID (%d) for initiating message\n", + (int)initiating_p->procedureCode); + } + break; + } + + printf("%s\n", message_string); + free_wrapper (message_string); + return ret; +} + +static status_t s1ap_decode_successfull_outcome(s1ap_message *message, + S1ap_SuccessfulOutcome_t *successfullOutcome_p) +{ + status_t ret = CORE_ERROR; + char *message_string = NULL; + + d_assert(successfullOutcome_p != NULL, return -1, "Null param"); + message_string = calloc (10000, sizeof (char)); + s1ap_string_total_size = 0; + + switch (successfullOutcome_p->procedureCode) + { + case S1ap_ProcedureCode_id_InitialContextSetup: + { + ret = s1ap_decode_s1ap_initialcontextsetupresponseies( + &message->msg.s1ap_InitialContextSetupResponseIEs, + &successfullOutcome_p->value); + s1ap_xer_print_s1ap_initialcontextsetupresponse(s1ap_xer__print2sp, + message_string, message); + } + break; + + case S1ap_ProcedureCode_id_UEContextRelease: + { + ret = s1ap_decode_s1ap_uecontextreleasecomplete_ies( + &message->msg.s1ap_UEContextReleaseComplete_IEs, + &successfullOutcome_p->value); + s1ap_xer_print_s1ap_uecontextreleasecomplete(s1ap_xer__print2sp, + message_string, message); + } + break; + + default: + d_error("Unknown procedure ID (%ld) for successfull " + "outcome message\n", successfullOutcome_p->procedureCode); + break; + } + + printf("%s\n", message_string); + free_wrapper (message_string); + return ret; +} + +static status_t s1ap_decode_unsuccessfull_outcome(s1ap_message *message, + S1ap_UnsuccessfulOutcome_t *unSuccessfulOutcome_p) +{ + status_t ret = -1; + char *message_string = NULL; + + d_assert(unSuccessfulOutcome_p != NULL, return -1, "Null param"); + message_string = calloc (10000, sizeof (char)); + s1ap_string_total_size = 0; + + switch (unSuccessfulOutcome_p->procedureCode) + { + case S1ap_ProcedureCode_id_InitialContextSetup: + { + ret = s1ap_decode_s1ap_initialcontextsetupfailureies( + &message->msg.s1ap_InitialContextSetupFailureIEs, + &unSuccessfulOutcome_p->value); + s1ap_xer_print_s1ap_initialcontextsetupfailure(s1ap_xer__print2sp, + message_string, message); + } + break; + + default: + { + d_error("Unknown procedure ID (%d) for " + "unsuccessfull outcome message\n", + (int)unSuccessfulOutcome_p->procedureCode); + } + break; + } + + printf("%s\n", message_string); + free_wrapper (message_string); + return ret; +} + +status_t s1ap_parse_pdu(s1ap_message *message, uint8_t *buffer, uint32_t len) +{ + S1AP_PDU_t pdu = {0}; + S1AP_PDU_t *pdu_p = &pdu; + asn_dec_rval_t dec_ret = {0}; + + d_assert(buffer != NULL, return CORE_ERROR, "Null param"); + memset((void *)pdu_p, 0, sizeof(S1AP_PDU_t)); + dec_ret = aper_decode(NULL, &asn_DEF_S1AP_PDU, (void **)&pdu_p, + buffer, len, 0, 0); + + if (dec_ret.code != RC_OK) + { + d_error("Failed to decode PDU\n"); + return CORE_ERROR; + } + + memset(message, 0, sizeof(s1ap_message)); + + message->direction = pdu_p->present; + + switch (pdu_p->present) + { + case S1AP_PDU_PR_initiatingMessage: + { + return s1ap_decode_initiating(message, + &pdu_p->choice.initiatingMessage); + } + + case S1AP_PDU_PR_successfulOutcome: + { + return s1ap_decode_successfull_outcome(message, + &pdu_p->choice.successfulOutcome); + } + + case S1AP_PDU_PR_unsuccessfulOutcome: + { + return s1ap_decode_unsuccessfull_outcome(message, + &pdu_p->choice.unsuccessfulOutcome); + } + + default: + { + d_error("Unknown message outcome (%d) or not implemented", + (int)pdu_p->present); + break; + } + } + + return CORE_ERROR; +} diff --git a/lib/asn/src/s1ap_encoder.c b/lib/asn/src/s1ap_encoder.c new file mode 100644 index 0000000000..c3c071edda --- /dev/null +++ b/lib/asn/src/s1ap_encoder.c @@ -0,0 +1,286 @@ +#include "core_debug.h" + +#include "s1ap_codecs.h" + +extern void free_wrapper(void *ptr); + +ssize_t s1ap_generate_initiating_message(uint8_t **buffer, uint32_t *length, + e_S1ap_ProcedureCode procedureCode, S1ap_Criticality_t criticality, + asn_TYPE_descriptor_t * td, void *sptr) +{ + S1AP_PDU_t pdu; + ssize_t encoded; + + memset(&pdu, 0, sizeof (S1AP_PDU_t)); + pdu.present = S1AP_PDU_PR_initiatingMessage; + pdu.choice.initiatingMessage.procedureCode = procedureCode; + pdu.choice.initiatingMessage.criticality = criticality; + ANY_fromType_aper(&pdu.choice.initiatingMessage.value, td, sptr); + + /* + * We can safely free list of IE from sptr + */ + ASN_STRUCT_FREE_CONTENTS_ONLY (*td, sptr); + + if ((encoded = aper_encode_to_new_buffer( + &asn_DEF_S1AP_PDU, 0, &pdu, (void **)buffer)) < 0) + { + d_error("Encoding of %s failed\n", td->name); + return CORE_ERROR; + } + + *length = encoded; + return encoded; +} + +ssize_t s1ap_generate_successfull_outcome(uint8_t **buffer, uint32_t *length, + e_S1ap_ProcedureCode procedureCode, S1ap_Criticality_t criticality, + asn_TYPE_descriptor_t * td, void *sptr) +{ + S1AP_PDU_t pdu; + ssize_t encoded; + + memset(&pdu, 0, sizeof (S1AP_PDU_t)); + pdu.present = S1AP_PDU_PR_successfulOutcome; + pdu.choice.successfulOutcome.procedureCode = procedureCode; + pdu.choice.successfulOutcome.criticality = criticality; + ANY_fromType_aper(&pdu.choice.successfulOutcome.value, td, sptr); + + /* + * We can safely free list of IE from sptr + */ + ASN_STRUCT_FREE_CONTENTS_ONLY (*td, sptr); + + if ((encoded = aper_encode_to_new_buffer ( + &asn_DEF_S1AP_PDU, 0, &pdu, (void **)buffer)) < 0) + { + d_error("Encoding of %s failed\n", td->name); + return CORE_ERROR; + } + + *length = encoded; + return encoded; +} + +ssize_t s1ap_generate_unsuccessfull_outcome(uint8_t **buffer, uint32_t *length, + e_S1ap_ProcedureCode procedureCode, S1ap_Criticality_t criticality, + asn_TYPE_descriptor_t * td, void *sptr) +{ + S1AP_PDU_t pdu; + ssize_t encoded; + + memset(&pdu, 0, sizeof (S1AP_PDU_t)); + pdu.present = S1AP_PDU_PR_unsuccessfulOutcome; + pdu.choice.successfulOutcome.procedureCode = procedureCode; + pdu.choice.successfulOutcome.criticality = criticality; + ANY_fromType_aper(&pdu.choice.successfulOutcome.value, td, sptr); + + /* + * We can safely free list of IE from sptr + */ + ASN_STRUCT_FREE_CONTENTS_ONLY (*td, sptr); + + if ((encoded = aper_encode_to_new_buffer( + &asn_DEF_S1AP_PDU, 0, &pdu, (void **)buffer)) < 0) + { + d_error("Encoding of %s failed\n", td->name); + return CORE_ERROR; + } + + *length = encoded; + return encoded; +} + +static inline int s1ap_encode_initial_context_setup_request( + s1ap_message *message_p, uint8_t **buffer, uint32_t *length) +{ + S1ap_InitialContextSetupRequest_t initialContextSetupRequest; + S1ap_InitialContextSetupRequest_t *initialContextSetupRequest_p = + &initialContextSetupRequest; + + memset(initialContextSetupRequest_p, 0, + sizeof(S1ap_InitialContextSetupRequest_t)); + + if (s1ap_encode_s1ap_initialcontextsetuprequesties( + initialContextSetupRequest_p, + &message_p->msg.s1ap_InitialContextSetupRequestIEs) < 0) + { + return CORE_ERROR; + } + + return s1ap_generate_initiating_message(buffer, length, + S1ap_ProcedureCode_id_InitialContextSetup, + S1ap_Criticality_reject, &asn_DEF_S1ap_InitialContextSetupRequest, + initialContextSetupRequest_p); +} + +static inline int s1ap_encode_s1setupresponse( + s1ap_message *message_p, uint8_t **buffer, uint32_t *length) +{ + S1ap_S1SetupResponse_t s1SetupResponse; + S1ap_S1SetupResponse_t *s1SetupResponse_p = &s1SetupResponse; + + memset(s1SetupResponse_p, 0, sizeof (S1ap_S1SetupResponse_t)); + + if (s1ap_encode_s1ap_s1setupresponseies( + s1SetupResponse_p, &message_p->msg.s1ap_S1SetupResponseIEs) < 0) + { + return CORE_ERROR; + } + + return s1ap_generate_successfull_outcome(buffer, length, + S1ap_ProcedureCode_id_S1Setup, message_p->criticality, + &asn_DEF_S1ap_S1SetupResponse, s1SetupResponse_p); +} + +static inline int s1ap_encode_s1setupfailure( + s1ap_message *message_p, uint8_t **buffer, uint32_t *length) +{ + S1ap_S1SetupFailure_t s1SetupFailure; + S1ap_S1SetupFailure_t *s1SetupFailure_p = &s1SetupFailure; + + memset(s1SetupFailure_p, 0, sizeof (S1ap_S1SetupFailure_t)); + + if (s1ap_encode_s1ap_s1setupfailureies( + s1SetupFailure_p, &message_p->msg.s1ap_S1SetupFailureIEs) < 0) + { + return CORE_ERROR; + } + + return s1ap_generate_unsuccessfull_outcome(buffer, length, + S1ap_ProcedureCode_id_S1Setup, message_p->criticality, + &asn_DEF_S1ap_S1SetupFailure, s1SetupFailure_p); +} + +static inline int s1ap_encode_downlink_nas_transport( + s1ap_message *message_p, uint8_t **buffer, uint32_t *length) +{ + S1ap_DownlinkNASTransport_t downlinkNasTransport; + S1ap_DownlinkNASTransport_t *downlinkNasTransport_p = &downlinkNasTransport; + + memset(downlinkNasTransport_p, 0, sizeof(S1ap_DownlinkNASTransport_t)); + + /* + * Convert IE structure into asn1 message_p + */ + if (s1ap_encode_s1ap_downlinknastransport_ies( downlinkNasTransport_p, + &message_p->msg.s1ap_DownlinkNASTransport_IEs) < 0) + { + return CORE_ERROR; + } + + /* + * Generate Initiating message_p for the list of IEs + */ + return s1ap_generate_initiating_message(buffer, length, + S1ap_ProcedureCode_id_downlinkNASTransport, message_p->criticality, + &asn_DEF_S1ap_DownlinkNASTransport, downlinkNasTransport_p); +} + +static inline int s1ap_encode_ue_context_release_command ( + s1ap_message *message_p, uint8_t **buffer, uint32_t *length) +{ + S1ap_UEContextReleaseCommand_t ueContextReleaseCommand; + S1ap_UEContextReleaseCommand_t *ueContextReleaseCommand_p = + &ueContextReleaseCommand; + + memset(ueContextReleaseCommand_p, 0, + sizeof(S1ap_UEContextReleaseCommand_t)); + + /* + * Convert IE structure into asn1 message_p + */ + if (s1ap_encode_s1ap_uecontextreleasecommand_ies(ueContextReleaseCommand_p, + &message_p->msg.s1ap_UEContextReleaseCommand_IEs) < 0) + { + return CORE_ERROR; + } + + return s1ap_generate_initiating_message(buffer, length, + S1ap_ProcedureCode_id_UEContextRelease, message_p->criticality, + &asn_DEF_S1ap_UEContextReleaseCommand, ueContextReleaseCommand_p); +} + +static inline int s1ap_encode_initiating( + s1ap_message *message_p, uint8_t **buffer, uint32_t *length) +{ + switch (message_p->procedureCode) + { + case S1ap_ProcedureCode_id_downlinkNASTransport: + return s1ap_encode_downlink_nas_transport( + message_p, buffer, length); + + case S1ap_ProcedureCode_id_InitialContextSetup: + return s1ap_encode_initial_context_setup_request( + message_p, buffer, length); + + case S1ap_ProcedureCode_id_UEContextRelease: + return s1ap_encode_ue_context_release_command ( + message_p, buffer, length); + + default: + d_warn("Unknown procedure ID (%d) for initiating message_p\n", + (int)message_p->procedureCode); + break; + } + + return CORE_ERROR; +} + +static inline int s1ap_encode_successfull_outcome ( + s1ap_message *message_p, uint8_t **buffer, uint32_t *length) +{ + switch (message_p->procedureCode) + { + case S1ap_ProcedureCode_id_S1Setup: + return s1ap_encode_s1setupresponse(message_p, buffer, length); + + default: + d_warn("Unknown procedure ID (%d) for successfull " + "outcome message\n", (int)message_p->procedureCode); + break; + } + + return CORE_ERROR; +} + +static inline int s1ap_encode_unsuccessfull_outcome( + s1ap_message *message_p, uint8_t **buffer, uint32_t *length) +{ + switch (message_p->procedureCode) { + case S1ap_ProcedureCode_id_S1Setup: + return s1ap_encode_s1setupfailure(message_p, buffer, length); + + default: + d_warn("Unknown procedure ID (%d) for unsuccessfull " + "outcome message\n", (int)message_p->procedureCode); + break; + } + + return CORE_ERROR; +} + +int s1ap_build_pdu(s1ap_message *message_p, uint8_t **buffer, uint32_t *length) +{ + d_assert (message_p != NULL, return CORE_ERROR, "Null param"); + d_assert (buffer != NULL, return CORE_ERROR, "Null param"); + d_assert (length != NULL, return CORE_ERROR, "Null param"); + + switch (message_p->direction) { + case S1AP_PDU_PR_initiatingMessage: + return s1ap_encode_initiating(message_p, buffer, length); + + case S1AP_PDU_PR_successfulOutcome: + return s1ap_encode_successfull_outcome(message_p, buffer, length); + + case S1AP_PDU_PR_unsuccessfulOutcome: + return s1ap_encode_unsuccessfull_outcome(message_p, buffer, length); + + default: + d_warn("Unknown message outcome (%d) or not implemented", + (int)message_p->direction); + break; + } + + return CORE_ERROR; +} diff --git a/lib/asn/src/s1ap_ies_decoder.c b/lib/asn/src/s1ap_ies_decoder.c index 00bbfc9e05..6a49293395 100644 --- a/lib/asn/src/s1ap_ies_decoder.c +++ b/lib/asn/src/s1ap_ies_decoder.c @@ -34,7 +34,6 @@ * from ['S1AP-PDU.asn'] ******************************************************************************/ #define TRACE_MODULE ies_decoder -#include "s1ap_common.h" #include "s1ap_ies_defs.h" #include "core_debug.h" diff --git a/lib/asn/src/s1ap_ies_defs.h b/lib/asn/src/s1ap_ies_defs.h index 27678b9289..ca07fc91fa 100644 --- a/lib/asn/src/s1ap_ies_defs.h +++ b/lib/asn/src/s1ap_ies_defs.h @@ -33,7 +33,7 @@ * Created on: 2017-02-04 23:11:39.374543 by acetcom * from ['S1AP-PDU.asn'] ******************************************************************************/ -#include "s1ap_common.h" +#include "s1ap_asn1c.h" #ifndef S1AP_IES_DEFS_H_ #define S1AP_IES_DEFS_H_ @@ -3305,5 +3305,8 @@ int s1ap_xer__print2fp(const void *buffer, size_t size, void *app_key); extern size_t s1ap_string_total_size; +S1ap_IE_t *s1ap_new_ie(S1ap_ProtocolIE_ID_t id, S1ap_Criticality_t criticality, + asn_TYPE_descriptor_t *type, void *sptr); + #endif /* S1AP_IES_DEFS_H_ */ diff --git a/lib/asn/src/s1ap_ies_encoder.c b/lib/asn/src/s1ap_ies_encoder.c index 25f5113014..c862ec0d9b 100644 --- a/lib/asn/src/s1ap_ies_encoder.c +++ b/lib/asn/src/s1ap_ies_encoder.c @@ -33,7 +33,8 @@ * Created on: 2017-02-04 23:11:39.421820 by acetcom * from ['S1AP-PDU.asn'] ******************************************************************************/ -#include "s1ap_common.h" +#include "core_debug.h" + #include "s1ap_ies_defs.h" int s1ap_encode_s1ap_deactivatetraceies( @@ -4418,3 +4419,29 @@ int s1ap_encode_s1ap_ue_associatedlogicals1_connectionlistresack( return 0; } +S1ap_IE_t *s1ap_new_ie(S1ap_ProtocolIE_ID_t id, S1ap_Criticality_t criticality, + asn_TYPE_descriptor_t *type, void *sptr) +{ + S1ap_IE_t *buff; + + if ((buff = malloc (sizeof (S1ap_IE_t))) == NULL) + { + // Possible error on malloc + return NULL; + } + + memset((void *)buff, 0, sizeof(S1ap_IE_t)); + buff->id = id; + buff->criticality = criticality; + + if (ANY_fromType_aper(&buff->value, type, sptr) < 0) + { + d_error("Encoding of %s failed\n", type->name); + free (buff); + buff = NULL; + return NULL; + } + + return buff; +} + diff --git a/lib/asn/src/s1ap_ies_xer_print.c b/lib/asn/src/s1ap_ies_xer_print.c index e78c5a6769..1ffb0fbad6 100644 --- a/lib/asn/src/s1ap_ies_xer_print.c +++ b/lib/asn/src/s1ap_ies_xer_print.c @@ -39,7 +39,6 @@ #include #include -#include "s1ap_common.h" #include "s1ap_ies_defs.h" size_t s1ap_string_total_size = 0; diff --git a/lib/asn/src/s1ap_mme_decoder.c b/lib/asn/src/s1ap_mme_decoder.c deleted file mode 100644 index 7a2068f841..0000000000 --- a/lib/asn/src/s1ap_mme_decoder.c +++ /dev/null @@ -1,282 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the Apache License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - - -/*! \file s1ap_mme_decoder.c - \brief s1ap decode procedures for MME - \author Sebastien ROUX - \date 2012 - \version 0.1 -*/ - -#if 0 /* modified by acetcom */ -#include "assertions.h" -#endif -#include "s1ap_common.h" -#include "s1ap_ies_defs.h" -#include "s1ap_mme_decoder.h" -#if 0 /* modified by acetcom */ -#include "s1ap_mme_handlers.h" -#include "intertask_interface.h" -#include "assertions.h" -#include "dynamic_memory_check.h" -#include "log.h" -#else -#include "core_debug.h" -#endif - -static int -s1ap_mme_decode_initiating ( - s1ap_message *message, - S1ap_InitiatingMessage_t *initiating_p) { - int ret = -1; -#if 0 - MessageDef *message_p = NULL; -#endif - char *message_string = NULL; -#if 0 - size_t message_string_size; - MessagesIds message_id = MESSAGES_ID_MAX; -#endif - d_assert(initiating_p != NULL, return -1, "Null param"); - message_string = calloc (10000, sizeof (char)); - s1ap_string_total_size = 0; -#if 0 - message->procedureCode = initiating_p->procedureCode; - message->criticality = initiating_p->criticality; -#endif - - switch (initiating_p->procedureCode) { - case S1ap_ProcedureCode_id_uplinkNASTransport: { - ret = s1ap_decode_s1ap_uplinknastransport_ies (&message->msg.s1ap_UplinkNASTransport_IEs, &initiating_p->value); - s1ap_xer_print_s1ap_uplinknastransport (s1ap_xer__print2sp, message_string, message); -#if 0 - message_id = S1AP_UPLINK_NAS_LOG; -#endif - } - break; - - case S1ap_ProcedureCode_id_S1Setup: { - ret = s1ap_decode_s1ap_s1setuprequesties (&message->msg.s1ap_S1SetupRequestIEs, &initiating_p->value); - s1ap_xer_print_s1ap_s1setuprequest (s1ap_xer__print2sp, message_string, message); - printf("%s\n", message_string); -#if 0 - message_id = S1AP_S1_SETUP_LOG; -#endif - } - break; - - case S1ap_ProcedureCode_id_initialUEMessage: { - ret = s1ap_decode_s1ap_initialuemessage_ies (&message->msg.s1ap_InitialUEMessage_IEs, &initiating_p->value); - s1ap_xer_print_s1ap_initialuemessage (s1ap_xer__print2sp, message_string, message); - printf("%s\n", message_string); -#if 0 - message_id = S1AP_INITIAL_UE_MESSAGE_LOG; -#endif - } - break; - - case S1ap_ProcedureCode_id_UEContextReleaseRequest: { - ret = s1ap_decode_s1ap_uecontextreleaserequest_ies (&message->msg.s1ap_UEContextReleaseRequest_IEs, &initiating_p->value); - s1ap_xer_print_s1ap_uecontextreleaserequest (s1ap_xer__print2sp, message_string, message); -#if 0 - message_id = S1AP_UE_CONTEXT_RELEASE_REQ_LOG; -#endif - } - break; - - case S1ap_ProcedureCode_id_UECapabilityInfoIndication: { - ret = s1ap_decode_s1ap_uecapabilityinfoindicationies (&message->msg.s1ap_UECapabilityInfoIndicationIEs, &initiating_p->value); - s1ap_xer_print_s1ap_uecapabilityinfoindication (s1ap_xer__print2sp, message_string, message); -#if 0 - message_id = S1AP_UE_CAPABILITY_IND_LOG; -#endif - } - break; - - case S1ap_ProcedureCode_id_NASNonDeliveryIndication: { - ret = s1ap_decode_s1ap_nasnondeliveryindication_ies (&message->msg.s1ap_NASNonDeliveryIndication_IEs, &initiating_p->value); - s1ap_xer_print_s1ap_nasnondeliveryindication (s1ap_xer__print2sp, message_string, message); -#if 0 - message_id = S1AP_NAS_NON_DELIVERY_IND_LOG; -#endif - } - break; - - default: { - d_error("Unknown procedure ID (%d) for initiating message\n", (int)initiating_p->procedureCode); - d_assert(0, return -1, "Unknown procedure ID (%d) for initiating message\n", (int)initiating_p->procedureCode); - } - break; - } - -#if 0 - message_string_size = strlen (message_string); - message_p = itti_alloc_new_message_sized (TASK_S1AP, message_id, message_string_size + sizeof (IttiMsgText)); - message_p->ittiMsg.s1ap_uplink_nas_log.size = message_string_size; - memcpy (&message_p->ittiMsg.s1ap_uplink_nas_log.text, message_string, message_string_size); - itti_send_msg_to_task (TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); -#endif - free_wrapper (message_string); - return ret; -} - -static int -s1ap_mme_decode_successfull_outcome ( - s1ap_message *message, - S1ap_SuccessfulOutcome_t *successfullOutcome_p) { - int ret = -1; -#if 0 - MessageDef *message_p = NULL; -#endif - char *message_string = NULL; -#if 0 - size_t message_string_size = 0; - MessagesIds message_id = MESSAGES_ID_MAX; -#endif - d_assert(successfullOutcome_p != NULL, return -1, "Null param"); - message_string = calloc (10000, sizeof (char)); - s1ap_string_total_size = 0; -#if 0 - message->procedureCode = successfullOutcome_p->procedureCode; - message->criticality = successfullOutcome_p->criticality; -#endif - - switch (successfullOutcome_p->procedureCode) { - case S1ap_ProcedureCode_id_InitialContextSetup: { - ret = s1ap_decode_s1ap_initialcontextsetupresponseies (&message->msg.s1ap_InitialContextSetupResponseIEs, &successfullOutcome_p->value); - s1ap_xer_print_s1ap_initialcontextsetupresponse (s1ap_xer__print2sp, message_string, message); - printf("%s\n", message_string); -#if 0 - message_id = S1AP_INITIAL_CONTEXT_SETUP_LOG; -#endif - } - break; - - case S1ap_ProcedureCode_id_UEContextRelease: { - ret = s1ap_decode_s1ap_uecontextreleasecomplete_ies (&message->msg.s1ap_UEContextReleaseComplete_IEs, &successfullOutcome_p->value); - s1ap_xer_print_s1ap_uecontextreleasecomplete (s1ap_xer__print2sp, message_string, message); -#if 0 - message_id = S1AP_UE_CONTEXT_RELEASE_LOG; -#endif - } - break; - - default: { - d_error("Unknown procedure ID (%ld) for successfull outcome message\n", successfullOutcome_p->procedureCode); - } - break; - } - -#if 0 - message_string_size = strlen (message_string); - message_p = itti_alloc_new_message_sized (TASK_S1AP, message_id, message_string_size + sizeof (IttiMsgText)); - message_p->ittiMsg.s1ap_initial_context_setup_log.size = message_string_size; - memcpy (&message_p->ittiMsg.s1ap_initial_context_setup_log.text, message_string, message_string_size); - itti_send_msg_to_task (TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); -#endif - free_wrapper (message_string); - return ret; -} - -static int -s1ap_mme_decode_unsuccessfull_outcome ( - s1ap_message *message, - S1ap_UnsuccessfulOutcome_t *unSuccessfulOutcome_p) { - int ret = -1; -#if 0 - MessageDef *message_p = NULL; -#endif - char *message_string = NULL; -#if 0 - size_t message_string_size = 0; - MessagesIds message_id = MESSAGES_ID_MAX; -#endif - d_assert(unSuccessfulOutcome_p != NULL, return -1, "Null param"); - message_string = calloc (10000, sizeof (char)); - s1ap_string_total_size = 0; -#if 0 - message->procedureCode = unSuccessfulOutcome_p->procedureCode; - message->criticality = unSuccessfulOutcome_p->criticality; -#endif - - switch (unSuccessfulOutcome_p->procedureCode) { - case S1ap_ProcedureCode_id_InitialContextSetup: { - ret = s1ap_decode_s1ap_initialcontextsetupfailureies (&message->msg.s1ap_InitialContextSetupFailureIEs, &unSuccessfulOutcome_p->value); - s1ap_xer_print_s1ap_initialcontextsetupfailure (s1ap_xer__print2sp, message_string, message); -#if 0 - message_id = S1AP_INITIAL_CONTEXT_SETUP_LOG; -#endif - } - break; - - default: { - d_error("Unknown procedure ID (%d) for unsuccessfull outcome message\n", (int)unSuccessfulOutcome_p->procedureCode); - } - break; - } - -#if 0 - message_string_size = strlen (message_string); - message_p = itti_alloc_new_message_sized (TASK_S1AP, message_id, message_string_size + sizeof (IttiMsgText)); - message_p->ittiMsg.s1ap_initial_context_setup_log.size = message_string_size; - memcpy (&message_p->ittiMsg.s1ap_initial_context_setup_log.text, message_string, message_string_size); - itti_send_msg_to_task (TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); -#endif - free_wrapper (message_string); - return ret; -} - -int -s1ap_mme_decode_pdu ( - s1ap_message *message, - uint8_t *buffer, uint32_t len) { - S1AP_PDU_t pdu = {0}; - S1AP_PDU_t *pdu_p = &pdu; - asn_dec_rval_t dec_ret = {0}; - d_assert(buffer != NULL, return -1, "Null param"); - memset ((void *)pdu_p, 0, sizeof (S1AP_PDU_t)); - dec_ret = aper_decode (NULL, &asn_DEF_S1AP_PDU, (void **)&pdu_p, buffer, len, 0, 0); - - if (dec_ret.code != RC_OK) { - d_error("Failed to decode PDU\n"); - return -1; - } - - message->direction = pdu_p->present; - - switch (pdu_p->present) { - case S1AP_PDU_PR_initiatingMessage: - return s1ap_mme_decode_initiating (message, &pdu_p->choice.initiatingMessage); - - case S1AP_PDU_PR_successfulOutcome: - return s1ap_mme_decode_successfull_outcome (message, &pdu_p->choice.successfulOutcome); - - case S1AP_PDU_PR_unsuccessfulOutcome: - return s1ap_mme_decode_unsuccessfull_outcome (message, &pdu_p->choice.unsuccessfulOutcome); - - default: - d_error("Unknown message outcome (%d) or not implemented", (int)pdu_p->present); - break; - } - - return -1; -} diff --git a/lib/asn/src/s1ap_mme_decoder.h b/lib/asn/src/s1ap_mme_decoder.h deleted file mode 100644 index a3ca72a78e..0000000000 --- a/lib/asn/src/s1ap_mme_decoder.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the Apache License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - - - -#ifndef FILE_S1AP_MME_DECODER_SEEN -#define FILE_S1AP_MME_DECODER_SEEN -#if 0 /* modified by acetcom */ -#include "bstrlib.h" -#include "s1ap_common.h" -#include "s1ap_ies_defs.h" -#endif - -int s1ap_mme_decode_pdu(s1ap_message *message, uint8_t *buffer, uint32_t len) __attribute__ ((warn_unused_result)); - -#endif /* FILE_S1AP_MME_DECODER_SEEN */ diff --git a/lib/asn/src/s1ap_mme_encoder.c b/lib/asn/src/s1ap_mme_encoder.c deleted file mode 100644 index 5f6f4a70c7..0000000000 --- a/lib/asn/src/s1ap_mme_encoder.c +++ /dev/null @@ -1,264 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the Apache License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - - -/*! \file s1ap_mme_encoder.c - \brief s1ap encode procedures for MME - \author Sebastien ROUX - \date 2012 - \version 0.1 -*/ - -#if 0 /* modified by acetcom */ -#include "intertask_interface.h" -#endif - -#include "s1ap_common.h" -#include "s1ap_ies_defs.h" -#include "s1ap_mme_encoder.h" -#if 0 /* modified by acetcom */ -#include "s1ap_mme.h" -#include "assertions.h" -#include "log.h" -#else -#include "core_debug.h" -#endif - -static inline int s1ap_mme_encode_initial_context_setup_request ( - s1ap_message * message_p, - uint8_t ** buffer, - uint32_t * length); -static inline int s1ap_mme_encode_s1setupresponse ( - s1ap_message * message_p, - uint8_t ** buffer, - uint32_t * length); -static inline int s1ap_mme_encode_s1setupfailure ( - s1ap_message * message_p, - uint8_t ** buffer, - uint32_t * length); -static inline int s1ap_mme_encode_ue_context_release_command ( - s1ap_message * message_p, - uint8_t ** buffer, - uint32_t * length); -static inline int s1ap_mme_encode_downlink_nas_transport ( - s1ap_message * message_p, - uint8_t ** buffer, - uint32_t * length); - -static inline int s1ap_mme_encode_initiating ( - s1ap_message * message_p, - uint8_t ** buffer, - uint32_t * length); -static inline int s1ap_mme_encode_successfull_outcome ( - s1ap_message * message_p, - uint8_t ** buffer, - uint32_t * len); -static inline int s1ap_mme_encode_unsuccessfull_outcome ( - s1ap_message * message_p, - uint8_t ** buffer, - uint32_t * len); - -static inline int -s1ap_mme_encode_initial_context_setup_request ( - s1ap_message * message_p, - uint8_t ** buffer, - uint32_t * length) -{ - S1ap_InitialContextSetupRequest_t initialContextSetupRequest; - S1ap_InitialContextSetupRequest_t *initialContextSetupRequest_p = &initialContextSetupRequest; - - memset (initialContextSetupRequest_p, 0, sizeof (S1ap_InitialContextSetupRequest_t)); - - if (s1ap_encode_s1ap_initialcontextsetuprequesties (initialContextSetupRequest_p, &message_p->msg.s1ap_InitialContextSetupRequestIEs) < 0) { - return -1; - } - - return s1ap_generate_initiating_message (buffer, length, S1ap_ProcedureCode_id_InitialContextSetup, S1ap_Criticality_reject, &asn_DEF_S1ap_InitialContextSetupRequest, initialContextSetupRequest_p); -} - -int -s1ap_mme_encode_pdu ( - s1ap_message * message_p, - uint8_t ** buffer, - uint32_t * length) -{ - d_assert (message_p != NULL, return -1, "Null param"); - d_assert (buffer != NULL, return -1, "Null param"); - d_assert (length != NULL, return -1, "Null param"); - - switch (message_p->direction) { - case S1AP_PDU_PR_initiatingMessage: - return s1ap_mme_encode_initiating (message_p, buffer, length); - - case S1AP_PDU_PR_successfulOutcome: - return s1ap_mme_encode_successfull_outcome (message_p, buffer, length); - - case S1AP_PDU_PR_unsuccessfulOutcome: - return s1ap_mme_encode_unsuccessfull_outcome (message_p, buffer, length); - - default: - d_warn("Unknown message outcome (%d) or not implemented", (int)message_p->direction); - break; - } - - return -1; -} - -static inline int -s1ap_mme_encode_initiating ( - s1ap_message * message_p, - uint8_t ** buffer, - uint32_t * length) -{ - switch (message_p->procedureCode) { - case S1ap_ProcedureCode_id_downlinkNASTransport: - return s1ap_mme_encode_downlink_nas_transport (message_p, buffer, length); - - case S1ap_ProcedureCode_id_InitialContextSetup: - return s1ap_mme_encode_initial_context_setup_request (message_p, buffer, length); - - case S1ap_ProcedureCode_id_UEContextRelease: - return s1ap_mme_encode_ue_context_release_command (message_p, buffer, length); - - default: - d_warn("Unknown procedure ID (%d) for initiating message_p\n", (int)message_p->procedureCode); - break; - } - - return -1; -} - -static inline int -s1ap_mme_encode_successfull_outcome ( - s1ap_message * message_p, - uint8_t ** buffer, - uint32_t * length) -{ - switch (message_p->procedureCode) { - case S1ap_ProcedureCode_id_S1Setup: - return s1ap_mme_encode_s1setupresponse (message_p, buffer, length); - - default: - d_warn("Unknown procedure ID (%d) for successfull outcome message\n", (int)message_p->procedureCode); - break; - } - - return -1; -} - -static inline int -s1ap_mme_encode_unsuccessfull_outcome ( - s1ap_message * message_p, - uint8_t ** buffer, - uint32_t * length) -{ - switch (message_p->procedureCode) { - case S1ap_ProcedureCode_id_S1Setup: - return s1ap_mme_encode_s1setupfailure (message_p, buffer, length); - - default: - d_warn("Unknown procedure ID (%d) for unsuccessfull outcome message\n", (int)message_p->procedureCode); - break; - } - - return -1; -} - -static inline int -s1ap_mme_encode_s1setupresponse ( - s1ap_message * message_p, - uint8_t ** buffer, - uint32_t * length) -{ - S1ap_S1SetupResponse_t s1SetupResponse; - S1ap_S1SetupResponse_t *s1SetupResponse_p = &s1SetupResponse; - - memset (s1SetupResponse_p, 0, sizeof (S1ap_S1SetupResponse_t)); - - if (s1ap_encode_s1ap_s1setupresponseies (s1SetupResponse_p, &message_p->msg.s1ap_S1SetupResponseIEs) < 0) { - return -1; - } - - return s1ap_generate_successfull_outcome (buffer, length, S1ap_ProcedureCode_id_S1Setup, message_p->criticality, &asn_DEF_S1ap_S1SetupResponse, s1SetupResponse_p); -} - -static inline int -s1ap_mme_encode_s1setupfailure ( - s1ap_message * message_p, - uint8_t ** buffer, - uint32_t * length) -{ - S1ap_S1SetupFailure_t s1SetupFailure; - S1ap_S1SetupFailure_t *s1SetupFailure_p = &s1SetupFailure; - - memset (s1SetupFailure_p, 0, sizeof (S1ap_S1SetupFailure_t)); - - if (s1ap_encode_s1ap_s1setupfailureies (s1SetupFailure_p, &message_p->msg.s1ap_S1SetupFailureIEs) < 0) { - return -1; - } - - return s1ap_generate_unsuccessfull_outcome (buffer, length, S1ap_ProcedureCode_id_S1Setup, message_p->criticality, &asn_DEF_S1ap_S1SetupFailure, s1SetupFailure_p); -} - -static inline int -s1ap_mme_encode_downlink_nas_transport ( - s1ap_message * message_p, - uint8_t ** buffer, - uint32_t * length) -{ - S1ap_DownlinkNASTransport_t downlinkNasTransport; - S1ap_DownlinkNASTransport_t *downlinkNasTransport_p = &downlinkNasTransport; - - memset (downlinkNasTransport_p, 0, sizeof (S1ap_DownlinkNASTransport_t)); - - /* - * Convert IE structure into asn1 message_p - */ - if (s1ap_encode_s1ap_downlinknastransport_ies (downlinkNasTransport_p, &message_p->msg.s1ap_DownlinkNASTransport_IEs) < 0) { - return -1; - } - - /* - * Generate Initiating message_p for the list of IEs - */ - return s1ap_generate_initiating_message (buffer, length, S1ap_ProcedureCode_id_downlinkNASTransport, message_p->criticality, &asn_DEF_S1ap_DownlinkNASTransport, downlinkNasTransport_p); -} - -static inline int -s1ap_mme_encode_ue_context_release_command ( - s1ap_message * message_p, - uint8_t ** buffer, - uint32_t * length) -{ - S1ap_UEContextReleaseCommand_t ueContextReleaseCommand; - S1ap_UEContextReleaseCommand_t *ueContextReleaseCommand_p = &ueContextReleaseCommand; - - memset (ueContextReleaseCommand_p, 0, sizeof (S1ap_UEContextReleaseCommand_t)); - - /* - * Convert IE structure into asn1 message_p - */ - if (s1ap_encode_s1ap_uecontextreleasecommand_ies (ueContextReleaseCommand_p, &message_p->msg.s1ap_UEContextReleaseCommand_IEs) < 0) { - return -1; - } - - return s1ap_generate_initiating_message (buffer, length, S1ap_ProcedureCode_id_UEContextRelease, message_p->criticality, &asn_DEF_S1ap_UEContextReleaseCommand, ueContextReleaseCommand_p); -} diff --git a/lib/asn/src/s1ap_mme_encoder.h b/lib/asn/src/s1ap_mme_encoder.h deleted file mode 100644 index 39c0325577..0000000000 --- a/lib/asn/src/s1ap_mme_encoder.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the Apache License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - - -#include - -#ifndef FILE_S1AP_MME_ENCODER_SEEN -#define FILE_S1AP_MME_ENCODER_SEEN - -int s1ap_mme_encode_pdu(s1ap_message *message, uint8_t **buffer, uint32_t *len) -__attribute__ ((warn_unused_result)); - -#endif /* FILE_S1AP_MME_ENCODER_SEEN */ diff --git a/lib/asn/test/s1ap_test.c b/lib/asn/test/s1ap_test.c index c07a02ab5e..67f7270656 100644 --- a/lib/asn/test/s1ap_test.c +++ b/lib/asn/test/s1ap_test.c @@ -6,9 +6,7 @@ #include "testutil.h" -#include "s1ap_common.h" -#include "s1ap_ies_defs.h" -#include "s1ap_mme_decoder.h" +#include "s1ap_codecs.h" static void s1ap_test1(abts_case *tc, void *data) { @@ -19,8 +17,7 @@ static void s1ap_test1(abts_case *tc, void *data) s1ap_message message; int result; - memset(&message, 0, sizeof(s1ap_message)); - result = s1ap_mme_decode_pdu(&message, (unsigned char*)buffer[0], 49); + result = s1ap_parse_pdu(&message, (unsigned char*)buffer[0], 49); ABTS_INT_EQUAL(tc, 0, result); } @@ -33,8 +30,7 @@ static void s1ap_test2(abts_case *tc, void *data) s1ap_message message; int result; - memset(&message, 0, sizeof(s1ap_message)); - result = s1ap_mme_decode_pdu(&message, (unsigned char*)buffer[0], 115); + result = s1ap_parse_pdu(&message, (unsigned char*)buffer[0], 115); ABTS_INT_EQUAL(tc, 0, result); } @@ -47,8 +43,7 @@ static void s1ap_test3(abts_case *tc, void *data) s1ap_message message; int result; - memset(&message, 0, sizeof(s1ap_message)); - result = s1ap_mme_decode_pdu(&message, (unsigned char*)buffer[0], 41); + result = s1ap_parse_pdu(&message, (unsigned char*)buffer[0], 41); ABTS_INT_EQUAL(tc, 0, result); }