Add S1AP R14 based on new asn1c
This feature requires an un-official version of asn1c : https://github.com/velichkov/asn1c/tree/s1ap
This commit is contained in:
+6634
File diff suppressed because it is too large
Load Diff
+3
-141
@@ -22,7 +22,7 @@
|
||||
/*! \file s1ap_common.c
|
||||
* \brief s1ap procedures for both eNB and MME
|
||||
* \author Sebastien ROUX and Navid Nikaein
|
||||
* \email navid.nikaein@eurecom.fr
|
||||
* \email navid.nikaein@eurecom.fr
|
||||
* \date 2012-2015
|
||||
* \version 0.1
|
||||
*/
|
||||
@@ -30,7 +30,7 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include "s1ap_common.h"
|
||||
#include "S1AP-PDU.h"
|
||||
#include "S1AP_S1AP-PDU.h"
|
||||
|
||||
int asn_debug = 0;
|
||||
int asn1_xer_print = 0;
|
||||
@@ -53,144 +53,6 @@ inline void ASN_DEBUG(const char *fmt, ...)
|
||||
}
|
||||
#endif
|
||||
|
||||
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)
|
||||
void s1ap_handle_criticality(S1AP_Criticality_t criticality)
|
||||
{
|
||||
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) {
|
||||
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) {
|
||||
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) {
|
||||
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) {
|
||||
fprintf(stderr, "Encoding of %s failed\n", type->name);
|
||||
free(buff);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (asn1_xer_print)
|
||||
if (xer_fprint(stdout, &asn_DEF_S1ap_IE, buff) < 0) {
|
||||
free(buff);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return buff;
|
||||
}
|
||||
|
||||
void s1ap_handle_criticality(S1ap_Criticality_t criticality)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
+32
-406
@@ -39,343 +39,19 @@ extern int asn_debug;
|
||||
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-BPLMNs.h"
|
||||
#include "S1ap-BroadcastCompletedAreaList.h"
|
||||
#include "S1ap-Cause.h"
|
||||
#include "S1ap-CauseMisc.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-Cdma2000OneXMEID.h"
|
||||
#include "S1ap-Cdma2000OneXMSI.h"
|
||||
#include "S1ap-Cdma2000OneXPilot.h"
|
||||
#include "S1ap-Cdma2000OneXRAND.h"
|
||||
#include "S1ap-Cell-Size.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-E-RAB-ID.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-EUTRAN-CGI.h"
|
||||
#include "S1ap-ExtendedRNC-ID.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-GBR-QosInformation.h"
|
||||
#include "S1ap-GTP-TEID.h"
|
||||
#include "S1ap-GUMMEI.h"
|
||||
#include "S1ap-HandoverRestrictionList.h"
|
||||
#include "S1ap-HandoverType.h"
|
||||
#include "S1ap-HFN.h"
|
||||
#include "S1ap-IMSI.h"
|
||||
#include "S1ap-IntegrityProtectionAlgorithms.h"
|
||||
#include "S1ap-InterfacesToTrace.h"
|
||||
#include "S1ap-LAC.h"
|
||||
#include "S1ap-LAI.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-M-TMSI.h"
|
||||
#include "S1ap-MSClassmark2.h"
|
||||
#include "S1ap-MSClassmark3.h"
|
||||
#include "S1ap-NAS-PDU.h"
|
||||
#include "S1ap-NASSecurityParametersfromE-UTRAN.h"
|
||||
#include "S1ap-NASSecurityParameterstoE-UTRAN.h"
|
||||
#include "S1ap-NumberofBroadcastRequest.h"
|
||||
#include "S1ap-NumberOfBroadcasts.h"
|
||||
#include "S1ap-OldBSS-ToNewBSS-Information.h"
|
||||
#include "S1ap-OverloadAction.h"
|
||||
#include "S1ap-OverloadResponse.h"
|
||||
#include "S1ap-PagingDRX.h"
|
||||
#include "S1ap-PDCP-SN.h"
|
||||
#include "S1ap-PLMNidentity.h"
|
||||
#include "S1ap-Pre-emptionCapability.h"
|
||||
#include "S1ap-Pre-emptionVulnerability.h"
|
||||
#include "S1ap-PriorityLevel.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-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-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-SRVCCHOIndication.h"
|
||||
#include "S1ap-SourceeNB-ToTargeteNB-TransparentContainer.h"
|
||||
#include "S1ap-SourceRNC-ToTargetRNC-TransparentContainer.h"
|
||||
#include "S1ap-ServedGUMMEIs.h"
|
||||
#include "S1ap-ServedGUMMEIsItem.h"
|
||||
#include "S1ap-ServedGroupIDs.h"
|
||||
#include "S1ap-ServedMMECs.h"
|
||||
#include "S1ap-ServedPLMNs.h"
|
||||
#include "S1ap-SubscriberProfileIDforRFP.h"
|
||||
#include "S1ap-SupportedTAs.h"
|
||||
#include "S1ap-SupportedTAs-Item.h"
|
||||
#include "S1ap-S-TMSI.h"
|
||||
#include "S1ap-TAC.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-Target-ToSource-TransparentContainer.h"
|
||||
#include "S1ap-TargetRNC-ToSourceRNC-TransparentContainer.h"
|
||||
#include "S1ap-TargetBSS-ToSourceBSS-TransparentContainer.h"
|
||||
#include "S1ap-TimeToWait.h"
|
||||
#include "S1ap-Time-UE-StayedInCell.h"
|
||||
#include "S1ap-TransportLayerAddress.h"
|
||||
#include "S1ap-TraceActivation.h"
|
||||
#include "S1ap-TraceDepth.h"
|
||||
#include "S1ap-E-UTRAN-Trace-ID.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-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-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-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-RABFailedToSetupListHOReqAck.h"
|
||||
#include "S1ap-E-RABToBeModifiedItemBearerModReq.h"
|
||||
#include "S1ap-E-RABToBeModifiedListBearerModReq.h"
|
||||
#include "S1ap-UE-associatedLogicalS1-ConnectionListResAck.h"
|
||||
#include "S1ap-IE.h"
|
||||
#include "S1AP-PDU.h"
|
||||
|
||||
#if defined (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"
|
||||
#endif /* (UPDATE_RELEASE_9) */
|
||||
|
||||
#if defined(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"
|
||||
#endif /* (UPDATE_RELEASE_10) */
|
||||
#include "S1AP_ProtocolIE-Field.h"
|
||||
#include "S1AP_S1AP-PDU.h"
|
||||
#include "S1AP_InitiatingMessage.h"
|
||||
#include "S1AP_SuccessfulOutcome.h"
|
||||
#include "S1AP_UnsuccessfulOutcome.h"
|
||||
#include "S1AP_ProtocolIE-Field.h"
|
||||
#include "S1AP_ProtocolIE-FieldPair.h"
|
||||
#include "S1AP_ProtocolIE-ContainerPair.h"
|
||||
#include "S1AP_ProtocolExtensionField.h"
|
||||
#include "S1AP_ProtocolExtensionContainer.h"
|
||||
#include "S1AP_asn_constant.h"
|
||||
#include "S1AP_SupportedTAs-Item.h"
|
||||
#include "S1AP_ServedGUMMEIsItem.h"
|
||||
|
||||
/* Checking version of ASN1C compiler */
|
||||
#if (ASN1C_ENVIRONMENT_VERSION < ASN1C_MINIMUM_VERSION)
|
||||
@@ -411,84 +87,34 @@ extern int asn1_xer_print;
|
||||
# define S1AP_DEBUG(x, args...) do { fprintf(stdout, "[S1AP][D]"x, ##args); } while(0)
|
||||
#endif
|
||||
|
||||
//Forward declaration
|
||||
struct s1ap_message_s;
|
||||
|
||||
#define S1AP_FIND_PROTOCOLIE_BY_ID(IE_TYPE, ie, container, IE_ID, mandatory) \
|
||||
do {\
|
||||
IE_TYPE **ptr; \
|
||||
ie = NULL; \
|
||||
for (ptr = container->protocolIEs.list.array; \
|
||||
ptr < &container->protocolIEs.list.array[container->protocolIEs.list.count]; \
|
||||
ptr++) { \
|
||||
if((*ptr)->id == IE_ID) { \
|
||||
ie = *ptr; \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
if (mandatory) DevAssert(ie != NULL); \
|
||||
} while(0)
|
||||
|
||||
/** \brief Function callback prototype.
|
||||
**/
|
||||
typedef int (*s1ap_message_decoded_callback)(
|
||||
uint32_t assoc_id,
|
||||
uint32_t stream,
|
||||
struct s1ap_message_s *message_p
|
||||
uint32_t assoc_id,
|
||||
uint32_t stream,
|
||||
S1AP_S1AP_PDU_t *pdu
|
||||
);
|
||||
|
||||
/** \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 Deferenced 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 Deferenced 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 Deferenced 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);
|
||||
void s1ap_handle_criticality(S1AP_Criticality_t criticality);
|
||||
|
||||
#endif /* S1AP_COMMON_H_ */
|
||||
|
||||
+185
-189
@@ -20,8 +20,8 @@
|
||||
*/
|
||||
|
||||
/*! \file s1ap_eNB.c
|
||||
* \brief S1AP eNB task
|
||||
* \author S. Roux and Navid Nikaein
|
||||
* \brief S1AP eNB task
|
||||
* \author S. Roux and Navid Nikaein
|
||||
* \date 2010 - 2015
|
||||
* \email: navid.nikaein@eurecom.fr
|
||||
* \version 1.0
|
||||
@@ -42,7 +42,6 @@
|
||||
#include "s1ap_eNB_default_values.h"
|
||||
|
||||
#include "s1ap_common.h"
|
||||
#include "s1ap_ies_defs.h"
|
||||
|
||||
#include "s1ap_eNB_defs.h"
|
||||
#include "s1ap_eNB.h"
|
||||
@@ -81,16 +80,12 @@ uint32_t s1ap_generate_eNB_id(void)
|
||||
char hostname[50];
|
||||
int ret;
|
||||
uint32_t eNB_id;
|
||||
|
||||
/* Retrieve the host name */
|
||||
ret = gethostname(hostname, sizeof(hostname));
|
||||
DevAssert(ret == 0);
|
||||
|
||||
out = crypt(hostname, "eurecom");
|
||||
DevAssert(out != NULL);
|
||||
|
||||
eNB_id = ((out[0] << 24) | (out[1] << 16) | (out[2] << 8) | out[3]);
|
||||
|
||||
return eNB_id;
|
||||
}
|
||||
|
||||
@@ -104,46 +99,32 @@ static void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p,
|
||||
sctp_new_association_req_t *sctp_new_association_req_p = NULL;
|
||||
s1ap_eNB_mme_data_t *s1ap_mme_data_p = NULL;
|
||||
struct s1ap_eNB_mme_data_s *mme = NULL;
|
||||
|
||||
DevAssert(instance_p != NULL);
|
||||
DevAssert(mme_ip_address != NULL);
|
||||
|
||||
message_p = itti_alloc_new_message(TASK_S1AP, SCTP_NEW_ASSOCIATION_REQ);
|
||||
|
||||
sctp_new_association_req_p = &message_p->ittiMsg.sctp_new_association_req;
|
||||
|
||||
sctp_new_association_req_p->port = S1AP_PORT_NUMBER;
|
||||
sctp_new_association_req_p->ppid = S1AP_SCTP_PPID;
|
||||
|
||||
sctp_new_association_req_p->in_streams = in_streams;
|
||||
sctp_new_association_req_p->out_streams = out_streams;
|
||||
|
||||
memcpy(&sctp_new_association_req_p->remote_address,
|
||||
mme_ip_address,
|
||||
sizeof(*mme_ip_address));
|
||||
|
||||
memcpy(&sctp_new_association_req_p->local_address,
|
||||
local_ip_addr,
|
||||
sizeof(*local_ip_addr));
|
||||
|
||||
S1AP_INFO("[eNB %d] check the mme registration state\n",instance_p->instance);
|
||||
|
||||
mme = s1ap_eNB_get_MME_from_instance(instance_p);
|
||||
|
||||
if ( mme == NULL ) {
|
||||
|
||||
/* Create new MME descriptor */
|
||||
s1ap_mme_data_p = calloc(1, sizeof(*s1ap_mme_data_p));
|
||||
DevAssert(s1ap_mme_data_p != NULL);
|
||||
|
||||
s1ap_mme_data_p->cnx_id = s1ap_eNB_fetch_add_global_cnx_id();
|
||||
sctp_new_association_req_p->ulp_cnx_id = s1ap_mme_data_p->cnx_id;
|
||||
|
||||
s1ap_mme_data_p->assoc_id = -1;
|
||||
s1ap_mme_data_p->s1ap_eNB_instance = instance_p;
|
||||
|
||||
STAILQ_INIT(&s1ap_mme_data_p->served_gummei);
|
||||
|
||||
/* Insert the new descriptor in list of known MME
|
||||
* but not yet associated.
|
||||
*/
|
||||
@@ -154,27 +135,23 @@ static void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p,
|
||||
} else if (mme->state == S1AP_ENB_STATE_WAITING) {
|
||||
instance_p->s1ap_mme_pending_nb ++;
|
||||
sctp_new_association_req_p->ulp_cnx_id = mme->cnx_id;
|
||||
|
||||
S1AP_INFO("[eNB %d] MME already registered, retrive the data (state %d, cnx %d, mme_nb %d, mme_pending_nb %d)\n",
|
||||
instance_p->instance,
|
||||
mme->state, mme->cnx_id,
|
||||
instance_p->s1ap_mme_nb, instance_p->s1ap_mme_pending_nb);
|
||||
|
||||
instance_p->instance,
|
||||
mme->state, mme->cnx_id,
|
||||
instance_p->s1ap_mme_nb, instance_p->s1ap_mme_pending_nb);
|
||||
/*s1ap_mme_data_p->cnx_id = mme->cnx_id;
|
||||
sctp_new_association_req_p->ulp_cnx_id = mme->cnx_id;
|
||||
|
||||
|
||||
s1ap_mme_data_p->assoc_id = -1;
|
||||
s1ap_mme_data_p->s1ap_eNB_instance = instance_p;
|
||||
*/
|
||||
*/
|
||||
} else {
|
||||
|
||||
S1AP_WARN("[eNB %d] MME already registered but not in the waiting state, retrive the data (state %d, cnx %d, mme_nb %d, mme_pending_nb %d)\n",
|
||||
instance_p->instance,
|
||||
mme->state, mme->cnx_id,
|
||||
instance_p->s1ap_mme_nb, instance_p->s1ap_mme_pending_nb);
|
||||
|
||||
instance_p->instance,
|
||||
mme->state, mme->cnx_id,
|
||||
instance_p->s1ap_mme_nb, instance_p->s1ap_mme_pending_nb);
|
||||
}
|
||||
|
||||
|
||||
itti_send_msg_to_task(TASK_SCTP, instance_p->instance, message_p);
|
||||
}
|
||||
|
||||
@@ -183,14 +160,11 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *
|
||||
{
|
||||
s1ap_eNB_instance_t *new_instance;
|
||||
uint8_t index;
|
||||
|
||||
DevAssert(s1ap_register_eNB != NULL);
|
||||
|
||||
/* Look if the provided instance already exists */
|
||||
new_instance = s1ap_eNB_get_instance(instance);
|
||||
|
||||
|
||||
if (new_instance != NULL) {
|
||||
|
||||
if (new_instance != NULL) {
|
||||
/* Checks if it is a retry on the same eNB */
|
||||
DevCheck(new_instance->eNB_id == s1ap_register_eNB->eNB_id, new_instance->eNB_id, s1ap_register_eNB->eNB_id, 0);
|
||||
DevCheck(new_instance->cell_type == s1ap_register_eNB->cell_type, new_instance->cell_type, s1ap_register_eNB->cell_type, 0);
|
||||
@@ -202,10 +176,8 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *
|
||||
} else {
|
||||
new_instance = calloc(1, sizeof(s1ap_eNB_instance_t));
|
||||
DevAssert(new_instance != NULL);
|
||||
|
||||
RB_INIT(&new_instance->s1ap_ue_head);
|
||||
RB_INIT(&new_instance->s1ap_mme_head);
|
||||
|
||||
/* Copy usefull parameters */
|
||||
new_instance->instance = instance;
|
||||
new_instance->eNB_name = s1ap_register_eNB->eNB_name;
|
||||
@@ -216,14 +188,12 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *
|
||||
new_instance->mnc = s1ap_register_eNB->mnc;
|
||||
new_instance->mnc_digit_length = s1ap_register_eNB->mnc_digit_length;
|
||||
new_instance->default_drx = s1ap_register_eNB->default_drx;
|
||||
|
||||
/* Add the new instance to the list of eNB (meaningfull in virtual mode) */
|
||||
s1ap_eNB_insert_new_instance(new_instance);
|
||||
|
||||
S1AP_INFO("Registered new eNB[%d] and %s eNB id %u\n",
|
||||
instance,
|
||||
s1ap_register_eNB->cell_type == CELL_MACRO_ENB ? "macro" : "home",
|
||||
s1ap_register_eNB->eNB_id);
|
||||
instance,
|
||||
s1ap_register_eNB->cell_type == CELL_MACRO_ENB ? "macro" : "home",
|
||||
s1ap_register_eNB->eNB_id);
|
||||
}
|
||||
|
||||
DevCheck(s1ap_register_eNB->nb_mme <= S1AP_MAX_NB_MME_IP_ADDRESS,
|
||||
@@ -232,7 +202,7 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *
|
||||
/* Trying to connect to provided list of MME ip address */
|
||||
for (index = 0; index < s1ap_register_eNB->nb_mme; index++) {
|
||||
s1ap_eNB_register_mme(new_instance,
|
||||
&s1ap_register_eNB->mme_ip_address[index],
|
||||
&s1ap_register_eNB->mme_ip_address[index],
|
||||
&s1ap_register_eNB->enb_ip_address,
|
||||
s1ap_register_eNB->sctp_in_streams,
|
||||
s1ap_register_eNB->sctp_out_streams);
|
||||
@@ -243,12 +213,9 @@ void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa
|
||||
{
|
||||
s1ap_eNB_instance_t *instance_p;
|
||||
s1ap_eNB_mme_data_t *s1ap_mme_data_p;
|
||||
|
||||
DevAssert(sctp_new_association_resp != NULL);
|
||||
|
||||
instance_p = s1ap_eNB_get_instance(instance);
|
||||
DevAssert(instance_p != NULL);
|
||||
|
||||
s1ap_mme_data_p = s1ap_eNB_get_MME(instance_p, -1,
|
||||
sctp_new_association_resp->ulp_cnx_id);
|
||||
DevAssert(s1ap_mme_data_p != NULL);
|
||||
@@ -258,9 +225,7 @@ void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa
|
||||
sctp_new_association_resp->sctp_state,
|
||||
instance,
|
||||
sctp_new_association_resp->ulp_cnx_id);
|
||||
|
||||
s1ap_handle_s1_setup_message(s1ap_mme_data_p, sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -268,7 +233,6 @@ void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa
|
||||
s1ap_mme_data_p->assoc_id = sctp_new_association_resp->assoc_id;
|
||||
s1ap_mme_data_p->in_streams = sctp_new_association_resp->in_streams;
|
||||
s1ap_mme_data_p->out_streams = sctp_new_association_resp->out_streams;
|
||||
|
||||
/* Prepare new S1 Setup Request */
|
||||
s1ap_eNB_generate_s1_setup_request(instance_p, s1ap_mme_data_p);
|
||||
}
|
||||
@@ -277,11 +241,10 @@ static
|
||||
void s1ap_eNB_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind)
|
||||
{
|
||||
int result;
|
||||
|
||||
DevAssert(sctp_data_ind != NULL);
|
||||
#if defined(TEST_S1C_MME)
|
||||
mme_test_s1_notify_sctp_data_ind(sctp_data_ind->assoc_id, sctp_data_ind->stream,
|
||||
sctp_data_ind->buffer, sctp_data_ind->buffer_length);
|
||||
sctp_data_ind->buffer, sctp_data_ind->buffer_length);
|
||||
#else
|
||||
s1ap_eNB_handle_message(sctp_data_ind->assoc_id, sctp_data_ind->stream,
|
||||
sctp_data_ind->buffer, sctp_data_ind->buffer_length);
|
||||
@@ -294,11 +257,8 @@ void *s1ap_eNB_task(void *arg)
|
||||
{
|
||||
MessageDef *received_msg = NULL;
|
||||
int result;
|
||||
|
||||
S1AP_DEBUG("Starting S1AP layer\n");
|
||||
|
||||
s1ap_eNB_prepare_internal_data();
|
||||
|
||||
itti_mark_task_ready(TASK_S1AP);
|
||||
MSC_START_USE();
|
||||
|
||||
@@ -306,116 +266,112 @@ void *s1ap_eNB_task(void *arg)
|
||||
itti_receive_msg(TASK_S1AP, &received_msg);
|
||||
|
||||
switch (ITTI_MSG_ID(received_msg)) {
|
||||
case TERMINATE_MESSAGE:
|
||||
S1AP_WARN(" *** Exiting S1AP thread\n");
|
||||
itti_exit_task();
|
||||
case TERMINATE_MESSAGE:
|
||||
S1AP_WARN(" *** Exiting S1AP thread\n");
|
||||
itti_exit_task();
|
||||
break;
|
||||
|
||||
case S1AP_REGISTER_ENB_REQ: {
|
||||
/* Register a new eNB.
|
||||
* in Virtual mode eNBs will be distinguished using the mod_id/
|
||||
* Each eNB has to send an S1AP_REGISTER_ENB message with its
|
||||
* own parameters.
|
||||
*/
|
||||
s1ap_eNB_handle_register_eNB(ITTI_MESSAGE_GET_INSTANCE(received_msg),
|
||||
&S1AP_REGISTER_ENB_REQ(received_msg));
|
||||
}
|
||||
break;
|
||||
|
||||
case S1AP_REGISTER_ENB_REQ: {
|
||||
/* Register a new eNB.
|
||||
* in Virtual mode eNBs will be distinguished using the mod_id/
|
||||
* Each eNB has to send an S1AP_REGISTER_ENB message with its
|
||||
* own parameters.
|
||||
*/
|
||||
s1ap_eNB_handle_register_eNB(ITTI_MESSAGE_GET_INSTANCE(received_msg),
|
||||
&S1AP_REGISTER_ENB_REQ(received_msg));
|
||||
}
|
||||
break;
|
||||
case SCTP_NEW_ASSOCIATION_RESP: {
|
||||
s1ap_eNB_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
|
||||
&received_msg->ittiMsg.sctp_new_association_resp);
|
||||
}
|
||||
break;
|
||||
|
||||
case SCTP_NEW_ASSOCIATION_RESP: {
|
||||
s1ap_eNB_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
|
||||
&received_msg->ittiMsg.sctp_new_association_resp);
|
||||
}
|
||||
break;
|
||||
case SCTP_DATA_IND: {
|
||||
s1ap_eNB_handle_sctp_data_ind(&received_msg->ittiMsg.sctp_data_ind);
|
||||
}
|
||||
break;
|
||||
|
||||
case SCTP_DATA_IND: {
|
||||
s1ap_eNB_handle_sctp_data_ind(&received_msg->ittiMsg.sctp_data_ind);
|
||||
}
|
||||
break;
|
||||
case S1AP_NAS_FIRST_REQ: {
|
||||
s1ap_eNB_handle_nas_first_req(ITTI_MESSAGE_GET_INSTANCE(received_msg),
|
||||
&S1AP_NAS_FIRST_REQ(received_msg));
|
||||
}
|
||||
break;
|
||||
|
||||
case S1AP_NAS_FIRST_REQ: {
|
||||
s1ap_eNB_handle_nas_first_req(ITTI_MESSAGE_GET_INSTANCE(received_msg),
|
||||
&S1AP_NAS_FIRST_REQ(received_msg));
|
||||
}
|
||||
break;
|
||||
case S1AP_UPLINK_NAS: {
|
||||
s1ap_eNB_nas_uplink(ITTI_MESSAGE_GET_INSTANCE(received_msg),
|
||||
&S1AP_UPLINK_NAS(received_msg));
|
||||
}
|
||||
break;
|
||||
|
||||
case S1AP_UPLINK_NAS: {
|
||||
s1ap_eNB_nas_uplink(ITTI_MESSAGE_GET_INSTANCE(received_msg),
|
||||
&S1AP_UPLINK_NAS(received_msg));
|
||||
}
|
||||
break;
|
||||
case S1AP_UE_CAPABILITIES_IND: {
|
||||
s1ap_eNB_ue_capabilities(ITTI_MESSAGE_GET_INSTANCE(received_msg),
|
||||
&S1AP_UE_CAPABILITIES_IND(received_msg));
|
||||
}
|
||||
break;
|
||||
|
||||
case S1AP_UE_CAPABILITIES_IND: {
|
||||
s1ap_eNB_ue_capabilities(ITTI_MESSAGE_GET_INSTANCE(received_msg),
|
||||
&S1AP_UE_CAPABILITIES_IND(received_msg));
|
||||
}
|
||||
break;
|
||||
case S1AP_INITIAL_CONTEXT_SETUP_RESP: {
|
||||
s1ap_eNB_initial_ctxt_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
|
||||
&S1AP_INITIAL_CONTEXT_SETUP_RESP(received_msg));
|
||||
}
|
||||
break;
|
||||
|
||||
case S1AP_INITIAL_CONTEXT_SETUP_RESP: {
|
||||
s1ap_eNB_initial_ctxt_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
|
||||
&S1AP_INITIAL_CONTEXT_SETUP_RESP(received_msg));
|
||||
}
|
||||
break;
|
||||
case S1AP_E_RAB_SETUP_RESP: {
|
||||
s1ap_eNB_e_rab_setup_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
|
||||
&S1AP_E_RAB_SETUP_RESP(received_msg));
|
||||
}
|
||||
break;
|
||||
|
||||
case S1AP_E_RAB_SETUP_RESP: {
|
||||
s1ap_eNB_e_rab_setup_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
|
||||
&S1AP_E_RAB_SETUP_RESP(received_msg));
|
||||
}
|
||||
break;
|
||||
case S1AP_E_RAB_MODIFY_RESP: {
|
||||
s1ap_eNB_e_rab_modify_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
|
||||
&S1AP_E_RAB_MODIFY_RESP(received_msg));
|
||||
}
|
||||
break;
|
||||
|
||||
case S1AP_E_RAB_MODIFY_RESP: {
|
||||
s1ap_eNB_e_rab_modify_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
|
||||
&S1AP_E_RAB_MODIFY_RESP(received_msg));
|
||||
}
|
||||
break;
|
||||
|
||||
case S1AP_NAS_NON_DELIVERY_IND: {
|
||||
s1ap_eNB_nas_non_delivery_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg),
|
||||
&S1AP_NAS_NON_DELIVERY_IND(received_msg));
|
||||
}
|
||||
break;
|
||||
case S1AP_NAS_NON_DELIVERY_IND: {
|
||||
s1ap_eNB_nas_non_delivery_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg),
|
||||
&S1AP_NAS_NON_DELIVERY_IND(received_msg));
|
||||
}
|
||||
break;
|
||||
|
||||
case S1AP_UE_CONTEXT_RELEASE_COMPLETE: {
|
||||
s1ap_ue_context_release_complete(ITTI_MESSAGE_GET_INSTANCE(received_msg),
|
||||
&S1AP_UE_CONTEXT_RELEASE_COMPLETE(received_msg));
|
||||
}
|
||||
break;
|
||||
case S1AP_UE_CONTEXT_RELEASE_COMPLETE: {
|
||||
s1ap_ue_context_release_complete(ITTI_MESSAGE_GET_INSTANCE(received_msg),
|
||||
&S1AP_UE_CONTEXT_RELEASE_COMPLETE(received_msg));
|
||||
}
|
||||
break;
|
||||
|
||||
case S1AP_UE_CONTEXT_RELEASE_REQ: {
|
||||
s1ap_eNB_instance_t *s1ap_eNB_instance_p = NULL; // test
|
||||
struct s1ap_eNB_ue_context_s *ue_context_p = NULL; // test
|
||||
case S1AP_UE_CONTEXT_RELEASE_REQ: {
|
||||
s1ap_eNB_instance_t *s1ap_eNB_instance_p = NULL; // test
|
||||
struct s1ap_eNB_ue_context_s *ue_context_p = NULL; // test
|
||||
s1ap_ue_context_release_req(ITTI_MESSAGE_GET_INSTANCE(received_msg),
|
||||
&S1AP_UE_CONTEXT_RELEASE_REQ(received_msg));
|
||||
s1ap_eNB_instance_p = s1ap_eNB_get_instance(ITTI_MESSAGE_GET_INSTANCE(received_msg)); // test
|
||||
DevAssert(s1ap_eNB_instance_p != NULL); // test
|
||||
|
||||
s1ap_ue_context_release_req(ITTI_MESSAGE_GET_INSTANCE(received_msg),
|
||||
&S1AP_UE_CONTEXT_RELEASE_REQ(received_msg));
|
||||
if ((ue_context_p = s1ap_eNB_get_ue_context(s1ap_eNB_instance_p,
|
||||
S1AP_UE_CONTEXT_RELEASE_REQ(received_msg).eNB_ue_s1ap_id)) == NULL) { // test
|
||||
/* The context for this eNB ue s1ap id doesn't exist in the map of eNB UEs */
|
||||
S1AP_ERROR("Failed to find ue context associated with eNB ue s1ap id: %u\n",
|
||||
S1AP_UE_CONTEXT_RELEASE_REQ(received_msg).eNB_ue_s1ap_id); // test
|
||||
} // test
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
s1ap_eNB_instance_p = s1ap_eNB_get_instance(ITTI_MESSAGE_GET_INSTANCE(received_msg)); // test
|
||||
DevAssert(s1ap_eNB_instance_p != NULL); // test
|
||||
|
||||
if ((ue_context_p = s1ap_eNB_get_ue_context(s1ap_eNB_instance_p,
|
||||
S1AP_UE_CONTEXT_RELEASE_REQ(received_msg).eNB_ue_s1ap_id)) == NULL) { // test
|
||||
/* The context for this eNB ue s1ap id doesn't exist in the map of eNB UEs */
|
||||
S1AP_ERROR("Failed to find ue context associated with eNB ue s1ap id: %u\n",
|
||||
S1AP_UE_CONTEXT_RELEASE_REQ(received_msg).eNB_ue_s1ap_id); // test
|
||||
} // test
|
||||
}
|
||||
break;
|
||||
|
||||
case S1AP_E_RAB_RELEASE_RESPONSE: {
|
||||
case S1AP_E_RAB_RELEASE_RESPONSE: {
|
||||
s1ap_eNB_e_rab_release_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
|
||||
&S1AP_E_RAB_RELEASE_RESPONSE(received_msg));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
S1AP_ERROR("Received unhandled message: %d:%s\n",
|
||||
ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
S1AP_ERROR("Received unhandled message: %d:%s\n",
|
||||
ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg));
|
||||
break;
|
||||
}
|
||||
|
||||
result = itti_free (ITTI_MSG_ORIGIN_ID(received_msg), received_msg);
|
||||
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
|
||||
|
||||
received_msg = NULL;
|
||||
}
|
||||
|
||||
@@ -425,62 +381,102 @@ void *s1ap_eNB_task(void *arg)
|
||||
static int s1ap_eNB_generate_s1_setup_request(
|
||||
s1ap_eNB_instance_t *instance_p, s1ap_eNB_mme_data_t *s1ap_mme_data_p)
|
||||
{
|
||||
s1ap_message message;
|
||||
|
||||
S1ap_S1SetupRequestIEs_t *s1SetupRequest_p;
|
||||
S1ap_PLMNidentity_t plmnIdentity;
|
||||
S1ap_SupportedTAs_Item_t ta;
|
||||
|
||||
S1AP_S1AP_PDU_t pdu;
|
||||
S1AP_S1SetupRequest_t *out;
|
||||
S1AP_S1SetupRequestIEs_t *ie;
|
||||
S1AP_SupportedTAs_Item_t *ta;
|
||||
S1AP_PLMNidentity_t *plmn;
|
||||
uint8_t *buffer;
|
||||
uint32_t len;
|
||||
int ret = 0;
|
||||
|
||||
DevAssert(instance_p != NULL);
|
||||
DevAssert(s1ap_mme_data_p != NULL);
|
||||
|
||||
memset(&message, 0, sizeof(s1ap_message));
|
||||
|
||||
message.direction = S1AP_PDU_PR_initiatingMessage;
|
||||
message.procedureCode = S1ap_ProcedureCode_id_S1Setup;
|
||||
message.criticality = S1ap_Criticality_reject;
|
||||
|
||||
s1SetupRequest_p = &message.msg.s1ap_S1SetupRequestIEs;
|
||||
memset((void *)&plmnIdentity, 0, sizeof(S1ap_PLMNidentity_t));
|
||||
|
||||
memset((void *)&ta, 0, sizeof(S1ap_SupportedTAs_Item_t));
|
||||
|
||||
s1ap_mme_data_p->state = S1AP_ENB_STATE_WAITING;
|
||||
|
||||
s1SetupRequest_p->global_ENB_ID.eNB_ID.present = S1ap_ENB_ID_PR_macroENB_ID;
|
||||
MACRO_ENB_ID_TO_BIT_STRING(instance_p->eNB_id,
|
||||
&s1SetupRequest_p->global_ENB_ID.eNB_ID.choice.macroENB_ID);
|
||||
/* Prepare the S1AP message to encode */
|
||||
memset(&pdu, 0, sizeof(pdu));
|
||||
pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage;
|
||||
pdu.choice.initiatingMessage.procedureCode = S1AP_ProcedureCode_id_S1Setup;
|
||||
pdu.choice.initiatingMessage.criticality = S1AP_Criticality_reject;
|
||||
pdu.choice.initiatingMessage.value.present = S1AP_InitiatingMessage__value_PR_S1SetupRequest;
|
||||
out = &pdu.choice.initiatingMessage.value.choice.S1SetupRequest;
|
||||
ie = (S1AP_S1SetupRequestIEs_t *)calloc(1, sizeof(S1AP_S1SetupRequestIEs_t));
|
||||
ie->id = S1AP_ProtocolIE_ID_id_Global_ENB_ID;
|
||||
ie->criticality = S1AP_Criticality_reject;
|
||||
ie->value.present = S1AP_S1SetupRequestIEs__value_PR_Global_ENB_ID;
|
||||
MCC_MNC_TO_PLMNID(instance_p->mcc, instance_p->mnc, instance_p->mnc_digit_length,
|
||||
&s1SetupRequest_p->global_ENB_ID.pLMNidentity);
|
||||
&ie->value.choice.Global_ENB_ID.pLMNidentity);
|
||||
ie->value.choice.Global_ENB_ID.eNB_ID.present = S1AP_ENB_ID_PR_macroENB_ID;
|
||||
MACRO_ENB_ID_TO_BIT_STRING(instance_p->eNB_id,
|
||||
&ie->value.choice.Global_ENB_ID.eNB_ID.choice.macroENB_ID);
|
||||
S1AP_INFO("%d -> %02x%02x%02x\n", instance_p->eNB_id,
|
||||
ie->value.choice.Global_ENB_ID.eNB_ID.choice.macroENB_ID.buf[0],
|
||||
ie->value.choice.Global_ENB_ID.eNB_ID.choice.macroENB_ID.buf[1],
|
||||
ie->value.choice.Global_ENB_ID.eNB_ID.choice.macroENB_ID.buf[2]);
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
|
||||
S1AP_INFO("%d -> %02x%02x%02x\n", instance_p->eNB_id, s1SetupRequest_p->global_ENB_ID.eNB_ID.choice.macroENB_ID.buf[0], s1SetupRequest_p->global_ENB_ID.eNB_ID.choice.macroENB_ID.buf[1],
|
||||
s1SetupRequest_p->global_ENB_ID.eNB_ID.choice.macroENB_ID.buf[2]);
|
||||
|
||||
INT16_TO_OCTET_STRING(instance_p->tac, &ta.tAC);
|
||||
MCC_MNC_TO_TBCD(instance_p->mcc, instance_p->mnc, instance_p->mnc_digit_length, &plmnIdentity);
|
||||
|
||||
ASN_SEQUENCE_ADD(&ta.broadcastPLMNs.list, &plmnIdentity);
|
||||
ASN_SEQUENCE_ADD(&s1SetupRequest_p->supportedTAs.list, &ta);
|
||||
|
||||
s1SetupRequest_p->defaultPagingDRX = instance_p->default_drx;
|
||||
|
||||
if (instance_p->eNB_name != NULL) {
|
||||
s1SetupRequest_p->presenceMask |= S1AP_S1SETUPREQUESTIES_ENBNAME_PRESENT;
|
||||
OCTET_STRING_fromBuf(&s1SetupRequest_p->eNBname, instance_p->eNB_name,
|
||||
/* optional */
|
||||
if (instance_p->eNB_name) {
|
||||
ie = (S1AP_S1SetupRequestIEs_t *)calloc(1, sizeof(S1AP_S1SetupRequestIEs_t));
|
||||
ie->id = S1AP_ProtocolIE_ID_id_eNBname;
|
||||
ie->criticality = S1AP_Criticality_ignore;
|
||||
ie->value.present = S1AP_S1SetupRequestIEs__value_PR_ENBname;
|
||||
OCTET_STRING_fromBuf(&ie->value.choice.ENBname, instance_p->eNB_name,
|
||||
strlen(instance_p->eNB_name));
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
}
|
||||
|
||||
if (s1ap_eNB_encode_pdu(&message, &buffer, &len) < 0) {
|
||||
ie = (S1AP_S1SetupRequestIEs_t *)calloc(1, sizeof(S1AP_S1SetupRequestIEs_t));
|
||||
ie->id = S1AP_ProtocolIE_ID_id_SupportedTAs;
|
||||
ie->criticality = S1AP_Criticality_reject;
|
||||
ie->value.present = S1AP_S1SetupRequestIEs__value_PR_SupportedTAs;
|
||||
ta = (S1AP_SupportedTAs_Item_t *)calloc(1, sizeof(S1AP_SupportedTAs_Item_t));
|
||||
INT16_TO_OCTET_STRING(instance_p->tac, &ta->tAC);
|
||||
plmn = (S1AP_PLMNidentity_t *)calloc(1, sizeof(S1AP_PLMNidentity_t));
|
||||
MCC_MNC_TO_TBCD(instance_p->mcc, instance_p->mnc, instance_p->mnc_digit_length, plmn);
|
||||
ASN_SEQUENCE_ADD(&ta->broadcastPLMNs.list, plmn);
|
||||
ASN_SEQUENCE_ADD(&ie->value.choice.SupportedTAs.list, ta);
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
ie = (S1AP_S1SetupRequestIEs_t *)calloc(1, sizeof(S1AP_S1SetupRequestIEs_t));
|
||||
ie->id = S1AP_ProtocolIE_ID_id_DefaultPagingDRX;
|
||||
ie->criticality = S1AP_Criticality_ignore;
|
||||
ie->value.present = S1AP_S1SetupRequestIEs__value_PR_PagingDRX;
|
||||
ie->value.choice.PagingDRX = instance_p->default_drx;
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
|
||||
/* optional */
|
||||
if (0) {
|
||||
ie = (S1AP_S1SetupRequestIEs_t *)calloc(1, sizeof(S1AP_S1SetupRequestIEs_t));
|
||||
ie->id = S1AP_ProtocolIE_ID_id_CSG_IdList;
|
||||
ie->criticality = S1AP_Criticality_reject;
|
||||
ie->value.present = S1AP_S1SetupRequestIEs__value_PR_CSG_IdList;
|
||||
// ie->value.choice.CSG_IdList = ;
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
}
|
||||
|
||||
/* optional */
|
||||
if (0) {
|
||||
ie = (S1AP_S1SetupRequestIEs_t *)calloc(1, sizeof(S1AP_S1SetupRequestIEs_t));
|
||||
ie->id = S1AP_ProtocolIE_ID_id_UE_RetentionInformation ;
|
||||
ie->criticality = S1AP_Criticality_ignore;
|
||||
ie->value.present = S1AP_S1SetupRequestIEs__value_PR_UE_RetentionInformation;
|
||||
// ie->value.choice.UE_RetentionInformation = ;
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
}
|
||||
|
||||
/* optional */
|
||||
if (0) {
|
||||
ie = (S1AP_S1SetupRequestIEs_t *)calloc(1, sizeof(S1AP_S1SetupRequestIEs_t));
|
||||
ie->id = S1AP_ProtocolIE_ID_id_NB_IoT_DefaultPagingDRX;
|
||||
ie->criticality = S1AP_Criticality_ignore;
|
||||
ie->value.present = S1AP_S1SetupRequestIEs__value_PR_NB_IoT_DefaultPagingDRX;
|
||||
// ie->value.choice.NB_IoT_DefaultPagingDRX = ;
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
}
|
||||
|
||||
if (s1ap_eNB_encode_pdu(&pdu, &buffer, &len) < 0) {
|
||||
S1AP_ERROR("Failed to encode S1 setup request\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Non UE-Associated signalling -> stream = 0 */
|
||||
s1ap_eNB_itti_send_sctp_data_req(instance_p->instance, s1ap_mme_data_p->assoc_id, buffer, len, 0);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
*/
|
||||
|
||||
/*! \file s1ap_eNB_context_management_procedures.c
|
||||
* \brief S1AP context management procedures
|
||||
* \author S. Roux and Navid Nikaein
|
||||
* \brief S1AP context management procedures
|
||||
* \author S. Roux and Navid Nikaein
|
||||
* \date 2010 - 2015
|
||||
* \email: navid.nikaein@eurecom.fr
|
||||
* \version 1.0
|
||||
@@ -41,7 +41,6 @@
|
||||
|
||||
#include "s1ap_eNB_itti_messaging.h"
|
||||
|
||||
#include "s1ap_ies_defs.h"
|
||||
#include "s1ap_eNB_encoder.h"
|
||||
#include "s1ap_eNB_nnsf.h"
|
||||
#include "s1ap_eNB_ue_context.h"
|
||||
@@ -54,27 +53,22 @@
|
||||
int s1ap_ue_context_release_complete(instance_t instance,
|
||||
s1ap_ue_release_complete_t *ue_release_complete_p)
|
||||
{
|
||||
s1ap_eNB_instance_t *s1ap_eNB_instance_p = NULL;
|
||||
struct s1ap_eNB_ue_context_s *ue_context_p = NULL;
|
||||
|
||||
S1ap_UEContextReleaseCompleteIEs_t *ue_ctxt_release_complete_ies_p = NULL;
|
||||
|
||||
s1ap_message message;
|
||||
|
||||
s1ap_eNB_instance_t *s1ap_eNB_instance_p = NULL;
|
||||
struct s1ap_eNB_ue_context_s *ue_context_p = NULL;
|
||||
S1AP_S1AP_PDU_t pdu;
|
||||
S1AP_UEContextReleaseComplete_t *out;
|
||||
S1AP_UEContextReleaseComplete_IEs_t *ie;
|
||||
uint8_t *buffer;
|
||||
uint32_t length;
|
||||
int ret = -1;
|
||||
|
||||
/* Retrieve the S1AP eNB instance associated with Mod_id */
|
||||
s1ap_eNB_instance_p = s1ap_eNB_get_instance(instance);
|
||||
|
||||
DevAssert(ue_release_complete_p != NULL);
|
||||
DevAssert(s1ap_eNB_instance_p != NULL);
|
||||
|
||||
/*RB_FOREACH(ue_context_p, s1ap_ue_map, &s1ap_eNB_instance_p->s1ap_ue_head) {
|
||||
S1AP_WARN("in s1ap_ue_map: UE context eNB_ue_s1ap_id %u mme_ue_s1ap_id %u state %u\n",
|
||||
ue_context_p->eNB_ue_s1ap_id, ue_context_p->mme_ue_s1ap_id,
|
||||
ue_context_p->ue_state);
|
||||
S1AP_WARN("in s1ap_ue_map: UE context eNB_ue_s1ap_id %u mme_ue_s1ap_id %u state %u\n",
|
||||
ue_context_p->eNB_ue_s1ap_id, ue_context_p->mme_ue_s1ap_id,
|
||||
ue_context_p->ue_state);
|
||||
}*/
|
||||
if ((ue_context_p = s1ap_eNB_get_ue_context(s1ap_eNB_instance_p,
|
||||
ue_release_complete_p->eNB_ue_s1ap_id)) == NULL) {
|
||||
@@ -85,20 +79,62 @@ int s1ap_ue_context_release_complete(instance_t instance,
|
||||
}
|
||||
|
||||
/* Prepare the S1AP message to encode */
|
||||
memset(&message, 0, sizeof(s1ap_message));
|
||||
memset(&pdu, 0, sizeof(pdu));
|
||||
pdu.present = S1AP_S1AP_PDU_PR_successfulOutcome;
|
||||
pdu.choice.successfulOutcome.procedureCode = S1AP_ProcedureCode_id_UEContextRelease;
|
||||
pdu.choice.successfulOutcome.criticality = S1AP_Criticality_reject;
|
||||
pdu.choice.successfulOutcome.value.present = S1AP_SuccessfulOutcome__value_PR_UEContextReleaseComplete;
|
||||
out = &pdu.choice.successfulOutcome.value.choice.UEContextReleaseComplete;
|
||||
ie = (S1AP_UEContextReleaseComplete_IEs_t *)calloc(1, sizeof(S1AP_UEContextReleaseComplete_IEs_t));
|
||||
ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID;
|
||||
ie->criticality = S1AP_Criticality_ignore;
|
||||
ie->value.present = S1AP_UEContextReleaseComplete_IEs__value_PR_MME_UE_S1AP_ID;
|
||||
ie->value.choice.MME_UE_S1AP_ID = ue_context_p->mme_ue_s1ap_id;
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
ie = (S1AP_UEContextReleaseComplete_IEs_t *)calloc(1, sizeof(S1AP_UEContextReleaseComplete_IEs_t));
|
||||
ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID;
|
||||
ie->criticality = S1AP_Criticality_ignore;
|
||||
ie->value.present = S1AP_UEContextReleaseComplete_IEs__value_PR_ENB_UE_S1AP_ID;
|
||||
ie->value.choice.ENB_UE_S1AP_ID = ue_release_complete_p->eNB_ue_s1ap_id;
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
|
||||
message.direction = S1AP_PDU_PR_successfulOutcome;
|
||||
message.procedureCode = S1ap_ProcedureCode_id_UEContextRelease;
|
||||
//message.criticality = S1ap_Criticality_reject;
|
||||
/* optional */
|
||||
if (0) {
|
||||
ie = (S1AP_UEContextReleaseComplete_IEs_t *)calloc(1, sizeof(S1AP_UEContextReleaseComplete_IEs_t));
|
||||
ie->id = S1AP_ProtocolIE_ID_id_CriticalityDiagnostics;
|
||||
ie->criticality = S1AP_Criticality_ignore;
|
||||
ie->value.present = S1AP_UEContextReleaseComplete_IEs__value_PR_CriticalityDiagnostics;
|
||||
// ie->value.choice.CriticalityDiagnostics = ;
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
}
|
||||
|
||||
ue_ctxt_release_complete_ies_p = &message.msg.s1ap_UEContextReleaseCompleteIEs;
|
||||
/* release 12 */
|
||||
if (0) {
|
||||
ie = (S1AP_UEContextReleaseComplete_IEs_t *)calloc(1, sizeof(S1AP_UEContextReleaseComplete_IEs_t));
|
||||
ie->id = S1AP_ProtocolIE_ID_id_UserLocationInformation;
|
||||
ie->criticality = S1AP_Criticality_ignore;
|
||||
ie->value.present = S1AP_UEContextReleaseComplete_IEs__value_PR_UserLocationInformation;
|
||||
// ie->value.choice.UserLocationInformation = ;
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
}
|
||||
|
||||
ue_ctxt_release_complete_ies_p->eNB_UE_S1AP_ID = ue_release_complete_p->eNB_ue_s1ap_id;
|
||||
ue_ctxt_release_complete_ies_p->mme_ue_s1ap_id = ue_context_p->mme_ue_s1ap_id;
|
||||
//ue_ctxt_release_complete_ies_p->criticalityDiagnostics
|
||||
//ue_ctxt_release_complete_ies_p->presenceMask
|
||||
/* release 13 */
|
||||
if (0) {
|
||||
ie = (S1AP_UEContextReleaseComplete_IEs_t *)calloc(1, sizeof(S1AP_UEContextReleaseComplete_IEs_t));
|
||||
ie->id = S1AP_ProtocolIE_ID_id_InformationOnRecommendedCellsAndENBsForPaging;
|
||||
ie->criticality = S1AP_Criticality_ignore;
|
||||
ie->value.present = S1AP_UEContextReleaseComplete_IEs__value_PR_InformationOnRecommendedCellsAndENBsForPaging;
|
||||
// ie->value.choice.InformationOnRecommendedCellsAndENBsForPaging = ;
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
ie = (S1AP_UEContextReleaseComplete_IEs_t *)calloc(1, sizeof(S1AP_UEContextReleaseComplete_IEs_t));
|
||||
ie->id = S1AP_ProtocolIE_ID_id_CellIdentifierAndCELevelForCECapableUEs;
|
||||
ie->criticality = S1AP_Criticality_ignore;
|
||||
ie->value.present = S1AP_UEContextReleaseComplete_IEs__value_PR_CellIdentifierAndCELevelForCECapableUEs;
|
||||
// ie->value.choice.CellIdentifierAndCELevelForCECapableUEs = ;
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
}
|
||||
|
||||
if (s1ap_eNB_encode_pdu(&message, &buffer, &length) < 0) {
|
||||
if (s1ap_eNB_encode_pdu(&pdu, &buffer, &length) < 0) {
|
||||
/* Encode procedure has failed... */
|
||||
S1AP_ERROR("Failed to encode UE context release complete\n");
|
||||
return -1;
|
||||
@@ -113,18 +149,12 @@ int s1ap_ue_context_release_complete(instance_t instance,
|
||||
0,0, //MSC_AS_TIME_ARGS(ctxt_pP),
|
||||
ue_ctxt_release_complete_ies_p->eNB_UE_S1AP_ID,
|
||||
ue_ctxt_release_complete_ies_p->mme_ue_s1ap_id);
|
||||
|
||||
/* UE associated signalling -> use the allocated stream */
|
||||
s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance,
|
||||
ue_context_p->mme_ref->assoc_id, buffer,
|
||||
length, ue_context_p->tx_stream);
|
||||
|
||||
|
||||
//LG s1ap_eNB_itti_send_sctp_close_association(s1ap_eNB_instance_p->instance,
|
||||
// ue_context_p->mme_ref->assoc_id);
|
||||
|
||||
|
||||
|
||||
// release UE context
|
||||
struct s1ap_eNB_ue_context_s *ue_context2_p = NULL;
|
||||
|
||||
@@ -137,29 +167,28 @@ int s1ap_ue_context_release_complete(instance_t instance,
|
||||
S1AP_WARN("Removing UE context eNB_ue_s1ap_id %u: did not find context\n",
|
||||
ue_context_p->eNB_ue_s1ap_id);
|
||||
}
|
||||
/*RB_FOREACH(ue_context_p, s1ap_ue_map, &s1ap_eNB_instance_p->s1ap_ue_head) {
|
||||
S1AP_WARN("in s1ap_ue_map: UE context eNB_ue_s1ap_id %u mme_ue_s1ap_id %u state %u\n",
|
||||
ue_context_p->eNB_ue_s1ap_id, ue_context_p->mme_ue_s1ap_id,
|
||||
ue_context_p->ue_state);
|
||||
}*/
|
||||
|
||||
return ret;
|
||||
/*RB_FOREACH(ue_context_p, s1ap_ue_map, &s1ap_eNB_instance_p->s1ap_ue_head) {
|
||||
S1AP_WARN("in s1ap_ue_map: UE context eNB_ue_s1ap_id %u mme_ue_s1ap_id %u state %u\n",
|
||||
ue_context_p->eNB_ue_s1ap_id, ue_context_p->mme_ue_s1ap_id,
|
||||
ue_context_p->ue_state);
|
||||
}*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int s1ap_ue_context_release_req(instance_t instance,
|
||||
s1ap_ue_release_req_t *ue_release_req_p)
|
||||
{
|
||||
s1ap_eNB_instance_t *s1ap_eNB_instance_p = NULL;
|
||||
struct s1ap_eNB_ue_context_s *ue_context_p = NULL;
|
||||
S1ap_UEContextReleaseRequestIEs_t *ue_ctxt_release_request_ies_p = NULL;
|
||||
s1ap_message message;
|
||||
uint8_t *buffer = NULL;
|
||||
uint32_t length;
|
||||
|
||||
s1ap_eNB_instance_t *s1ap_eNB_instance_p = NULL;
|
||||
struct s1ap_eNB_ue_context_s *ue_context_p = NULL;
|
||||
S1AP_S1AP_PDU_t pdu;
|
||||
S1AP_UEContextReleaseRequest_t *out;
|
||||
S1AP_UEContextReleaseRequest_IEs_t *ie;
|
||||
uint8_t *buffer = NULL;
|
||||
uint32_t length;
|
||||
/* Retrieve the S1AP eNB instance associated with Mod_id */
|
||||
s1ap_eNB_instance_p = s1ap_eNB_get_instance(instance);
|
||||
|
||||
DevAssert(ue_release_req_p != NULL);
|
||||
DevAssert(s1ap_eNB_instance_p != NULL);
|
||||
|
||||
@@ -172,50 +201,74 @@ int s1ap_ue_context_release_req(instance_t instance,
|
||||
}
|
||||
|
||||
/* Prepare the S1AP message to encode */
|
||||
memset(&message, 0, sizeof(s1ap_message));
|
||||
|
||||
message.direction = S1AP_PDU_PR_initiatingMessage;
|
||||
message.procedureCode = S1ap_ProcedureCode_id_UEContextReleaseRequest;
|
||||
//message.criticality = S1ap_Criticality_reject;
|
||||
|
||||
ue_ctxt_release_request_ies_p = &message.msg.s1ap_UEContextReleaseRequestIEs;
|
||||
|
||||
ue_ctxt_release_request_ies_p->eNB_UE_S1AP_ID = ue_release_req_p->eNB_ue_s1ap_id;
|
||||
ue_ctxt_release_request_ies_p->mme_ue_s1ap_id = ue_context_p->mme_ue_s1ap_id;
|
||||
memset(&pdu, 0, sizeof(pdu));
|
||||
pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage;
|
||||
pdu.choice.initiatingMessage.procedureCode = S1AP_ProcedureCode_id_UEContextReleaseRequest;
|
||||
pdu.choice.initiatingMessage.criticality = S1AP_Criticality_ignore;
|
||||
pdu.choice.initiatingMessage.value.present = S1AP_InitiatingMessage__value_PR_UEContextReleaseRequest;
|
||||
out = &pdu.choice.initiatingMessage.value.choice.UEContextReleaseRequest;
|
||||
ie = (S1AP_UEContextReleaseRequest_IEs_t *)calloc(1, sizeof(S1AP_UEContextReleaseRequest_IEs_t));
|
||||
ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID;
|
||||
ie->criticality = S1AP_Criticality_reject;
|
||||
ie->value.present = S1AP_UEContextReleaseRequest_IEs__value_PR_MME_UE_S1AP_ID;
|
||||
ie->value.choice.MME_UE_S1AP_ID = ue_context_p->mme_ue_s1ap_id;
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
ie = (S1AP_UEContextReleaseRequest_IEs_t *)calloc(1, sizeof(S1AP_UEContextReleaseRequest_IEs_t));
|
||||
ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID;
|
||||
ie->criticality = S1AP_Criticality_reject;
|
||||
ie->value.present = S1AP_UEContextReleaseRequest_IEs__value_PR_ENB_UE_S1AP_ID;
|
||||
ie->value.choice.ENB_UE_S1AP_ID = ue_release_req_p->eNB_ue_s1ap_id;
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
ie = (S1AP_UEContextReleaseRequest_IEs_t *)calloc(1, sizeof(S1AP_UEContextReleaseRequest_IEs_t));
|
||||
ie->id = S1AP_ProtocolIE_ID_id_Cause;
|
||||
ie->criticality = S1AP_Criticality_ignore;
|
||||
ie->value.present = S1AP_UEContextReleaseRequest_IEs__value_PR_Cause;
|
||||
|
||||
switch (ue_release_req_p->cause) {
|
||||
case S1AP_CAUSE_NOTHING:
|
||||
ue_ctxt_release_request_ies_p->cause.present = S1ap_Cause_PR_NOTHING;
|
||||
break;
|
||||
case S1AP_Cause_PR_radioNetwork:
|
||||
ie->value.choice.Cause.present = S1AP_Cause_PR_radioNetwork;
|
||||
ie->value.choice.Cause.choice.radioNetwork = ue_release_req_p->cause_value;
|
||||
break;
|
||||
|
||||
case S1AP_CAUSE_RADIO_NETWORK:
|
||||
ue_ctxt_release_request_ies_p->cause.present = S1ap_Cause_PR_radioNetwork;
|
||||
ue_ctxt_release_request_ies_p->cause.choice.radioNetwork = ue_release_req_p->cause_value;
|
||||
break;
|
||||
case S1AP_Cause_PR_transport:
|
||||
ie->value.choice.Cause.present = S1AP_Cause_PR_transport;
|
||||
ie->value.choice.Cause.choice.transport = ue_release_req_p->cause_value;
|
||||
break;
|
||||
|
||||
case S1AP_CAUSE_TRANSPORT:
|
||||
ue_ctxt_release_request_ies_p->cause.present = S1ap_Cause_PR_transport;
|
||||
ue_ctxt_release_request_ies_p->cause.choice.transport = ue_release_req_p->cause_value;
|
||||
break;
|
||||
case S1AP_Cause_PR_nas:
|
||||
ie->value.choice.Cause.present = S1AP_Cause_PR_nas;
|
||||
ie->value.choice.Cause.choice.nas = ue_release_req_p->cause_value;
|
||||
break;
|
||||
|
||||
case S1AP_CAUSE_NAS:
|
||||
ue_ctxt_release_request_ies_p->cause.present = S1ap_Cause_PR_nas;
|
||||
ue_ctxt_release_request_ies_p->cause.choice.nas = ue_release_req_p->cause_value;
|
||||
break;
|
||||
case S1AP_Cause_PR_protocol:
|
||||
ie->value.choice.Cause.present = S1AP_Cause_PR_protocol;
|
||||
ie->value.choice.Cause.choice.protocol = ue_release_req_p->cause_value;
|
||||
break;
|
||||
|
||||
case S1AP_CAUSE_PROTOCOL:
|
||||
ue_ctxt_release_request_ies_p->cause.present = S1ap_Cause_PR_protocol;
|
||||
ue_ctxt_release_request_ies_p->cause.choice.protocol = ue_release_req_p->cause_value;
|
||||
break;
|
||||
case S1AP_Cause_PR_misc:
|
||||
ie->value.choice.Cause.present = S1AP_Cause_PR_misc;
|
||||
ie->value.choice.Cause.choice.misc = ue_release_req_p->cause_value;
|
||||
break;
|
||||
|
||||
case S1AP_CAUSE_MISC:
|
||||
default:
|
||||
ue_ctxt_release_request_ies_p->cause.present = S1ap_Cause_PR_misc;
|
||||
ue_ctxt_release_request_ies_p->cause.choice.misc = ue_release_req_p->cause_value;
|
||||
break;
|
||||
case S1AP_Cause_PR_NOTHING:
|
||||
default:
|
||||
ie->value.choice.Cause.present = S1AP_Cause_PR_NOTHING;
|
||||
break;
|
||||
}
|
||||
|
||||
if (s1ap_eNB_encode_pdu(&message, &buffer, &length) < 0) {
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
|
||||
/* optional */
|
||||
if (0) {
|
||||
ie = (S1AP_UEContextReleaseRequest_IEs_t *)calloc(1, sizeof(S1AP_UEContextReleaseRequest_IEs_t));
|
||||
ie->id = S1AP_ProtocolIE_ID_id_GWContextReleaseIndication;
|
||||
ie->criticality = S1AP_Criticality_reject;
|
||||
ie->value.present = S1AP_UEContextReleaseRequest_IEs__value_PR_GWContextReleaseIndication;
|
||||
ie->value.choice.GWContextReleaseIndication = TRUE;
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
}
|
||||
|
||||
if (s1ap_eNB_encode_pdu(&pdu, &buffer, &length) < 0) {
|
||||
/* Encode procedure has failed... */
|
||||
S1AP_ERROR("Failed to encode UE context release complete\n");
|
||||
return -1;
|
||||
@@ -230,12 +283,10 @@ int s1ap_ue_context_release_req(instance_t instance,
|
||||
0,0,//MSC_AS_TIME_ARGS(ctxt_pP),
|
||||
ue_ctxt_release_request_ies_p->eNB_UE_S1AP_ID,
|
||||
ue_ctxt_release_request_ies_p->mme_ue_s1ap_id);
|
||||
|
||||
/* UE associated signalling -> use the allocated stream */
|
||||
s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance,
|
||||
ue_context_p->mme_ref->assoc_id, buffer,
|
||||
length, ue_context_p->tx_stream);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
+138
-206
@@ -34,235 +34,172 @@
|
||||
#include "intertask_interface.h"
|
||||
|
||||
#include "s1ap_common.h"
|
||||
#include "s1ap_ies_defs.h"
|
||||
#include "s1ap_eNB_decoder.h"
|
||||
|
||||
static int s1ap_eNB_decode_initiating_message(s1ap_message *message,
|
||||
S1ap_InitiatingMessage_t *initiating_p)
|
||||
|
||||
static int s1ap_eNB_decode_initiating_message(S1AP_S1AP_PDU_t *pdu)
|
||||
{
|
||||
int ret = -1;
|
||||
MessageDef *message_p;
|
||||
char *message_string = NULL;
|
||||
size_t message_string_size;
|
||||
MessagesIds message_id;
|
||||
asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} };
|
||||
DevAssert(pdu != NULL);
|
||||
|
||||
DevAssert(initiating_p != NULL);
|
||||
switch(pdu->choice.initiatingMessage.procedureCode) {
|
||||
case S1AP_ProcedureCode_id_downlinkNASTransport:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
message_id = S1AP_DOWNLINK_NAS_LOG;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id,
|
||||
res.result.encoded + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_downlink_nas_log.size = res.result.encoded;
|
||||
memcpy(&message_p->ittiMsg.s1ap_downlink_nas_log.text, res.buffer, res.result.encoded);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(res.buffer);
|
||||
break;
|
||||
|
||||
message_string = calloc(10000, sizeof(char));
|
||||
case S1AP_ProcedureCode_id_InitialContextSetup:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
message_id = S1AP_INITIAL_CONTEXT_SETUP_LOG;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id,
|
||||
res.result.encoded + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_initial_context_setup_log.size = res.result.encoded;
|
||||
memcpy(&message_p->ittiMsg.s1ap_initial_context_setup_log.text, res.buffer, res.result.encoded);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(res.buffer);
|
||||
break;
|
||||
|
||||
s1ap_string_total_size = 0;
|
||||
case S1AP_ProcedureCode_id_UEContextRelease:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
message_id = S1AP_UE_CONTEXT_RELEASE_COMMAND_LOG;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id,
|
||||
res.result.encoded + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_ue_context_release_command_log.size = res.result.encoded;
|
||||
memcpy(&message_p->ittiMsg.s1ap_ue_context_release_command_log.text, res.buffer, res.result.encoded);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(res.buffer);
|
||||
break;
|
||||
|
||||
message->procedureCode = initiating_p->procedureCode;
|
||||
message->criticality = initiating_p->criticality;
|
||||
case S1AP_ProcedureCode_id_Paging:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
message_id = S1AP_PAGING_LOG;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id,
|
||||
res.result.encoded + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_paging_log.size = res.result.encoded;
|
||||
memcpy(&message_p->ittiMsg.s1ap_paging_log.text, res.buffer, res.result.encoded);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
S1AP_INFO("Paging initiating message\n");
|
||||
free(res.buffer);
|
||||
break;
|
||||
|
||||
switch(initiating_p->procedureCode) {
|
||||
case S1ap_ProcedureCode_id_downlinkNASTransport:
|
||||
ret = s1ap_decode_s1ap_downlinknastransporties(
|
||||
&message->msg.s1ap_DownlinkNASTransportIEs,
|
||||
&initiating_p->value);
|
||||
s1ap_xer_print_s1ap_downlinknastransport(s1ap_xer__print2sp,
|
||||
message_string,
|
||||
message);
|
||||
message_id = S1AP_DOWNLINK_NAS_LOG;
|
||||
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_downlink_nas_log.size = message_string_size;
|
||||
memcpy(&message_p->ittiMsg.s1ap_downlink_nas_log.text, message_string, message_string_size);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(message_string);
|
||||
break;
|
||||
case S1AP_ProcedureCode_id_E_RABSetup:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
message_id = S1AP_E_RAB_SETUP_REQUEST_LOG;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id,
|
||||
res.result.encoded + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_e_rab_setup_request_log.size = res.result.encoded;
|
||||
memcpy(&message_p->ittiMsg.s1ap_e_rab_setup_request_log.text, res.buffer, res.result.encoded);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(res.buffer);
|
||||
S1AP_INFO("E_RABSetup initiating message\n");
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_InitialContextSetup:
|
||||
ret = s1ap_decode_s1ap_initialcontextsetuprequesties(
|
||||
&message->msg.s1ap_InitialContextSetupRequestIEs, &initiating_p->value);
|
||||
s1ap_xer_print_s1ap_initialcontextsetuprequest(s1ap_xer__print2sp, message_string, message);
|
||||
message_id = S1AP_INITIAL_CONTEXT_SETUP_LOG;
|
||||
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);
|
||||
free(message_string);
|
||||
break;
|
||||
case S1AP_ProcedureCode_id_E_RABModify:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
message_id = S1AP_E_RAB_MODIFY_REQUEST_LOG;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id,
|
||||
res.result.encoded + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_e_rab_modify_request_log.size = res.result.encoded;
|
||||
memcpy(&message_p->ittiMsg.s1ap_e_rab_modify_request_log.text, res.buffer, res.result.encoded);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(res.buffer);
|
||||
S1AP_INFO("E_RABModify initiating message\n");
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_UEContextRelease:
|
||||
ret = s1ap_decode_s1ap_uecontextreleasecommandies(
|
||||
&message->msg.s1ap_UEContextReleaseCommandIEs, &initiating_p->value);
|
||||
s1ap_xer_print_s1ap_uecontextreleasecommand(s1ap_xer__print2sp, message_string, message);
|
||||
message_id = S1AP_UE_CONTEXT_RELEASE_COMMAND_LOG;
|
||||
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_ue_context_release_command_log.size = message_string_size;
|
||||
memcpy(&message_p->ittiMsg.s1ap_ue_context_release_command_log.text, message_string, message_string_size);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(message_string);
|
||||
break;
|
||||
case S1AP_ProcedureCode_id_E_RABRelease:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
message_id = S1AP_E_RAB_RELEASE_REQUEST_LOG;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id,
|
||||
res.result.encoded + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_e_rab_release_request_log.size = res.result.encoded;
|
||||
memcpy(&message_p->ittiMsg.s1ap_e_rab_release_request_log.text, res.buffer, res.result.encoded);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(res.buffer);
|
||||
S1AP_INFO("TODO E_RABRelease nitiating message\n");
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_Paging:
|
||||
ret = s1ap_decode_s1ap_pagingies(
|
||||
&message->msg.s1ap_PagingIEs, &initiating_p->value);
|
||||
s1ap_xer_print_s1ap_paging(s1ap_xer__print2sp, message_string, message);
|
||||
message_id = S1AP_PAGING_LOG;
|
||||
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_paging_log.size = message_string_size;
|
||||
memcpy(&message_p->ittiMsg.s1ap_paging_log.text, message_string, message_string_size);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
S1AP_INFO("Paging initiating message\n");
|
||||
free(message_string);
|
||||
break;
|
||||
|
||||
|
||||
case S1ap_ProcedureCode_id_E_RABSetup:
|
||||
ret = s1ap_decode_s1ap_e_rabsetuprequesties(
|
||||
&message->msg.s1ap_E_RABSetupRequestIEs, &initiating_p->value);
|
||||
//s1ap_xer_print_s1ap_e_rabsetuprequest(s1ap_xer__print2sp, message_string, message);
|
||||
message_id = S1AP_E_RAB_SETUP_REQUEST_LOG;
|
||||
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_e_rab_setup_request_log.size = message_string_size;
|
||||
memcpy(&message_p->ittiMsg.s1ap_e_rab_setup_request_log.text, message_string, message_string_size);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(message_string);
|
||||
S1AP_INFO("E_RABSetup initiating message\n");
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_E_RABModify:
|
||||
ret = s1ap_decode_s1ap_e_rabmodifyrequesties(
|
||||
&message->msg.s1ap_E_RABModifyRequestIEs, &initiating_p->value);
|
||||
message_id = S1AP_E_RAB_MODIFY_REQUEST_LOG;
|
||||
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_e_rab_modify_request_log.size = message_string_size;
|
||||
memcpy(&message_p->ittiMsg.s1ap_e_rab_modify_request_log.text, message_string, message_string_size);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(message_string);
|
||||
S1AP_INFO("E_RABModify initiating message\n");
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_E_RABRelease:
|
||||
ret = s1ap_decode_s1ap_e_rabreleasecommandies(
|
||||
&message->msg.s1ap_E_RABReleaseCommandIEs, &initiating_p->value);
|
||||
s1ap_xer_print_s1ap_e_rabreleasecommand(s1ap_xer__print2sp, message_string, message);
|
||||
message_id = S1AP_E_RAB_RELEASE_REQUEST_LOG;
|
||||
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_e_rab_release_request_log.size = message_string_size;
|
||||
memcpy(&message_p->ittiMsg.s1ap_e_rab_release_request_log.text, message_string, message_string_size);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(message_string);
|
||||
S1AP_INFO("TODO E_RABRelease nitiating message\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
S1AP_ERROR("Unknown procedure ID (%d) for initiating message\n",
|
||||
(int)initiating_p->procedureCode);
|
||||
AssertFatal( 0 , "Unknown procedure ID (%d) for initiating message\n",
|
||||
(int)initiating_p->procedureCode);
|
||||
return -1;
|
||||
default:
|
||||
S1AP_ERROR("Unknown procedure ID (%d) for initiating message\n",
|
||||
(int)pdu->choice.initiatingMessage.procedureCode);
|
||||
AssertFatal( 0, "Unknown procedure ID (%d) for initiating message\n",
|
||||
(int)pdu->choice.initiatingMessage.procedureCode);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int s1ap_eNB_decode_successful_outcome(s1ap_message *message,
|
||||
S1ap_SuccessfulOutcome_t *successfullOutcome_p)
|
||||
static int s1ap_eNB_decode_successful_outcome(S1AP_S1AP_PDU_t *pdu)
|
||||
{
|
||||
int ret = -1;
|
||||
MessageDef *message_p;
|
||||
char *message_string = NULL;
|
||||
size_t message_string_size;
|
||||
MessagesIds message_id;
|
||||
asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} };
|
||||
DevAssert(pdu != NULL);
|
||||
|
||||
DevAssert(successfullOutcome_p != NULL);
|
||||
switch(pdu->choice.successfulOutcome.procedureCode) {
|
||||
case S1AP_ProcedureCode_id_S1Setup:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
message_id = S1AP_S1_SETUP_LOG;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_s1_setup_log.size = res.result.encoded;
|
||||
memcpy(&message_p->ittiMsg.s1ap_s1_setup_log.text, res.buffer, res.result.encoded);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(res.buffer);
|
||||
break;
|
||||
|
||||
message_string = malloc(sizeof(char) * 10000);
|
||||
memset((void*)message_string,0,sizeof(char) * 10000);
|
||||
|
||||
s1ap_string_total_size = 0;
|
||||
|
||||
message->procedureCode = successfullOutcome_p->procedureCode;
|
||||
message->criticality = successfullOutcome_p->criticality;
|
||||
|
||||
switch(successfullOutcome_p->procedureCode) {
|
||||
case S1ap_ProcedureCode_id_S1Setup:
|
||||
ret = s1ap_decode_s1ap_s1setupresponseies(
|
||||
&message->msg.s1ap_S1SetupResponseIEs, &successfullOutcome_p->value);
|
||||
s1ap_xer_print_s1ap_s1setupresponse(s1ap_xer__print2sp, message_string, message);
|
||||
message_id = S1AP_S1_SETUP_LOG;
|
||||
break;
|
||||
|
||||
default:
|
||||
S1AP_ERROR("Unknown procedure ID (%d) for successfull outcome message\n",
|
||||
(int)successfullOutcome_p->procedureCode);
|
||||
return -1;
|
||||
default:
|
||||
S1AP_ERROR("Unknown procedure ID (%d) for successfull outcome message\n",
|
||||
(int)pdu->choice.successfulOutcome.procedureCode);
|
||||
return -1;
|
||||
}
|
||||
|
||||
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_s1_setup_log.size = message_string_size;
|
||||
memcpy(&message_p->ittiMsg.s1ap_s1_setup_log.text, message_string, message_string_size);
|
||||
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
|
||||
free(message_string);
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int s1ap_eNB_decode_unsuccessful_outcome(s1ap_message *message,
|
||||
S1ap_UnsuccessfulOutcome_t *unSuccessfullOutcome_p)
|
||||
static int s1ap_eNB_decode_unsuccessful_outcome(S1AP_S1AP_PDU_t *pdu)
|
||||
{
|
||||
int ret = -1;
|
||||
DevAssert(unSuccessfullOutcome_p != NULL);
|
||||
MessageDef *message_p;
|
||||
MessagesIds message_id;
|
||||
asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} };
|
||||
DevAssert(pdu != NULL);
|
||||
|
||||
message->procedureCode = unSuccessfullOutcome_p->procedureCode;
|
||||
message->criticality = unSuccessfullOutcome_p->criticality;
|
||||
switch(pdu->choice.unsuccessfulOutcome.procedureCode) {
|
||||
case S1AP_ProcedureCode_id_S1Setup:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
message_id = S1AP_S1_SETUP_LOG;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_s1_setup_log.size = res.result.encoded;
|
||||
memcpy(&message_p->ittiMsg.s1ap_s1_setup_log.text, res.buffer, res.result.encoded);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(res.buffer);
|
||||
break;
|
||||
|
||||
switch(unSuccessfullOutcome_p->procedureCode) {
|
||||
case S1ap_ProcedureCode_id_S1Setup:
|
||||
return s1ap_decode_s1ap_s1setupfailureies(
|
||||
&message->msg.s1ap_S1SetupFailureIEs, &unSuccessfullOutcome_p->value);
|
||||
|
||||
default:
|
||||
S1AP_ERROR("Unknown procedure ID (%d) for unsuccessfull outcome message\n",
|
||||
(int)unSuccessfullOutcome_p->procedureCode);
|
||||
break;
|
||||
default:
|
||||
S1AP_ERROR("Unknown procedure ID (%d) for unsuccessfull outcome message\n",
|
||||
(int)pdu->choice.unsuccessfulOutcome.procedureCode);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int s1ap_eNB_decode_pdu(s1ap_message *message, const uint8_t * const buffer,
|
||||
int s1ap_eNB_decode_pdu(S1AP_S1AP_PDU_t *pdu, const uint8_t *const buffer,
|
||||
const uint32_t length)
|
||||
{
|
||||
S1AP_PDU_t pdu;
|
||||
S1AP_PDU_t *pdu_p = &pdu;
|
||||
asn_dec_rval_t dec_ret;
|
||||
|
||||
DevAssert(pdu != NULL);
|
||||
DevAssert(buffer != NULL);
|
||||
|
||||
memset((void *)pdu_p, 0, sizeof(S1AP_PDU_t));
|
||||
|
||||
dec_ret = aper_decode(NULL,
|
||||
&asn_DEF_S1AP_PDU,
|
||||
(void **)&pdu_p,
|
||||
&asn_DEF_S1AP_S1AP_PDU,
|
||||
(void **)pdu,
|
||||
buffer,
|
||||
length,
|
||||
0,
|
||||
@@ -273,24 +210,19 @@ int s1ap_eNB_decode_pdu(s1ap_message *message, const uint8_t * const buffer,
|
||||
return -1;
|
||||
}
|
||||
|
||||
message->direction = pdu_p->present;
|
||||
switch(pdu->present) {
|
||||
case S1AP_S1AP_PDU_PR_initiatingMessage:
|
||||
return s1ap_eNB_decode_initiating_message(pdu);
|
||||
|
||||
switch(pdu_p->present) {
|
||||
case S1AP_PDU_PR_initiatingMessage:
|
||||
return s1ap_eNB_decode_initiating_message(message,
|
||||
&pdu_p->choice.initiatingMessage);
|
||||
case S1AP_S1AP_PDU_PR_successfulOutcome:
|
||||
return s1ap_eNB_decode_successful_outcome(pdu);
|
||||
|
||||
case S1AP_PDU_PR_successfulOutcome:
|
||||
return s1ap_eNB_decode_successful_outcome(message,
|
||||
&pdu_p->choice.successfulOutcome);
|
||||
case S1AP_S1AP_PDU_PR_unsuccessfulOutcome:
|
||||
return s1ap_eNB_decode_unsuccessful_outcome(pdu);
|
||||
|
||||
case S1AP_PDU_PR_unsuccessfulOutcome:
|
||||
return s1ap_eNB_decode_unsuccessful_outcome(message,
|
||||
&pdu_p->choice.unsuccessfulOutcome);
|
||||
|
||||
default:
|
||||
S1AP_DEBUG("Unknown presence (%d) or not implemented\n", (int)pdu_p->present);
|
||||
break;
|
||||
default:
|
||||
S1AP_DEBUG("Unknown presence (%d) or not implemented\n", (int)pdu->present);
|
||||
break;
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
||||
@@ -20,12 +20,12 @@
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include "s1ap_ies_defs.h"
|
||||
|
||||
|
||||
#ifndef S1AP_ENB_DECODER_H_
|
||||
#define S1AP_ENB_DECODER_H_
|
||||
|
||||
int s1ap_eNB_decode_pdu(s1ap_message *message, const uint8_t * const buffer,
|
||||
int s1ap_eNB_decode_pdu(S1AP_S1AP_PDU_t *pdu, const uint8_t *const buffer,
|
||||
const uint32_t length) __attribute__ ((warn_unused_result));
|
||||
|
||||
#endif /* S1AP_ENB_DECODER_H_ */
|
||||
|
||||
+180
-544
@@ -32,615 +32,251 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include "assertions.h"
|
||||
|
||||
#include "conversions.h"
|
||||
|
||||
#include "intertask_interface.h"
|
||||
|
||||
#include "s1ap_common.h"
|
||||
#include "s1ap_ies_defs.h"
|
||||
#include "s1ap_eNB_encoder.h"
|
||||
|
||||
static inline int s1ap_eNB_encode_initiating(s1ap_message *message,
|
||||
static inline int s1ap_eNB_encode_initiating(S1AP_S1AP_PDU_t *pdu,
|
||||
uint8_t **buffer,
|
||||
uint32_t *len);
|
||||
|
||||
static inline int s1ap_eNB_encode_successfull_outcome(s1ap_message *message,
|
||||
static inline int s1ap_eNB_encode_successfull_outcome(S1AP_S1AP_PDU_t *pdu,
|
||||
uint8_t **buffer, uint32_t *len);
|
||||
|
||||
static inline int s1ap_eNB_encode_unsuccessfull_outcome(s1ap_message *message,
|
||||
static inline int s1ap_eNB_encode_unsuccessfull_outcome(S1AP_S1AP_PDU_t *pdu,
|
||||
uint8_t **buffer, uint32_t *len);
|
||||
|
||||
static inline int s1ap_eNB_encode_s1_setup_request(
|
||||
S1ap_S1SetupRequestIEs_t *s1SetupRequestIEs, uint8_t **buffer, uint32_t *length);
|
||||
|
||||
static inline int s1ap_eNB_encode_trace_failure(S1ap_TraceFailureIndicationIEs_t
|
||||
*trace_failure_ies_p, uint8_t **buffer,
|
||||
uint32_t *length);
|
||||
|
||||
static inline int s1ap_eNB_encode_initial_ue_message(S1ap_InitialUEMessageIEs_t
|
||||
*initialUEmessageIEs_p, uint8_t **buffer,
|
||||
uint32_t *length);
|
||||
|
||||
static inline int s1ap_eNB_encode_uplink_nas_transport(S1ap_UplinkNASTransportIEs_t
|
||||
*uplinkNASTransportIEs,
|
||||
uint8_t **buffer,
|
||||
uint32_t *length);
|
||||
|
||||
static inline int s1ap_eNB_encode_ue_capability_info_indication(
|
||||
S1ap_UECapabilityInfoIndicationIEs_t *ueCapabilityInfoIndicationIEs,
|
||||
uint8_t **buffer,
|
||||
uint32_t *length);
|
||||
|
||||
static inline int s1ap_eNB_encode_initial_context_setup_response(
|
||||
S1ap_InitialContextSetupResponseIEs_t *initialContextSetupResponseIEs,
|
||||
uint8_t **buffer,
|
||||
uint32_t *length);
|
||||
|
||||
static inline
|
||||
int s1ap_eNB_encode_nas_non_delivery(
|
||||
S1ap_NASNonDeliveryIndication_IEs_t *nasNonDeliveryIndicationIEs,
|
||||
uint8_t **buffer,
|
||||
uint32_t *length);
|
||||
|
||||
static inline
|
||||
int s1ap_eNB_encode_ue_context_release_complete(
|
||||
S1ap_UEContextReleaseCompleteIEs_t *s1ap_UEContextReleaseCompleteIEs,
|
||||
uint8_t **buffer,
|
||||
uint32_t *length);
|
||||
|
||||
static inline
|
||||
int s1ap_eNB_encode_ue_context_release_request(
|
||||
S1ap_UEContextReleaseRequestIEs_t *s1ap_UEContextReleaseRequestIEs,
|
||||
uint8_t **buffer,
|
||||
uint32_t *length);
|
||||
|
||||
static inline
|
||||
int s1ap_eNB_encode_e_rab_setup_response(S1ap_E_RABSetupResponseIEs_t *E_RABSetupResponseIEs,
|
||||
uint8_t **buffer,
|
||||
uint32_t *length);
|
||||
|
||||
static inline
|
||||
int s1ap_eNB_encode_e_rab_modify_response(S1ap_E_RABModifyResponseIEs_t *E_RABModifyResponseIEs,
|
||||
uint8_t **buffer,
|
||||
uint32_t *length);
|
||||
|
||||
static inline
|
||||
int s1ap_eNB_encode_e_rab_release_response(S1ap_E_RABReleaseResponseIEs_t *s1ap_E_RABReleaseResponseIEs,
|
||||
uint8_t **buffer,
|
||||
uint32_t *length);
|
||||
|
||||
int s1ap_eNB_encode_pdu(s1ap_message *message, uint8_t **buffer, uint32_t *len)
|
||||
int s1ap_eNB_encode_pdu(S1AP_S1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *len)
|
||||
{
|
||||
DevAssert(message != NULL);
|
||||
int ret = -1;
|
||||
DevAssert(pdu != NULL);
|
||||
DevAssert(buffer != NULL);
|
||||
DevAssert(len != NULL);
|
||||
|
||||
switch(message->direction) {
|
||||
case S1AP_PDU_PR_initiatingMessage:
|
||||
return s1ap_eNB_encode_initiating(message, buffer, len);
|
||||
switch(pdu->present) {
|
||||
case S1AP_S1AP_PDU_PR_initiatingMessage:
|
||||
ret = s1ap_eNB_encode_initiating(pdu, buffer, len);
|
||||
break;
|
||||
|
||||
case S1AP_PDU_PR_successfulOutcome:
|
||||
return s1ap_eNB_encode_successfull_outcome(message, buffer, len);
|
||||
case S1AP_S1AP_PDU_PR_successfulOutcome:
|
||||
ret = s1ap_eNB_encode_successfull_outcome(pdu, buffer, len);
|
||||
break;
|
||||
|
||||
case S1AP_PDU_PR_unsuccessfulOutcome:
|
||||
return s1ap_eNB_encode_unsuccessfull_outcome(message, buffer, len);
|
||||
case S1AP_S1AP_PDU_PR_unsuccessfulOutcome:
|
||||
ret = s1ap_eNB_encode_unsuccessfull_outcome(pdu, buffer, len);
|
||||
break;
|
||||
|
||||
default:
|
||||
S1AP_DEBUG("Unknown message outcome (%d) or not implemented",
|
||||
(int)message->direction);
|
||||
break;
|
||||
default:
|
||||
S1AP_DEBUG("Unknown message outcome (%d) or not implemented",
|
||||
(int)pdu->present);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return -1;
|
||||
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline
|
||||
int s1ap_eNB_encode_initiating(s1ap_message *s1ap_message_p,
|
||||
int s1ap_eNB_encode_initiating(S1AP_S1AP_PDU_t *pdu,
|
||||
uint8_t **buffer, uint32_t *len)
|
||||
{
|
||||
int ret = -1;
|
||||
MessageDef *message_p;
|
||||
char *message_string = NULL;
|
||||
size_t message_string_size;
|
||||
MessagesIds message_id;
|
||||
asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} };
|
||||
DevAssert(pdu != NULL);
|
||||
|
||||
DevAssert(s1ap_message_p != NULL);
|
||||
switch(pdu->choice.initiatingMessage.procedureCode) {
|
||||
case S1AP_ProcedureCode_id_S1Setup:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
message_id = S1AP_S1_SETUP_LOG;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_s1_setup_log.size = res.result.encoded;
|
||||
memcpy(&message_p->ittiMsg.s1ap_s1_setup_log.text, res.buffer, res.result.encoded);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(res.buffer);
|
||||
break;
|
||||
|
||||
message_string = calloc(10000, sizeof(char));
|
||||
case S1AP_ProcedureCode_id_uplinkNASTransport:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
message_id = S1AP_UPLINK_NAS_LOG;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_uplink_nas_log.size = res.result.encoded;
|
||||
memcpy(&message_p->ittiMsg.s1ap_uplink_nas_log.text, res.buffer, res.result.encoded);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(res.buffer);
|
||||
break;
|
||||
|
||||
s1ap_string_total_size = 0;
|
||||
case S1AP_ProcedureCode_id_UECapabilityInfoIndication:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
message_id = S1AP_UE_CAPABILITY_IND_LOG;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_ue_capability_ind_log.size = res.result.encoded;
|
||||
memcpy(&message_p->ittiMsg.s1ap_ue_capability_ind_log.text, res.buffer, res.result.encoded);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(res.buffer);
|
||||
break;
|
||||
|
||||
switch(s1ap_message_p->procedureCode) {
|
||||
case S1ap_ProcedureCode_id_S1Setup:
|
||||
ret = s1ap_eNB_encode_s1_setup_request(
|
||||
&s1ap_message_p->msg.s1ap_S1SetupRequestIEs, buffer, len);
|
||||
s1ap_xer_print_s1ap_s1setuprequest(s1ap_xer__print2sp, message_string, s1ap_message_p);
|
||||
message_id = S1AP_S1_SETUP_LOG;
|
||||
break;
|
||||
case S1AP_ProcedureCode_id_initialUEMessage:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
message_id = S1AP_INITIAL_UE_MESSAGE_LOG;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_initial_ue_message_log.size = res.result.encoded;
|
||||
memcpy(&message_p->ittiMsg.s1ap_initial_ue_message_log.text, res.buffer, res.result.encoded);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(res.buffer);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_uplinkNASTransport:
|
||||
ret = s1ap_eNB_encode_uplink_nas_transport(
|
||||
&s1ap_message_p->msg.s1ap_UplinkNASTransportIEs, buffer, len);
|
||||
s1ap_xer_print_s1ap_uplinknastransport(s1ap_xer__print2sp, message_string, s1ap_message_p);
|
||||
message_id = S1AP_UPLINK_NAS_LOG;
|
||||
break;
|
||||
case S1AP_ProcedureCode_id_NASNonDeliveryIndication:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
message_id = S1AP_NAS_NON_DELIVERY_IND_LOG;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_nas_non_delivery_ind_log.size = res.result.encoded;
|
||||
memcpy(&message_p->ittiMsg.s1ap_nas_non_delivery_ind_log.text, res.buffer, res.result.encoded);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(res.buffer);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_UECapabilityInfoIndication:
|
||||
ret = s1ap_eNB_encode_ue_capability_info_indication(
|
||||
&s1ap_message_p->msg.s1ap_UECapabilityInfoIndicationIEs, buffer, len);
|
||||
s1ap_xer_print_s1ap_uecapabilityinfoindication(s1ap_xer__print2sp, message_string, s1ap_message_p);
|
||||
message_id = S1AP_UE_CAPABILITY_IND_LOG;
|
||||
break;
|
||||
case S1AP_ProcedureCode_id_UEContextReleaseRequest:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
message_id = S1AP_UE_CONTEXT_RELEASE_REQ_LOG;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_ue_context_release_req_log.size = res.result.encoded;
|
||||
memcpy(&message_p->ittiMsg.s1ap_ue_context_release_req_log.text, res.buffer, res.result.encoded);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(res.buffer);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_initialUEMessage:
|
||||
ret = s1ap_eNB_encode_initial_ue_message(
|
||||
&s1ap_message_p->msg.s1ap_InitialUEMessageIEs, buffer, len);
|
||||
s1ap_xer_print_s1ap_initialuemessage(s1ap_xer__print2sp, message_string, s1ap_message_p);
|
||||
message_id = S1AP_INITIAL_UE_MESSAGE_LOG;
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_NASNonDeliveryIndication:
|
||||
ret = s1ap_eNB_encode_nas_non_delivery(
|
||||
&s1ap_message_p->msg.s1ap_NASNonDeliveryIndication_IEs, buffer, len);
|
||||
s1ap_xer_print_s1ap_nasnondeliveryindication_(s1ap_xer__print2sp,
|
||||
message_string, s1ap_message_p);
|
||||
message_id = S1AP_NAS_NON_DELIVERY_IND_LOG;
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_UEContextReleaseRequest:
|
||||
ret = s1ap_eNB_encode_ue_context_release_request(
|
||||
&s1ap_message_p->msg.s1ap_UEContextReleaseRequestIEs, buffer, len);
|
||||
s1ap_xer_print_s1ap_uecontextreleaserequest(s1ap_xer__print2sp,
|
||||
message_string, s1ap_message_p);
|
||||
message_id = S1AP_UE_CONTEXT_RELEASE_REQ_LOG;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
S1AP_DEBUG("Unknown procedure ID (%d) for initiating message\n",
|
||||
(int)s1ap_message_p->procedureCode);
|
||||
return ret;
|
||||
break;
|
||||
default:
|
||||
S1AP_DEBUG("Unknown procedure ID (%d) for initiating message\n",
|
||||
(int)pdu->choice.initiatingMessage.procedureCode);
|
||||
return -1;
|
||||
}
|
||||
|
||||
message_string_size = strlen(message_string);
|
||||
if (asn1_xer_print) {
|
||||
xer_fprint(stdout, &asn_DEF_S1AP_S1AP_PDU, (void *)pdu);
|
||||
}
|
||||
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, message_string_size + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_s1_setup_log.size = message_string_size;
|
||||
memcpy(&message_p->ittiMsg.s1ap_s1_setup_log.text, message_string, message_string_size);
|
||||
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
|
||||
free(message_string);
|
||||
|
||||
return ret;
|
||||
memset(&res, 0, sizeof(res));
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_ALIGNED_CANONICAL_PER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
*buffer = res.buffer;
|
||||
*len = res.result.encoded;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline
|
||||
int s1ap_eNB_encode_successfull_outcome(s1ap_message *s1ap_message_p,
|
||||
int s1ap_eNB_encode_successfull_outcome(S1AP_S1AP_PDU_t *pdu,
|
||||
uint8_t **buffer, uint32_t *len)
|
||||
{
|
||||
int ret = -1;
|
||||
MessageDef *message_p;
|
||||
char *message_string = NULL;
|
||||
size_t message_string_size;
|
||||
MessagesIds message_id;
|
||||
asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} };
|
||||
DevAssert(pdu != NULL);
|
||||
|
||||
DevAssert(s1ap_message_p != NULL);
|
||||
switch(pdu->choice.successfulOutcome.procedureCode) {
|
||||
case S1AP_ProcedureCode_id_InitialContextSetup:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
message_id = S1AP_INITIAL_CONTEXT_SETUP_LOG;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_initial_context_setup_log.size = res.result.encoded;
|
||||
memcpy(&message_p->ittiMsg.s1ap_initial_context_setup_log.text, res.buffer, res.result.encoded);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(res.buffer);
|
||||
break;
|
||||
|
||||
message_string = calloc(10000, sizeof(char));
|
||||
case S1AP_ProcedureCode_id_UEContextRelease:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
message_id = S1AP_UE_CONTEXT_RELEASE_COMPLETE_LOG;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_ue_context_release_complete_log.size = res.result.encoded;
|
||||
memcpy(&message_p->ittiMsg.s1ap_ue_context_release_complete_log.text, res.buffer, res.result.encoded);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(res.buffer);
|
||||
break;
|
||||
|
||||
s1ap_string_total_size = 0;
|
||||
message_string_size = strlen(message_string);
|
||||
case S1AP_ProcedureCode_id_E_RABSetup:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
message_id = S1AP_E_RAB_SETUP_RESPONSE_LOG;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_e_rab_setup_response_log.size = res.result.encoded;
|
||||
memcpy(&message_p->ittiMsg.s1ap_e_rab_setup_response_log.text, res.buffer, res.result.encoded);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(res.buffer);
|
||||
S1AP_INFO("E_RABSetup successful message\n");
|
||||
break;
|
||||
|
||||
case S1AP_ProcedureCode_id_E_RABModify:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
message_id = S1AP_E_RAB_MODIFY_RESPONSE_LOG;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_e_rab_modify_response_log.size = res.result.encoded;
|
||||
memcpy(&message_p->ittiMsg.s1ap_e_rab_modify_response_log.text, res.buffer, res.result.encoded);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(res.buffer);
|
||||
S1AP_INFO("E_RABModify successful message\n");
|
||||
break;
|
||||
|
||||
switch(s1ap_message_p->procedureCode) {
|
||||
case S1ap_ProcedureCode_id_InitialContextSetup:
|
||||
ret = s1ap_eNB_encode_initial_context_setup_response(
|
||||
&s1ap_message_p->msg.s1ap_InitialContextSetupResponseIEs, buffer, len);
|
||||
case S1AP_ProcedureCode_id_E_RABRelease:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
message_id = S1AP_E_RAB_RELEASE_RESPONSE_LOG;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_e_rab_release_response_log.size = res.result.encoded;
|
||||
memcpy(&message_p->ittiMsg.s1ap_e_rab_release_response_log.text, res.buffer, res.result.encoded);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(res.buffer);
|
||||
S1AP_INFO("E_RAB Release successful message\n");
|
||||
break;
|
||||
|
||||
s1ap_xer_print_s1ap_initialcontextsetupresponse(s1ap_xer__print2sp, message_string, s1ap_message_p);
|
||||
message_id = S1AP_INITIAL_CONTEXT_SETUP_LOG;
|
||||
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);
|
||||
free(message_string);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_UEContextRelease:
|
||||
ret = s1ap_eNB_encode_ue_context_release_complete(
|
||||
&s1ap_message_p->msg.s1ap_UEContextReleaseCompleteIEs, buffer, len);
|
||||
s1ap_xer_print_s1ap_uecontextreleasecomplete(s1ap_xer__print2sp, message_string, s1ap_message_p);
|
||||
message_id = S1AP_UE_CONTEXT_RELEASE_COMPLETE_LOG;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, message_string_size + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_ue_context_release_complete_log.size = message_string_size;
|
||||
memcpy(&message_p->ittiMsg.s1ap_ue_context_release_complete_log.text, message_string, message_string_size);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(message_string);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_E_RABSetup:
|
||||
|
||||
ret = s1ap_eNB_encode_e_rab_setup_response (
|
||||
&s1ap_message_p->msg.s1ap_E_RABSetupResponseIEs, buffer, len);
|
||||
//s1ap_xer_print_s1ap_e_rabsetupresponse (s1ap_xer__print2sp, message_string, s1ap_message_p);
|
||||
message_id = S1AP_E_RAB_SETUP_RESPONSE_LOG ;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, message_string_size + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_e_rab_setup_response_log.size = message_string_size;
|
||||
memcpy(&message_p->ittiMsg.s1ap_e_rab_setup_response_log.text, message_string, message_string_size);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(message_string);
|
||||
S1AP_INFO("E_RABSetup successful message\n");
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_E_RABModify:
|
||||
ret = s1ap_eNB_encode_e_rab_modify_response (
|
||||
&s1ap_message_p->msg.s1ap_E_RABModifyResponseIEs, buffer, len);
|
||||
message_id = S1AP_E_RAB_MODIFY_RESPONSE_LOG ;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, message_string_size + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_e_rab_modify_response_log.size = message_string_size;
|
||||
memcpy(&message_p->ittiMsg.s1ap_e_rab_modify_response_log.text, message_string, message_string_size);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(message_string);
|
||||
S1AP_INFO("E_RABModify successful message\n");
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_E_RABRelease:
|
||||
ret = s1ap_eNB_encode_e_rab_release_response (
|
||||
&s1ap_message_p->msg.s1ap_E_RABReleaseResponseIEs, buffer, len);
|
||||
s1ap_xer_print_s1ap_e_rabreleaseresponse(s1ap_xer__print2sp, message_string, s1ap_message_p);
|
||||
message_id = S1AP_E_RAB_RELEASE_RESPONSE_LOG ;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, message_string_size + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_e_rab_release_response_log.size = message_string_size;
|
||||
memcpy(&message_p->ittiMsg.s1ap_e_rab_release_response_log.text, message_string, message_string_size);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(message_string);
|
||||
S1AP_INFO("E_RAB Release successful message\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
S1AP_WARN("Unknown procedure ID (%d) for successfull outcome message\n",
|
||||
(int)s1ap_message_p->procedureCode);
|
||||
return ret;
|
||||
break;
|
||||
default:
|
||||
S1AP_WARN("Unknown procedure ID (%d) for successfull outcome message\n",
|
||||
(int)pdu->choice.successfulOutcome.procedureCode);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (asn1_xer_print) {
|
||||
xer_fprint(stdout, &asn_DEF_S1AP_S1AP_PDU, (void *)pdu);
|
||||
}
|
||||
|
||||
return ret;
|
||||
memset(&res, 0, sizeof(res));
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_ALIGNED_CANONICAL_PER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
*buffer = res.buffer;
|
||||
*len = res.result.encoded;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline
|
||||
int s1ap_eNB_encode_unsuccessfull_outcome(s1ap_message *s1ap_message_p,
|
||||
int s1ap_eNB_encode_unsuccessfull_outcome(S1AP_S1AP_PDU_t *pdu,
|
||||
uint8_t **buffer, uint32_t *len)
|
||||
{
|
||||
int ret = -1;
|
||||
MessageDef *message_p;
|
||||
char *message_string = NULL;
|
||||
size_t message_string_size;
|
||||
MessagesIds message_id;
|
||||
asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} };
|
||||
DevAssert(pdu != NULL);
|
||||
|
||||
DevAssert(s1ap_message_p != NULL);
|
||||
switch(pdu->choice.unsuccessfulOutcome.procedureCode) {
|
||||
case S1AP_ProcedureCode_id_InitialContextSetup:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
message_id = S1AP_INITIAL_CONTEXT_SETUP_LOG;
|
||||
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.s1ap_initial_context_setup_log.size = res.result.encoded;
|
||||
memcpy(&message_p->ittiMsg.s1ap_initial_context_setup_log.text, res.buffer, res.result.encoded);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(res.buffer);
|
||||
break;
|
||||
|
||||
message_string = calloc(10000, sizeof(char));
|
||||
|
||||
s1ap_string_total_size = 0;
|
||||
|
||||
switch(s1ap_message_p->procedureCode) {
|
||||
case S1ap_ProcedureCode_id_InitialContextSetup:
|
||||
// ret = s1ap_encode_s1ap_initialcontextsetupfailureies(
|
||||
// &s1ap_message_p->ittiMsg.s1ap_InitialContextSetupFailureIEs, buffer, len);
|
||||
s1ap_xer_print_s1ap_initialcontextsetupfailure(s1ap_xer__print2sp, message_string, s1ap_message_p);
|
||||
message_id = S1AP_INITIAL_CONTEXT_SETUP_LOG;
|
||||
break;
|
||||
|
||||
default:
|
||||
S1AP_DEBUG("Unknown procedure ID (%d) for unsuccessfull outcome message\n",
|
||||
(int)s1ap_message_p->procedureCode);
|
||||
return ret;
|
||||
break;
|
||||
default:
|
||||
S1AP_DEBUG("Unknown procedure ID (%d) for unsuccessfull outcome message\n",
|
||||
(int)pdu->choice.unsuccessfulOutcome.procedureCode);
|
||||
return -1;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
free(message_string);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline
|
||||
int s1ap_eNB_encode_ue_capability_info_indication(
|
||||
S1ap_UECapabilityInfoIndicationIEs_t *ueCapabilityInfoIndicationIEs,
|
||||
uint8_t **buffer,
|
||||
uint32_t *length)
|
||||
{
|
||||
S1ap_UECapabilityInfoIndication_t ueCapabilityInfoIndication;
|
||||
S1ap_UECapabilityInfoIndication_t *ueCapabilityInfoIndication_p =
|
||||
&ueCapabilityInfoIndication;
|
||||
|
||||
memset((void *)ueCapabilityInfoIndication_p, 0, sizeof(ueCapabilityInfoIndication));
|
||||
|
||||
if (s1ap_encode_s1ap_uecapabilityinfoindicationies(
|
||||
ueCapabilityInfoIndication_p, ueCapabilityInfoIndicationIEs) < 0) {
|
||||
return -1;
|
||||
if (asn1_xer_print) {
|
||||
xer_fprint(stdout, &asn_DEF_S1AP_S1AP_PDU, (void *)pdu);
|
||||
}
|
||||
|
||||
return s1ap_generate_initiating_message(buffer,
|
||||
length,
|
||||
S1ap_ProcedureCode_id_UECapabilityInfoIndication,
|
||||
S1ap_Criticality_ignore,
|
||||
&asn_DEF_S1ap_UECapabilityInfoIndication,
|
||||
ueCapabilityInfoIndication_p);
|
||||
}
|
||||
|
||||
static inline
|
||||
int s1ap_eNB_encode_uplink_nas_transport(
|
||||
S1ap_UplinkNASTransportIEs_t *uplinkNASTransportIEs,
|
||||
uint8_t **buffer,
|
||||
uint32_t *length)
|
||||
{
|
||||
S1ap_UplinkNASTransport_t uplinkNASTransport;
|
||||
S1ap_UplinkNASTransport_t *uplinkNASTransport_p = &uplinkNASTransport;
|
||||
|
||||
memset((void *)uplinkNASTransport_p, 0, sizeof(uplinkNASTransport));
|
||||
|
||||
if (s1ap_encode_s1ap_uplinknastransporties(
|
||||
uplinkNASTransport_p, uplinkNASTransportIEs) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return s1ap_generate_initiating_message(buffer,
|
||||
length,
|
||||
S1ap_ProcedureCode_id_uplinkNASTransport,
|
||||
S1ap_Criticality_ignore,
|
||||
&asn_DEF_S1ap_UplinkNASTransport,
|
||||
uplinkNASTransport_p);
|
||||
}
|
||||
|
||||
static inline
|
||||
int s1ap_eNB_encode_nas_non_delivery(
|
||||
S1ap_NASNonDeliveryIndication_IEs_t *nasNonDeliveryIndicationIEs,
|
||||
uint8_t **buffer,
|
||||
uint32_t *length)
|
||||
{
|
||||
S1ap_NASNonDeliveryIndication_t nasNonDeliveryIndication;
|
||||
S1ap_NASNonDeliveryIndication_t *nasNonDeliveryIndication_p = &nasNonDeliveryIndication;
|
||||
|
||||
memset((void *)nasNonDeliveryIndication_p, 0, sizeof(nasNonDeliveryIndication));
|
||||
|
||||
if (s1ap_encode_s1ap_nasnondeliveryindication_ies(
|
||||
nasNonDeliveryIndication_p, nasNonDeliveryIndicationIEs) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return s1ap_generate_initiating_message(buffer,
|
||||
length,
|
||||
S1ap_ProcedureCode_id_NASNonDeliveryIndication,
|
||||
S1ap_Criticality_ignore,
|
||||
&asn_DEF_S1ap_NASNonDeliveryIndication,
|
||||
nasNonDeliveryIndication_p);
|
||||
}
|
||||
|
||||
static inline
|
||||
int s1ap_eNB_encode_s1_setup_request(
|
||||
S1ap_S1SetupRequestIEs_t *s1SetupRequestIEs,
|
||||
uint8_t **buffer,
|
||||
uint32_t *length)
|
||||
{
|
||||
S1ap_S1SetupRequest_t s1SetupRequest;
|
||||
S1ap_S1SetupRequest_t *s1SetupRequest_p = &s1SetupRequest;
|
||||
|
||||
memset((void *)s1SetupRequest_p, 0, sizeof(s1SetupRequest));
|
||||
|
||||
if (s1ap_encode_s1ap_s1setuprequesties(s1SetupRequest_p, s1SetupRequestIEs) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return s1ap_generate_initiating_message(buffer,
|
||||
length,
|
||||
S1ap_ProcedureCode_id_S1Setup,
|
||||
S1ap_Criticality_reject,
|
||||
&asn_DEF_S1ap_S1SetupRequest,
|
||||
s1SetupRequest_p);
|
||||
}
|
||||
|
||||
static inline
|
||||
int s1ap_eNB_encode_initial_ue_message(
|
||||
S1ap_InitialUEMessageIEs_t *initialUEmessageIEs_p,
|
||||
uint8_t **buffer,
|
||||
uint32_t *length)
|
||||
{
|
||||
S1ap_InitialUEMessage_t initialUEMessage;
|
||||
S1ap_InitialUEMessage_t *initialUEMessage_p = &initialUEMessage;
|
||||
|
||||
memset((void *)initialUEMessage_p, 0, sizeof(initialUEMessage));
|
||||
|
||||
if (s1ap_encode_s1ap_initialuemessageies(
|
||||
initialUEMessage_p, initialUEmessageIEs_p) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return s1ap_generate_initiating_message(buffer,
|
||||
length,
|
||||
S1ap_ProcedureCode_id_initialUEMessage,
|
||||
S1ap_Criticality_ignore,
|
||||
&asn_DEF_S1ap_InitialUEMessage,
|
||||
initialUEMessage_p);
|
||||
}
|
||||
|
||||
static inline
|
||||
int s1ap_eNB_encode_trace_failure(
|
||||
S1ap_TraceFailureIndicationIEs_t *trace_failure_ies_p,
|
||||
uint8_t **buffer,
|
||||
uint32_t *length)
|
||||
{
|
||||
S1ap_TraceFailureIndication_t trace_failure;
|
||||
S1ap_TraceFailureIndication_t *trace_failure_p = &trace_failure;
|
||||
|
||||
memset((void *)trace_failure_p, 0, sizeof(trace_failure));
|
||||
|
||||
if (s1ap_encode_s1ap_tracefailureindicationies(
|
||||
trace_failure_p, trace_failure_ies_p) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return s1ap_generate_initiating_message(buffer,
|
||||
length,
|
||||
S1ap_ProcedureCode_id_TraceFailureIndication,
|
||||
S1ap_Criticality_reject,
|
||||
&asn_DEF_S1ap_TraceFailureIndication,
|
||||
trace_failure_p);
|
||||
}
|
||||
|
||||
static inline
|
||||
int s1ap_eNB_encode_initial_context_setup_response(
|
||||
S1ap_InitialContextSetupResponseIEs_t *initialContextSetupResponseIEs,
|
||||
uint8_t **buffer,
|
||||
uint32_t *length)
|
||||
{
|
||||
S1ap_InitialContextSetupResponse_t initial_context_setup_response;
|
||||
S1ap_InitialContextSetupResponse_t *initial_context_setup_response_p =
|
||||
&initial_context_setup_response;
|
||||
|
||||
memset((void *)initial_context_setup_response_p, 0,
|
||||
sizeof(initial_context_setup_response));
|
||||
|
||||
if (s1ap_encode_s1ap_initialcontextsetupresponseies(
|
||||
initial_context_setup_response_p, initialContextSetupResponseIEs) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return s1ap_generate_successfull_outcome(buffer,
|
||||
length,
|
||||
S1ap_ProcedureCode_id_InitialContextSetup,
|
||||
S1ap_Criticality_reject,
|
||||
&asn_DEF_S1ap_InitialContextSetupResponse,
|
||||
initial_context_setup_response_p);
|
||||
}
|
||||
|
||||
static inline
|
||||
int s1ap_eNB_encode_ue_context_release_complete(
|
||||
S1ap_UEContextReleaseCompleteIEs_t *s1ap_UEContextReleaseCompleteIEs,
|
||||
uint8_t **buffer,
|
||||
uint32_t *length)
|
||||
{
|
||||
S1ap_UEContextReleaseComplete_t ue_context_release_complete;
|
||||
S1ap_UEContextReleaseComplete_t *ue_context_release_complete_p =
|
||||
&ue_context_release_complete;
|
||||
|
||||
memset((void *)ue_context_release_complete_p, 0,
|
||||
sizeof(ue_context_release_complete));
|
||||
|
||||
if (s1ap_encode_s1ap_uecontextreleasecompleteies(
|
||||
ue_context_release_complete_p, s1ap_UEContextReleaseCompleteIEs) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return s1ap_generate_successfull_outcome(buffer,
|
||||
length,
|
||||
S1ap_ProcedureCode_id_UEContextRelease,
|
||||
S1ap_Criticality_reject,
|
||||
&asn_DEF_S1ap_UEContextReleaseComplete,
|
||||
ue_context_release_complete_p);
|
||||
}
|
||||
|
||||
static inline
|
||||
int s1ap_eNB_encode_ue_context_release_request(
|
||||
S1ap_UEContextReleaseRequestIEs_t *s1ap_UEContextReleaseRequestIEs,
|
||||
uint8_t **buffer,
|
||||
uint32_t *length)
|
||||
{
|
||||
S1ap_UEContextReleaseRequest_t ue_context_release_request;
|
||||
S1ap_UEContextReleaseRequest_t *ue_context_release_request_p =
|
||||
&ue_context_release_request;
|
||||
|
||||
memset((void *)ue_context_release_request_p, 0,
|
||||
sizeof(ue_context_release_request));
|
||||
|
||||
if (s1ap_encode_s1ap_uecontextreleaserequesties(
|
||||
ue_context_release_request_p, s1ap_UEContextReleaseRequestIEs) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return s1ap_generate_initiating_message(buffer,
|
||||
length,
|
||||
S1ap_ProcedureCode_id_UEContextReleaseRequest,
|
||||
S1ap_Criticality_reject,
|
||||
&asn_DEF_S1ap_UEContextReleaseRequest,
|
||||
ue_context_release_request_p);
|
||||
}
|
||||
|
||||
static inline
|
||||
int s1ap_eNB_encode_e_rab_setup_response(S1ap_E_RABSetupResponseIEs_t *s1ap_E_RABSetupResponseIEs,
|
||||
uint8_t **buffer,
|
||||
uint32_t *length)
|
||||
{
|
||||
S1ap_E_RABSetupResponse_t e_rab_setup_response;
|
||||
S1ap_E_RABSetupResponse_t *e_rab_setup_response_p = &e_rab_setup_response;
|
||||
|
||||
memset((void *)e_rab_setup_response_p, 0,
|
||||
sizeof(e_rab_setup_response));
|
||||
|
||||
if (s1ap_encode_s1ap_e_rabsetupresponseies (e_rab_setup_response_p, s1ap_E_RABSetupResponseIEs) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return s1ap_generate_successfull_outcome(buffer,
|
||||
length,
|
||||
S1ap_ProcedureCode_id_E_RABSetup,
|
||||
S1ap_Criticality_reject,
|
||||
&asn_DEF_S1ap_E_RABSetupResponse,
|
||||
e_rab_setup_response_p);
|
||||
}
|
||||
|
||||
static inline
|
||||
int s1ap_eNB_encode_e_rab_modify_response(S1ap_E_RABModifyResponseIEs_t *s1ap_E_RABModifyResponseIEs,
|
||||
uint8_t **buffer,
|
||||
uint32_t *length)
|
||||
{
|
||||
S1ap_E_RABModifyResponse_t e_rab_modify_response;
|
||||
S1ap_E_RABModifyResponse_t *e_rab_modify_response_p = &e_rab_modify_response;
|
||||
|
||||
memset((void *)e_rab_modify_response_p, 0,
|
||||
sizeof(e_rab_modify_response));
|
||||
|
||||
if (s1ap_encode_s1ap_e_rabmodifyresponseies (e_rab_modify_response_p, s1ap_E_RABModifyResponseIEs) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return s1ap_generate_successfull_outcome(buffer,
|
||||
length,
|
||||
S1ap_ProcedureCode_id_E_RABModify,
|
||||
S1ap_Criticality_reject,
|
||||
&asn_DEF_S1ap_E_RABModifyResponse,
|
||||
e_rab_modify_response_p);
|
||||
}
|
||||
static inline
|
||||
int s1ap_eNB_encode_e_rab_release_response(S1ap_E_RABReleaseResponseIEs_t *s1ap_E_RABReleaseResponseIEs,
|
||||
uint8_t **buffer,
|
||||
uint32_t *length)
|
||||
{
|
||||
S1ap_E_RABReleaseResponse_t e_rab_release_response;
|
||||
S1ap_E_RABReleaseResponse_t *e_rab_release_response_p = &e_rab_release_response;
|
||||
|
||||
memset((void *)e_rab_release_response_p, 0,
|
||||
sizeof(e_rab_release_response));
|
||||
|
||||
if (s1ap_encode_s1ap_e_rabreleaseresponseies (e_rab_release_response_p, s1ap_E_RABReleaseResponseIEs) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return s1ap_generate_successfull_outcome(buffer,
|
||||
length,
|
||||
S1ap_ProcedureCode_id_E_RABRelease,
|
||||
S1ap_Criticality_reject,
|
||||
&asn_DEF_S1ap_E_RABReleaseResponse,
|
||||
e_rab_release_response_p);
|
||||
memset(&res, 0, sizeof(res));
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_ALIGNED_CANONICAL_PER, &asn_DEF_S1AP_S1AP_PDU, pdu);
|
||||
*buffer = res.buffer;
|
||||
*len = res.result.encoded;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#ifndef S1AP_ENB_ENCODER_H_
|
||||
#define S1AP_ENB_ENCODER_H_
|
||||
|
||||
int s1ap_eNB_encode_pdu(s1ap_message *message, uint8_t **buffer, uint32_t *len)
|
||||
int s1ap_eNB_encode_pdu(S1AP_S1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *len)
|
||||
__attribute__ ((warn_unused_result));
|
||||
|
||||
#endif /* S1AP_ENB_ENCODER_H_ */
|
||||
|
||||
+678
-572
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -23,14 +23,14 @@
|
||||
#define S1AP_ENB_NAS_PROCEDURES_H_
|
||||
|
||||
int s1ap_eNB_handle_nas_downlink(
|
||||
const uint32_t assoc_id,
|
||||
const uint32_t stream,
|
||||
struct s1ap_message_s* message_p);
|
||||
uint32_t assoc_id,
|
||||
uint32_t stream,
|
||||
S1AP_S1AP_PDU_t *pdu);
|
||||
|
||||
int s1ap_eNB_nas_uplink(instance_t instance, s1ap_uplink_nas_t *s1ap_uplink_nas_p);
|
||||
|
||||
void s1ap_eNB_nas_non_delivery_ind(instance_t instance,
|
||||
s1ap_nas_non_delivery_ind_t *s1ap_nas_non_delivery_ind);
|
||||
int s1ap_eNB_nas_non_delivery_ind(instance_t instance,
|
||||
s1ap_nas_non_delivery_ind_t *s1ap_nas_non_delivery_ind);
|
||||
|
||||
int s1ap_eNB_handle_nas_first_req(
|
||||
instance_t instance, s1ap_nas_first_req_t *s1ap_nas_first_req_p);
|
||||
@@ -45,8 +45,8 @@ int s1ap_eNB_e_rab_setup_resp(instance_t instance,
|
||||
s1ap_e_rab_setup_resp_t *e_rab_setup_resp_p);
|
||||
|
||||
int s1ap_eNB_e_rab_modify_resp(instance_t instance,
|
||||
s1ap_e_rab_modify_resp_t *e_rab_modify_resp_p);
|
||||
s1ap_e_rab_modify_resp_t *e_rab_modify_resp_p);
|
||||
|
||||
int s1ap_eNB_e_rab_release_resp(instance_t instance,
|
||||
s1ap_e_rab_release_resp_t *e_rab_release_resp_p);
|
||||
s1ap_e_rab_release_resp_t *e_rab_release_resp_p);
|
||||
#endif /* S1AP_ENB_NAS_PROCEDURES_H_ */
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#include "intertask_interface.h"
|
||||
|
||||
#include "s1ap_common.h"
|
||||
#include "s1ap_ies_defs.h"
|
||||
#include "s1ap_eNB_defs.h"
|
||||
|
||||
#include "s1ap_eNB.h"
|
||||
@@ -44,21 +43,20 @@
|
||||
|
||||
#include "assertions.h"
|
||||
|
||||
int s1ap_eNB_handle_overload_start(uint32_t assoc_id,
|
||||
uint32_t stream,
|
||||
struct s1ap_message_s *message_p)
|
||||
int s1ap_eNB_handle_overload_start(uint32_t assoc_id,
|
||||
uint32_t stream,
|
||||
S1AP_S1AP_PDU_t *pdu)
|
||||
{
|
||||
S1ap_OverloadStartIEs_t *overload_start_p;
|
||||
s1ap_eNB_mme_data_t *mme_desc_p;
|
||||
|
||||
DevAssert(message_p != NULL);
|
||||
|
||||
overload_start_p = &message_p->msg.s1ap_OverloadStartIEs;
|
||||
|
||||
DevCheck(overload_start_p->overloadResponse.present ==
|
||||
S1ap_OverloadResponse_PR_overloadAction,
|
||||
S1ap_OverloadResponse_PR_overloadAction, 0, 0);
|
||||
|
||||
S1AP_OverloadStart_t *container;
|
||||
S1AP_OverloadStartIEs_t *ie;
|
||||
DevAssert(pdu != NULL);
|
||||
container = &pdu->choice.initiatingMessage.value.choice.OverloadStart;
|
||||
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_OverloadStartIEs_t, ie, container,
|
||||
S1AP_ProtocolIE_ID_id_OverloadResponse, TRUE);
|
||||
DevCheck(ie->value.choice.OverloadResponse.present ==
|
||||
S1AP_OverloadResponse_PR_overloadAction,
|
||||
S1AP_OverloadResponse_PR_overloadAction, 0, 0);
|
||||
/* Non UE-associated signalling -> stream 0 */
|
||||
DevCheck(stream == 0, stream, 0, 0);
|
||||
|
||||
@@ -72,24 +70,20 @@ int s1ap_eNB_handle_overload_start(uint32_t assoc_id,
|
||||
*/
|
||||
mme_desc_p->state = S1AP_ENB_OVERLOAD;
|
||||
mme_desc_p->overload_state =
|
||||
overload_start_p->overloadResponse.choice.overloadAction;
|
||||
|
||||
ie->value.choice.OverloadResponse.choice.overloadAction;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int s1ap_eNB_handle_overload_stop(uint32_t assoc_id,
|
||||
uint32_t stream,
|
||||
struct s1ap_message_s *message_p)
|
||||
int s1ap_eNB_handle_overload_stop(uint32_t assoc_id,
|
||||
uint32_t stream,
|
||||
S1AP_S1AP_PDU_t *pdu)
|
||||
{
|
||||
/* We received Overload stop message, meaning that the MME is no more
|
||||
* overloaded. This is an empty message, with only message header and no
|
||||
* Information Element.
|
||||
*/
|
||||
|
||||
DevAssert(message_p != NULL);
|
||||
|
||||
DevAssert(pdu != NULL);
|
||||
s1ap_eNB_mme_data_t *mme_desc_p;
|
||||
|
||||
/* Non UE-associated signalling -> stream 0 */
|
||||
DevCheck(stream == 0, stream, 0, 0);
|
||||
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
// int s1ap_eNB_handle_overload_start(eNB_mme_desc_t *eNB_desc_p,
|
||||
// sctp_queue_item_t *packet_p,
|
||||
// struct s1ap_message_s *message_p);
|
||||
int s1ap_eNB_handle_overload_start(uint32_t assoc_id,
|
||||
uint32_t stream,
|
||||
struct s1ap_message_s *message_p);
|
||||
int s1ap_eNB_handle_overload_start(uint32_t assoc_id,
|
||||
uint32_t stream,
|
||||
S1AP_S1AP_PDU_t *pdu);
|
||||
|
||||
/**
|
||||
* \brief Handle an overload stop message
|
||||
@@ -38,8 +38,8 @@ int s1ap_eNB_handle_overload_start(uint32_t assoc_id,
|
||||
// int s1ap_eNB_handle_overload_stop(eNB_mme_desc_t *eNB_desc_p,
|
||||
// sctp_queue_item_t *packet_p,
|
||||
// struct s1ap_message_s *message_p);
|
||||
int s1ap_eNB_handle_overload_stop(uint32_t assoc_id,
|
||||
uint32_t stream,
|
||||
struct s1ap_message_s *message_p);
|
||||
int s1ap_eNB_handle_overload_stop(uint32_t assoc_id,
|
||||
uint32_t stream,
|
||||
S1AP_S1AP_PDU_t *pdu);
|
||||
|
||||
#endif /* S1AP_ENB_OVERLOAD_H_ */
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include "s1ap_eNB_default_values.h"
|
||||
|
||||
#include "s1ap_common.h"
|
||||
#include "s1ap_ies_defs.h"
|
||||
#include "s1ap_eNB_defs.h"
|
||||
|
||||
#include "s1ap_eNB.h"
|
||||
@@ -40,29 +39,50 @@
|
||||
|
||||
static
|
||||
void s1ap_eNB_generate_trace_failure(struct s1ap_eNB_ue_context_s *ue_desc_p,
|
||||
S1ap_E_UTRAN_Trace_ID_t *trace_id,
|
||||
S1ap_Cause_t *cause_p)
|
||||
S1AP_E_UTRAN_Trace_ID_t *trace_id,
|
||||
S1AP_Cause_t *cause_p)
|
||||
{
|
||||
s1ap_message message;
|
||||
S1ap_TraceFailureIndicationIEs_t *trace_failure_p;
|
||||
uint8_t *buffer;
|
||||
uint32_t length;
|
||||
|
||||
S1AP_S1AP_PDU_t pdu;
|
||||
S1AP_TraceFailureIndication_t *out;
|
||||
S1AP_TraceFailureIndicationIEs_t *ie;
|
||||
uint8_t *buffer = NULL;
|
||||
uint32_t length;
|
||||
DevAssert(ue_desc_p != NULL);
|
||||
DevAssert(trace_id != NULL);
|
||||
DevAssert(cause_p != NULL);
|
||||
/* Prepare the S1AP message to encode */
|
||||
memset(&pdu, 0, sizeof(pdu));
|
||||
pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage;
|
||||
pdu.choice.initiatingMessage.procedureCode = S1AP_ProcedureCode_id_TraceFailureIndication;
|
||||
pdu.choice.initiatingMessage.criticality = S1AP_Criticality_ignore;
|
||||
pdu.choice.initiatingMessage.value.present = S1AP_InitiatingMessage__value_PR_TraceFailureIndication;
|
||||
out = &pdu.choice.initiatingMessage.value.choice.TraceFailureIndication;
|
||||
ie = (S1AP_TraceFailureIndicationIEs_t *)calloc(1, sizeof(S1AP_TraceFailureIndicationIEs_t));
|
||||
ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID;
|
||||
ie->criticality = S1AP_Criticality_reject;
|
||||
ie->value.present = S1AP_TraceFailureIndicationIEs__value_PR_MME_UE_S1AP_ID;
|
||||
ie->value.choice.MME_UE_S1AP_ID = ue_desc_p->mme_ue_s1ap_id;
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
ie = (S1AP_TraceFailureIndicationIEs_t *)calloc(1, sizeof(S1AP_TraceFailureIndicationIEs_t));
|
||||
ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID;
|
||||
ie->criticality = S1AP_Criticality_reject;
|
||||
ie->value.present = S1AP_TraceFailureIndicationIEs__value_PR_ENB_UE_S1AP_ID;
|
||||
ie->value.choice.ENB_UE_S1AP_ID = ue_desc_p->eNB_ue_s1ap_id;
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
ie = (S1AP_TraceFailureIndicationIEs_t *)calloc(1, sizeof(S1AP_TraceFailureIndicationIEs_t));
|
||||
ie->id = S1AP_ProtocolIE_ID_id_E_UTRAN_Trace_ID;
|
||||
ie->criticality = S1AP_Criticality_ignore;
|
||||
ie->value.present = S1AP_TraceFailureIndicationIEs__value_PR_E_UTRAN_Trace_ID;
|
||||
memcpy(&ie->value.choice.E_UTRAN_Trace_ID, trace_id, sizeof(S1AP_E_UTRAN_Trace_ID_t));
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
ie = (S1AP_TraceFailureIndicationIEs_t *)calloc(1, sizeof(S1AP_TraceFailureIndicationIEs_t));
|
||||
ie->id = S1AP_ProtocolIE_ID_id_Cause;
|
||||
ie->criticality = S1AP_Criticality_ignore;
|
||||
ie->value.present = S1AP_TraceFailureIndicationIEs__value_PR_Cause;
|
||||
memcpy(&ie->value.choice.Cause, cause_p, sizeof(S1AP_Cause_t));
|
||||
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
|
||||
|
||||
memset(&message, 0, sizeof(s1ap_message));
|
||||
|
||||
trace_failure_p = &message.msg.s1ap_TraceFailureIndicationIEs;
|
||||
|
||||
trace_failure_p->mme_ue_s1ap_id = ue_desc_p->mme_ue_s1ap_id;
|
||||
trace_failure_p->eNB_UE_S1AP_ID = ue_desc_p->eNB_ue_s1ap_id;
|
||||
|
||||
memcpy(&trace_failure_p->e_UTRAN_Trace_ID, trace_id, sizeof(S1ap_E_UTRAN_Trace_ID_t));
|
||||
memcpy(&trace_failure_p->cause, cause_p, sizeof(S1ap_Cause_t));
|
||||
|
||||
if (s1ap_eNB_encode_pdu(&message, &buffer, &length) < 0) {
|
||||
if (s1ap_eNB_encode_pdu(&pdu, &buffer, &length) < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -71,48 +91,44 @@ void s1ap_eNB_generate_trace_failure(struct s1ap_eNB_ue_context_s *ue_desc_p,
|
||||
length, ue_desc_p->tx_stream);
|
||||
}
|
||||
|
||||
int s1ap_eNB_handle_trace_start(uint32_t assoc_id,
|
||||
uint32_t stream,
|
||||
struct s1ap_message_s *message_p)
|
||||
int s1ap_eNB_handle_trace_start(uint32_t assoc_id,
|
||||
uint32_t stream,
|
||||
S1AP_S1AP_PDU_t *pdu)
|
||||
{
|
||||
S1ap_TraceStartIEs_t *trace_start_p;
|
||||
S1AP_TraceStart_t *container;
|
||||
S1AP_TraceStartIEs_t *ie;
|
||||
struct s1ap_eNB_ue_context_s *ue_desc_p;
|
||||
struct s1ap_eNB_mme_data_s *mme_ref_p;
|
||||
|
||||
DevAssert(message_p != NULL);
|
||||
|
||||
trace_start_p = &message_p->msg.s1ap_TraceStartIEs;
|
||||
|
||||
DevAssert(pdu != NULL);
|
||||
container = &pdu->choice.initiatingMessage.value.choice.TraceStart;
|
||||
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_TraceStartIEs_t, ie, container,
|
||||
S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID, TRUE);
|
||||
mme_ref_p = s1ap_eNB_get_MME(NULL, assoc_id, 0);
|
||||
DevAssert(mme_ref_p != NULL);
|
||||
|
||||
if ((ue_desc_p = s1ap_eNB_get_ue_context(mme_ref_p->s1ap_eNB_instance,
|
||||
trace_start_p->eNB_UE_S1AP_ID)) == NULL) {
|
||||
ie->value.choice.ENB_UE_S1AP_ID)) == NULL) {
|
||||
/* Could not find context associated with this eNB_ue_s1ap_id -> generate
|
||||
* trace failure indication.
|
||||
*/
|
||||
S1ap_E_UTRAN_Trace_ID_t trace_id;
|
||||
S1ap_Cause_t cause;
|
||||
|
||||
memset(&trace_id, 0, sizeof(S1ap_E_UTRAN_Trace_ID_t));
|
||||
memset(&cause, 0, sizeof(S1ap_Cause_t));
|
||||
|
||||
cause.present = S1ap_Cause_PR_radioNetwork;
|
||||
cause.choice.radioNetwork = S1ap_CauseRadioNetwork_unknown_pair_ue_s1ap_id;
|
||||
|
||||
S1AP_E_UTRAN_Trace_ID_t trace_id;
|
||||
S1AP_Cause_t cause;
|
||||
memset(&trace_id, 0, sizeof(S1AP_E_UTRAN_Trace_ID_t));
|
||||
memset(&cause, 0, sizeof(S1AP_Cause_t));
|
||||
cause.present = S1AP_Cause_PR_radioNetwork;
|
||||
cause.choice.radioNetwork = S1AP_CauseRadioNetwork_unknown_pair_ue_s1ap_id;
|
||||
s1ap_eNB_generate_trace_failure(ue_desc_p, &trace_id, &cause);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int s1ap_eNB_handle_deactivate_trace(uint32_t assoc_id,
|
||||
uint32_t stream,
|
||||
struct s1ap_message_s *message_p)
|
||||
int s1ap_eNB_handle_deactivate_trace(uint32_t assoc_id,
|
||||
uint32_t stream,
|
||||
S1AP_S1AP_PDU_t *message_p)
|
||||
{
|
||||
// S1ap_DeactivateTraceIEs_t *deactivate_trace_p;
|
||||
// S1AP_DeactivateTraceIEs_t *deactivate_trace_p;
|
||||
//
|
||||
// deactivate_trace_p = &message_p->msg.deactivateTraceIEs;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -32,15 +32,15 @@
|
||||
// int s1ap_eNB_handle_trace_start(eNB_mme_desc_t *eNB_desc_p,
|
||||
// sctp_queue_item_t *packet_p,
|
||||
// struct s1ap_message_s *message_p);
|
||||
int s1ap_eNB_handle_trace_start(uint32_t assoc_id,
|
||||
uint32_t stream,
|
||||
struct s1ap_message_s *message_p);
|
||||
int s1ap_eNB_handle_trace_start(uint32_t assoc_id,
|
||||
uint32_t stream,
|
||||
S1AP_S1AP_PDU_t *pdu);
|
||||
|
||||
// int s1ap_eNB_handle_deactivate_trace(eNB_mme_desc_t *eNB_desc_p,
|
||||
// sctp_queue_item_t *packet_p,
|
||||
// struct s1ap_message_s *message_p);
|
||||
int s1ap_eNB_handle_deactivate_trace(uint32_t assoc_id,
|
||||
uint32_t stream,
|
||||
struct s1ap_message_s *message_p);
|
||||
int s1ap_eNB_handle_deactivate_trace(uint32_t assoc_id,
|
||||
uint32_t stream,
|
||||
S1AP_S1AP_PDU_t *pdu);
|
||||
|
||||
#endif /* S1AP_ENB_TRACE_H_ */
|
||||
|
||||
@@ -252,12 +252,11 @@ typedef enum {
|
||||
|
||||
typedef struct et_s1ap_s {
|
||||
//et_s1ap_pdu_type_t pdu_type;
|
||||
S1AP_PDU_t pdu; // decoded ASN1 C type: choice of initiatingMessage, successfulOutcome, unsuccessfulOutcome
|
||||
S1AP_S1AP_PDU_t pdu; // decoded ASN1 C type: choice of initiatingMessage, successfulOutcome, unsuccessfulOutcome
|
||||
uint16_t xml_stream_pos_offset;
|
||||
uint16_t binary_stream_pos;
|
||||
uint16_t binary_stream_allocated_size;
|
||||
uint8_t *binary_stream;
|
||||
s1ap_message message; // decoded message: information elements
|
||||
xmlDocPtr doc; // XML representation of the S1AP PDU
|
||||
} et_s1ap_t;
|
||||
|
||||
@@ -300,9 +299,9 @@ typedef struct et_ip_s {
|
||||
union {
|
||||
struct in6_addr ipv6;
|
||||
in_addr_t ipv4;
|
||||
}address;
|
||||
} address;
|
||||
char str[INET6_ADDRSTRLEN+1];
|
||||
}et_ip_t;
|
||||
} et_ip_t;
|
||||
|
||||
typedef struct et_ip_hdr_s {
|
||||
et_ip_t src;
|
||||
@@ -325,7 +324,7 @@ typedef struct et_packet_s {
|
||||
et_packet_status_t status;
|
||||
long timer_id; // ITTI timer id for waiting rx packets
|
||||
struct timeval timestamp_packet; // timestamp when rx or tx packet
|
||||
}et_packet_t;
|
||||
} et_packet_t;
|
||||
|
||||
|
||||
typedef struct sctp_epoll_s {
|
||||
@@ -401,23 +400,23 @@ typedef struct et_event_s {
|
||||
inline void et_free_pointer(void *p) {if (NULL != p) {free(p); p=NULL;}};
|
||||
|
||||
//-------------------------
|
||||
void et_free_packet(et_packet_t* packet);
|
||||
void et_free_scenario(et_scenario_t* scenario);
|
||||
void et_free_packet(et_packet_t *packet);
|
||||
void et_free_scenario(et_scenario_t *scenario);
|
||||
//-------------------------
|
||||
void et_display_packet_s1ap_data(const et_s1ap_t * const s1ap);
|
||||
void et_display_packet_sctp_init(const sctp_inithdr_t * const sctp);
|
||||
void et_display_packet_sctp_initack(const sctp_initackhdr_t * const sctp);
|
||||
void et_display_packet_sctp_data(const sctp_datahdr_t * const sctp);
|
||||
void et_display_packet_sctp(const et_sctp_hdr_t * const sctp);
|
||||
void et_display_packet_ip(const et_ip_hdr_t * const ip);
|
||||
void et_display_packet(const et_packet_t * const packet);
|
||||
void et_display_scenario(const et_scenario_t * const scenario);
|
||||
void et_display_packet_s1ap_data(const et_s1ap_t *const s1ap);
|
||||
void et_display_packet_sctp_init(const sctp_inithdr_t *const sctp);
|
||||
void et_display_packet_sctp_initack(const sctp_initackhdr_t *const sctp);
|
||||
void et_display_packet_sctp_data(const sctp_datahdr_t *const sctp);
|
||||
void et_display_packet_sctp(const et_sctp_hdr_t *const sctp);
|
||||
void et_display_packet_ip(const et_ip_hdr_t *const ip);
|
||||
void et_display_packet(const et_packet_t *const packet);
|
||||
void et_display_scenario(const et_scenario_t *const scenario);
|
||||
//-------------------------
|
||||
int et_s1ap_decode_initiating_message(s1ap_message *message, S1ap_InitiatingMessage_t *initiating_p);
|
||||
int et_s1ap_decode_successful_outcome(s1ap_message *message, S1ap_SuccessfulOutcome_t *successfullOutcome_p);
|
||||
int et_s1ap_decode_unsuccessful_outcome(s1ap_message *message, S1ap_UnsuccessfulOutcome_t *unSuccessfullOutcome_p);
|
||||
int et_s1ap_decode_pdu(S1AP_PDU_t * const pdu, s1ap_message * const message, const uint8_t * const buffer, const uint32_t length);
|
||||
void et_decode_s1ap(et_s1ap_t * const s1ap);
|
||||
int et_s1ap_decode_initiating_message(s1ap_message *message, S1AP_InitiatingMessage_t *initiating_p);
|
||||
int et_s1ap_decode_successful_outcome(s1ap_message *message, S1AP_SuccessfulOutcome_t *successfullOutcome_p);
|
||||
int et_s1ap_decode_unsuccessful_outcome(s1ap_message *message, S1AP_UnsuccessfulOutcome_t *unSuccessfullOutcome_p);
|
||||
int et_s1ap_decode_pdu(S1AP_PDU_t *const pdu, s1ap_message *const message, const uint8_t *const buffer, const uint32_t length);
|
||||
void et_decode_s1ap(et_s1ap_t *const s1ap);
|
||||
//-------------------------
|
||||
int et_s1ap_eNB_compare_assoc_id( struct s1ap_eNB_mme_data_s *p1, struct s1ap_eNB_mme_data_s *p2);
|
||||
uint32_t et_s1ap_generate_eNB_id(void);
|
||||
@@ -427,32 +426,32 @@ void et_s1ap_eNB_insert_new_instance(s1ap_eNB_instance_t *new_instance_p);
|
||||
struct s1ap_eNB_mme_data_s *et_s1ap_eNB_get_MME(s1ap_eNB_instance_t *instance_p,int32_t assoc_id, uint16_t cnx_id);
|
||||
s1ap_eNB_instance_t *et_s1ap_eNB_get_instance(instance_t instance);
|
||||
void et_s1ap_eNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer,uint32_t buffer_length, uint16_t stream);
|
||||
int et_handle_s1ap_mismatch_mme_ue_s1ap_id(et_packet_t * const spacket, et_packet_t * const rx_packet);
|
||||
asn_comp_rval_t* et_s1ap_is_matching(et_s1ap_t * const s1ap1, et_s1ap_t * const s1ap2, const uint32_t constraints);
|
||||
et_packet_t* et_build_packet_from_s1ap_data_ind(et_event_s1ap_data_ind_t * const s1ap_data_ind);
|
||||
int et_scenario_set_packet_received(et_packet_t * const packet);
|
||||
int et_s1ap_process_rx_packet(et_event_s1ap_data_ind_t * const sctp_data_ind);
|
||||
void et_s1ap_eNB_handle_sctp_data_ind(sctp_data_ind_t * const sctp_data_ind);
|
||||
int et_handle_s1ap_mismatch_mme_ue_s1ap_id(et_packet_t *const spacket, et_packet_t *const rx_packet);
|
||||
asn_comp_rval_t *et_s1ap_is_matching(et_s1ap_t *const s1ap1, et_s1ap_t *const s1ap2, const uint32_t constraints);
|
||||
et_packet_t *et_build_packet_from_s1ap_data_ind(et_event_s1ap_data_ind_t *const s1ap_data_ind);
|
||||
int et_scenario_set_packet_received(et_packet_t *const packet);
|
||||
int et_s1ap_process_rx_packet(et_event_s1ap_data_ind_t *const sctp_data_ind);
|
||||
void et_s1ap_eNB_handle_sctp_data_ind(sctp_data_ind_t *const sctp_data_ind);
|
||||
void et_s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p,
|
||||
net_ip_address_t *mme_ip_address,
|
||||
net_ip_address_t *local_ip_addr,
|
||||
uint16_t in_streams,
|
||||
uint16_t out_streams);
|
||||
net_ip_address_t *mme_ip_address,
|
||||
net_ip_address_t *local_ip_addr,
|
||||
uint16_t in_streams,
|
||||
uint16_t out_streams);
|
||||
void et_s1ap_handle_s1_setup_message(s1ap_eNB_mme_data_t *mme_desc_p, int sctp_shutdown);
|
||||
void et_s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *s1ap_register_eNB);
|
||||
void et_s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp);
|
||||
void * et_s1ap_eNB_task(void *arg);
|
||||
void *et_s1ap_eNB_task(void *arg);
|
||||
//-------------------------
|
||||
int et_generate_xml_scenario(
|
||||
const char const * xml_in_dir_name,
|
||||
const char const * xml_in_scenario_filename,
|
||||
const char const * enb_config_filename,
|
||||
char const * tsml_out_scenario_filename);
|
||||
const char const *xml_in_dir_name,
|
||||
const char const *xml_in_scenario_filename,
|
||||
const char const *enb_config_filename,
|
||||
char const *tsml_out_scenario_filename);
|
||||
//-------------------------
|
||||
void timeval_add (struct timeval * const result, const struct timeval * const a, const struct timeval * const b);
|
||||
int timeval_subtract (struct timeval * const result, struct timeval * const a, struct timeval * const b);
|
||||
void et_scenario_wait_rx_packet(et_packet_t * const packet);
|
||||
void et_scenario_schedule_tx_packet(et_packet_t * packet);
|
||||
void timeval_add (struct timeval *const result, const struct timeval *const a, const struct timeval *const b);
|
||||
int timeval_subtract (struct timeval *const result, struct timeval *const a, struct timeval *const b);
|
||||
void et_scenario_wait_rx_packet(et_packet_t *const packet);
|
||||
void et_scenario_schedule_tx_packet(et_packet_t *packet);
|
||||
et_fsm_state_t et_scenario_fsm_notify_event_state_running(et_event_t event);
|
||||
et_fsm_state_t et_scenario_fsm_notify_event_state_waiting_tx(et_event_t event);
|
||||
et_fsm_state_t et_scenario_fsm_notify_event_state_waiting_rx(et_event_t event);
|
||||
@@ -460,41 +459,41 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_connecting_s1c(et_event_t even
|
||||
et_fsm_state_t et_scenario_fsm_notify_event_state_null(et_event_t event);
|
||||
et_fsm_state_t et_scenario_fsm_notify_event(et_event_t event);
|
||||
//-------------------------
|
||||
void et_parse_s1ap(xmlDocPtr doc, const xmlNode const *s1ap_node, et_s1ap_t * const s1ap);
|
||||
void et_parse_sctp_data_chunk(xmlDocPtr doc, const xmlNode const *sctp_node, sctp_datahdr_t * const sctp_hdr);
|
||||
void et_parse_sctp_init_chunk(xmlDocPtr doc, const xmlNode const *sctp_node, sctp_inithdr_t * const sctp_hdr);
|
||||
void et_parse_sctp_init_ack_chunk(xmlDocPtr doc, const xmlNode const *sctp_node, sctp_initackhdr_t * const sctp_hdr);
|
||||
void et_parse_sctp(xmlDocPtr doc, const xmlNode const *sctp_node, et_sctp_hdr_t * const sctp_hdr);
|
||||
et_packet_t* et_parse_xml_packet(xmlDocPtr doc, xmlNodePtr node);
|
||||
et_scenario_t* et_generate_scenario(const char * const et_scenario_filename);
|
||||
void et_parse_s1ap(xmlDocPtr doc, const xmlNode const *s1ap_node, et_s1ap_t *const s1ap);
|
||||
void et_parse_sctp_data_chunk(xmlDocPtr doc, const xmlNode const *sctp_node, sctp_datahdr_t *const sctp_hdr);
|
||||
void et_parse_sctp_init_chunk(xmlDocPtr doc, const xmlNode const *sctp_node, sctp_inithdr_t *const sctp_hdr);
|
||||
void et_parse_sctp_init_ack_chunk(xmlDocPtr doc, const xmlNode const *sctp_node, sctp_initackhdr_t *const sctp_hdr);
|
||||
void et_parse_sctp(xmlDocPtr doc, const xmlNode const *sctp_node, et_sctp_hdr_t *const sctp_hdr);
|
||||
et_packet_t *et_parse_xml_packet(xmlDocPtr doc, xmlNodePtr node);
|
||||
et_scenario_t *et_generate_scenario(const char *const et_scenario_filename);
|
||||
//-------------------------
|
||||
asn_comp_rval_t * et_s1ap_ies_is_matching(const S1AP_PDU_PR present, s1ap_message * const m1, s1ap_message * const m2, const uint32_t constraints);
|
||||
void update_xpath_node_mme_ue_s1ap_id(et_s1ap_t * const s1ap, xmlNode *node, const S1ap_MME_UE_S1AP_ID_t new_id);
|
||||
void update_xpath_nodes_mme_ue_s1ap_id(et_s1ap_t * const s1ap_payload, xmlNodeSetPtr nodes, const S1ap_MME_UE_S1AP_ID_t new_id);
|
||||
int et_s1ap_update_mme_ue_s1ap_id(et_packet_t * const packet, const S1ap_MME_UE_S1AP_ID_t old_id, const S1ap_MME_UE_S1AP_ID_t new_id);
|
||||
asn_comp_rval_t *et_s1ap_ies_is_matching(const S1AP_PDU_PR present, s1ap_message *const m1, s1ap_message *const m2, const uint32_t constraints);
|
||||
void update_xpath_node_mme_ue_s1ap_id(et_s1ap_t *const s1ap, xmlNode *node, const S1AP_MME_UE_S1AP_ID_t new_id);
|
||||
void update_xpath_nodes_mme_ue_s1ap_id(et_s1ap_t *const s1ap_payload, xmlNodeSetPtr nodes, const S1AP_MME_UE_S1AP_ID_t new_id);
|
||||
int et_s1ap_update_mme_ue_s1ap_id(et_packet_t *const packet, const S1AP_MME_UE_S1AP_ID_t old_id, const S1AP_MME_UE_S1AP_ID_t new_id);
|
||||
//-------------------------
|
||||
asn_comp_rval_t * et_sctp_data_is_matching(sctp_datahdr_t * const sctp1, sctp_datahdr_t * const sctp2, const uint32_t constraints);
|
||||
asn_comp_rval_t * et_sctp_is_matching(et_sctp_hdr_t * const sctp1, et_sctp_hdr_t * const sctp2, const uint32_t constraints);
|
||||
asn_comp_rval_t *et_sctp_data_is_matching(sctp_datahdr_t *const sctp1, sctp_datahdr_t *const sctp2, const uint32_t constraints);
|
||||
asn_comp_rval_t *et_sctp_is_matching(et_sctp_hdr_t *const sctp1, et_sctp_hdr_t *const sctp2, const uint32_t constraints);
|
||||
//------------------------------------------------------------------------------
|
||||
void et_print_hex_octets(const unsigned char * const byte_stream, const unsigned long int num);
|
||||
int et_is_file_exists ( const char const * file_nameP, const char const *file_roleP);
|
||||
void et_print_hex_octets(const unsigned char *const byte_stream, const unsigned long int num);
|
||||
int et_is_file_exists ( const char const *file_nameP, const char const *file_roleP);
|
||||
int et_strip_extension( char *in_filename);
|
||||
void et_get_shift_arg( char * line_argument, shift_packet_t * const shift);
|
||||
int et_split_path ( char * pathP, char *** resP);
|
||||
void et_get_shift_arg( char *line_argument, shift_packet_t *const shift);
|
||||
int et_split_path ( char *pathP, char *** resP);
|
||||
void et_display_node ( xmlNodePtr node, unsigned int indent);
|
||||
void et_display_tree ( xmlNodePtr node, unsigned int indent);
|
||||
char * et_ip2ip_str(const et_ip_t * const ip);
|
||||
int et_compare_et_ip_to_net_ip_address(const et_ip_t * const ip, const net_ip_address_t * const net_ip);
|
||||
int et_hex2data(unsigned char * const data, const unsigned char * const hexstring, const unsigned int len);
|
||||
sctp_cid_t et_chunk_type_str2cid(const xmlChar * const chunk_type_str);
|
||||
const char * const et_chunk_type_cid2str(const sctp_cid_t chunk_type);
|
||||
const char * const et_error_match2str(const int err);
|
||||
et_packet_action_t et_action_str2et_action_t(const xmlChar * const action);
|
||||
void et_ip_str2et_ip(const xmlChar * const ip_str, et_ip_t * const ip);
|
||||
void et_enb_config_init(const char const * lib_config_file_name_pP);
|
||||
char *et_ip2ip_str(const et_ip_t *const ip);
|
||||
int et_compare_et_ip_to_net_ip_address(const et_ip_t *const ip, const net_ip_address_t *const net_ip);
|
||||
int et_hex2data(unsigned char *const data, const unsigned char *const hexstring, const unsigned int len);
|
||||
sctp_cid_t et_chunk_type_str2cid(const xmlChar *const chunk_type_str);
|
||||
const char *const et_chunk_type_cid2str(const sctp_cid_t chunk_type);
|
||||
const char *const et_error_match2str(const int err);
|
||||
et_packet_action_t et_action_str2et_action_t(const xmlChar *const action);
|
||||
void et_ip_str2et_ip(const xmlChar *const ip_str, et_ip_t *const ip);
|
||||
void et_enb_config_init(const char const *lib_config_file_name_pP);
|
||||
const Enb_properties_array_t *et_enb_config_get(void);
|
||||
void et_eNB_app_register(const Enb_properties_array_t *enb_properties);
|
||||
void *et_eNB_app_task(void *args_p);
|
||||
int et_play_scenario(et_scenario_t* const scenario, const struct shift_packet_s *shifts);
|
||||
int et_play_scenario(et_scenario_t *const scenario, const struct shift_packet_s *shifts);
|
||||
|
||||
#endif /* PLAY_SCENARIO_H_ */
|
||||
|
||||
@@ -29,140 +29,18 @@
|
||||
|
||||
#include "intertask_interface.h"
|
||||
#include "platform_types.h"
|
||||
#include "s1ap_ies_defs.h"
|
||||
#include "s1ap_eNB_decoder.h"
|
||||
#include "assertions.h"
|
||||
#include "play_scenario.h"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
int et_s1ap_decode_initiating_message(s1ap_message *message, S1ap_InitiatingMessage_t *initiating_p)
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
DevAssert(initiating_p != NULL);
|
||||
|
||||
message->procedureCode = initiating_p->procedureCode;
|
||||
message->criticality = initiating_p->criticality;
|
||||
|
||||
switch(initiating_p->procedureCode) {
|
||||
case S1ap_ProcedureCode_id_downlinkNASTransport:
|
||||
ret = s1ap_decode_s1ap_downlinknastransporties(&message->msg.s1ap_DownlinkNASTransportIEs,&initiating_p->value);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_InitialContextSetup:
|
||||
ret = s1ap_decode_s1ap_initialcontextsetuprequesties(&message->msg.s1ap_InitialContextSetupRequestIEs, &initiating_p->value);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_UEContextRelease:
|
||||
ret = s1ap_decode_s1ap_uecontextreleasecommandies(&message->msg.s1ap_UEContextReleaseCommandIEs, &initiating_p->value);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_Paging:
|
||||
ret = s1ap_decode_s1ap_pagingies(&message->msg.s1ap_PagingIEs, &initiating_p->value);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_uplinkNASTransport:
|
||||
ret = s1ap_decode_s1ap_uplinknastransporties (&message->msg.s1ap_UplinkNASTransportIEs, &initiating_p->value);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_S1Setup:
|
||||
ret = s1ap_decode_s1ap_s1setuprequesties (&message->msg.s1ap_S1SetupRequestIEs, &initiating_p->value);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_initialUEMessage:
|
||||
ret = s1ap_decode_s1ap_initialuemessageies (&message->msg.s1ap_InitialUEMessageIEs, &initiating_p->value);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_UEContextReleaseRequest:
|
||||
ret = s1ap_decode_s1ap_uecontextreleaserequesties (&message->msg.s1ap_UEContextReleaseRequestIEs, &initiating_p->value);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_UECapabilityInfoIndication:
|
||||
ret = s1ap_decode_s1ap_uecapabilityinfoindicationies (&message->msg.s1ap_UECapabilityInfoIndicationIEs, &initiating_p->value);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_NASNonDeliveryIndication:
|
||||
ret = s1ap_decode_s1ap_nasnondeliveryindication_ies (&message->msg.s1ap_NASNonDeliveryIndication_IEs, &initiating_p->value);
|
||||
break;
|
||||
|
||||
default:
|
||||
AssertFatal( 0 , "Unknown procedure ID (%d) for initiating message\n",
|
||||
(int)initiating_p->procedureCode);
|
||||
return -1;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
int et_s1ap_decode_successful_outcome(s1ap_message *message, S1ap_SuccessfulOutcome_t *successfullOutcome_p)
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
DevAssert(successfullOutcome_p != NULL);
|
||||
|
||||
message->procedureCode = successfullOutcome_p->procedureCode;
|
||||
message->criticality = successfullOutcome_p->criticality;
|
||||
|
||||
switch(successfullOutcome_p->procedureCode) {
|
||||
case S1ap_ProcedureCode_id_S1Setup:
|
||||
ret = s1ap_decode_s1ap_s1setupresponseies(
|
||||
&message->msg.s1ap_S1SetupResponseIEs, &successfullOutcome_p->value);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_InitialContextSetup:
|
||||
ret = s1ap_decode_s1ap_initialcontextsetupresponseies (&message->msg.s1ap_InitialContextSetupResponseIEs, &successfullOutcome_p->value);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_UEContextRelease:
|
||||
ret = s1ap_decode_s1ap_uecontextreleasecompleteies (&message->msg.s1ap_UEContextReleaseCompleteIEs, &successfullOutcome_p->value);
|
||||
break;
|
||||
|
||||
default:
|
||||
AssertFatal(0, "Unknown procedure ID (%d) for successfull outcome message\n",
|
||||
(int)successfullOutcome_p->procedureCode);
|
||||
return -1;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
int et_s1ap_decode_unsuccessful_outcome(s1ap_message *message, S1ap_UnsuccessfulOutcome_t *unSuccessfullOutcome_p)
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
DevAssert(unSuccessfullOutcome_p != NULL);
|
||||
|
||||
message->procedureCode = unSuccessfullOutcome_p->procedureCode;
|
||||
message->criticality = unSuccessfullOutcome_p->criticality;
|
||||
|
||||
switch(unSuccessfullOutcome_p->procedureCode) {
|
||||
case S1ap_ProcedureCode_id_S1Setup:
|
||||
ret = s1ap_decode_s1ap_s1setupfailureies(&message->msg.s1ap_S1SetupFailureIEs, &unSuccessfullOutcome_p->value);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_InitialContextSetup:
|
||||
ret = s1ap_decode_s1ap_initialcontextsetupfailureies (&message->msg.s1ap_InitialContextSetupFailureIEs, &unSuccessfullOutcome_p->value);
|
||||
break;
|
||||
|
||||
default:
|
||||
AssertFatal(0,"Unknown procedure ID (%d) for unsuccessfull outcome message\n",
|
||||
(int)unSuccessfullOutcome_p->procedureCode);
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
int et_s1ap_decode_pdu(S1AP_PDU_t * const pdu, s1ap_message * const message, const uint8_t * const buffer, const uint32_t length)
|
||||
int et_s1ap_decode_pdu(S1AP_PDU_t *const pdu, const uint8_t *const buffer, const uint32_t length)
|
||||
{
|
||||
asn_dec_rval_t dec_ret;
|
||||
|
||||
DevAssert(buffer != NULL);
|
||||
|
||||
memset((void *)pdu, 0, sizeof(S1AP_PDU_t));
|
||||
|
||||
memset((void *)pdu, 0, sizeof(S1AP_S1AP_PDU_t));
|
||||
dec_ret = aper_decode(NULL,
|
||||
&asn_DEF_S1AP_PDU,
|
||||
&asn_DEF_S1AP_S1AP_PDU,
|
||||
(void **)&pdu,
|
||||
buffer,
|
||||
length,
|
||||
@@ -174,32 +52,14 @@ int et_s1ap_decode_pdu(S1AP_PDU_t * const pdu, s1ap_message * const message, con
|
||||
return -1;
|
||||
}
|
||||
|
||||
message->direction = pdu->present;
|
||||
|
||||
switch(pdu->present) {
|
||||
case S1AP_PDU_PR_initiatingMessage:
|
||||
return et_s1ap_decode_initiating_message(message,
|
||||
&pdu->choice.initiatingMessage);
|
||||
|
||||
case S1AP_PDU_PR_successfulOutcome:
|
||||
return et_s1ap_decode_successful_outcome(message,
|
||||
&pdu->choice.successfulOutcome);
|
||||
|
||||
case S1AP_PDU_PR_unsuccessfulOutcome:
|
||||
return et_s1ap_decode_unsuccessful_outcome(message,
|
||||
&pdu->choice.unsuccessfulOutcome);
|
||||
|
||||
default:
|
||||
AssertFatal(0, "Unknown presence (%d) or not implemented\n", (int)pdu->present);
|
||||
break;
|
||||
}
|
||||
return -1;
|
||||
return dec_ret.code;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void et_decode_s1ap(et_s1ap_t * const s1ap)
|
||||
void et_decode_s1ap(et_s1ap_t *const s1ap)
|
||||
{
|
||||
if (NULL != s1ap) {
|
||||
if (et_s1ap_decode_pdu(&s1ap->pdu, &s1ap->message, s1ap->binary_stream, s1ap->binary_stream_allocated_size) < 0) {
|
||||
if (et_s1ap_decode_pdu(&s1ap->pdu, s1ap->binary_stream, s1ap->binary_stream_allocated_size) < 0) {
|
||||
AssertFatal (0, "ERROR %s() Cannot decode S1AP message!\n", __FUNCTION__);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,11 +32,10 @@
|
||||
#include "intertask_interface.h"
|
||||
#include "platform_types.h"
|
||||
#include "assertions.h"
|
||||
#include "s1ap_ies_defs.h"
|
||||
#include "s1ap_eNB_decoder.h"
|
||||
#include "play_scenario.h"
|
||||
//-----------------------------------------------------------------------------
|
||||
void et_print_hex_octets(const unsigned char * const byte_stream, const unsigned long int num)
|
||||
void et_print_hex_octets(const unsigned char *const byte_stream, const unsigned long int num)
|
||||
{
|
||||
unsigned long octet_index = 0;
|
||||
|
||||
@@ -82,11 +81,14 @@ void et_print_hex_octets(const unsigned char * const byte_stream, const unsigned
|
||||
void et_display_node(xmlNodePtr node, unsigned int indent)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
if (node->type == XML_ELEMENT_NODE) {
|
||||
xmlChar *path = xmlGetNodePath(node);
|
||||
|
||||
for (i=0; i<indent; i++) {
|
||||
printf(" ");
|
||||
}
|
||||
|
||||
if (node->children != NULL && node->children->type == XML_TEXT_NODE) {
|
||||
xmlChar *content = xmlNodeGetContent(node);
|
||||
printf("%s -> %s\n", path, content);
|
||||
@@ -94,6 +96,7 @@ void et_display_node(xmlNodePtr node, unsigned int indent)
|
||||
} else {
|
||||
printf("%s\n", path);
|
||||
}
|
||||
|
||||
xmlFree(path);
|
||||
}
|
||||
}
|
||||
@@ -106,70 +109,91 @@ void et_display_tree(xmlNodePtr node, unsigned int indent)
|
||||
if (cur_node->type == XML_ELEMENT_NODE) {
|
||||
et_display_node(cur_node, indent);
|
||||
}
|
||||
|
||||
et_display_tree(cur_node->children, indent++);
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void et_display_packet_s1ap_data(const et_s1ap_t * const s1ap)
|
||||
void et_display_packet_S1AP_data(const et_S1AP_t *const s1ap)
|
||||
{
|
||||
char *message_string = NULL;
|
||||
|
||||
if (s1ap) {
|
||||
message_string = calloc(20000, sizeof(char));
|
||||
AssertFatal (NULL != message_string, "ERROR malloc()failed!\n");
|
||||
s1ap_string_total_size = 0;
|
||||
switch(s1ap->pdu.present) {
|
||||
case S1AP_PDU_PR_initiatingMessage:
|
||||
switch(s1ap->pdu.choice.initiatingMessage.procedureCode) {
|
||||
case S1ap_ProcedureCode_id_downlinkNASTransport: s1ap_xer_print_s1ap_downlinknastransport(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
|
||||
case S1ap_ProcedureCode_id_InitialContextSetup: s1ap_xer_print_s1ap_initialcontextsetuprequest(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
|
||||
case S1ap_ProcedureCode_id_UEContextRelease: s1ap_xer_print_s1ap_uecontextreleasecommand(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
|
||||
case S1ap_ProcedureCode_id_Paging: s1ap_xer_print_s1ap_paging(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
|
||||
case S1ap_ProcedureCode_id_uplinkNASTransport: s1ap_xer_print_s1ap_uplinknastransport(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
|
||||
case S1ap_ProcedureCode_id_S1Setup: s1ap_xer_print_s1ap_s1setuprequest(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
|
||||
case S1ap_ProcedureCode_id_initialUEMessage: s1ap_xer_print_s1ap_initialuemessage(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
|
||||
case S1ap_ProcedureCode_id_UEContextReleaseRequest: s1ap_xer_print_s1ap_uecontextreleaserequest(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
|
||||
case S1ap_ProcedureCode_id_UECapabilityInfoIndication:s1ap_xer_print_s1ap_uecapabilityinfoindication(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
|
||||
case S1ap_ProcedureCode_id_NASNonDeliveryIndication: s1ap_xer_print_s1ap_nasnondeliveryindication_(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
|
||||
default:
|
||||
AssertFatal( 0 , "Unknown procedure ID (%d) for initiating message\n",
|
||||
(int)s1ap->pdu.choice.initiatingMessage.procedureCode);
|
||||
}
|
||||
break;
|
||||
case S1AP_PDU_PR_successfulOutcome:
|
||||
switch(s1ap->pdu.choice.successfulOutcome.procedureCode) {
|
||||
case S1ap_ProcedureCode_id_S1Setup: s1ap_xer_print_s1ap_s1setupresponse(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
|
||||
case S1ap_ProcedureCode_id_InitialContextSetup: s1ap_xer_print_s1ap_initialcontextsetupresponse(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
|
||||
case S1ap_ProcedureCode_id_UEContextRelease: s1ap_xer_print_s1ap_uecontextreleasecomplete(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
|
||||
default:
|
||||
AssertFatal(0, "Unknown procedure ID (%d) for successfull outcome message\n",
|
||||
(int)s1ap->pdu.choice.successfulOutcome.procedureCode);
|
||||
}
|
||||
break;
|
||||
|
||||
case S1AP_PDU_PR_unsuccessfulOutcome:
|
||||
switch(s1ap->pdu.choice.unsuccessfulOutcome.procedureCode) {
|
||||
case S1ap_ProcedureCode_id_S1Setup: s1ap_xer_print_s1ap_s1setupfailure(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
|
||||
case S1ap_ProcedureCode_id_InitialContextSetup: s1ap_xer_print_s1ap_initialcontextsetupfailure(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
|
||||
switch(s1ap->pdu.present) {
|
||||
case S1AP_S1AP_PDU_PR_initiatingMessage:
|
||||
switch(s1ap->pdu.choice.initiatingMessage.procedureCode) {
|
||||
case S1AP_ProcedureCode_id_downlinkNASTransport: s1ap_xer_print_s1ap_downlinknastransport(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break;
|
||||
|
||||
case S1AP_ProcedureCode_id_InitialContextSetup: s1ap_xer_print_s1ap_initialcontextsetuprequest(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break;
|
||||
|
||||
case S1AP_ProcedureCode_id_UEContextRelease: s1ap_xer_print_s1ap_uecontextreleasecommand(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break;
|
||||
|
||||
case S1AP_ProcedureCode_id_Paging: s1ap_xer_print_s1ap_paging(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break;
|
||||
|
||||
case S1AP_ProcedureCode_id_uplinkNASTransport: s1ap_xer_print_s1ap_uplinknastransport(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break;
|
||||
|
||||
case S1AP_ProcedureCode_id_S1Setup: s1ap_xer_print_s1ap_s1setuprequest(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break;
|
||||
|
||||
case S1AP_ProcedureCode_id_initialUEMessage: s1ap_xer_print_s1ap_initialuemessage(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break;
|
||||
|
||||
case S1AP_ProcedureCode_id_UEContextReleaseRequest: s1ap_xer_print_s1ap_uecontextreleaserequest(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break;
|
||||
|
||||
case S1AP_ProcedureCode_id_UECapabilityInfoIndication:s1ap_xer_print_s1ap_uecapabilityinfoindication(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break;
|
||||
|
||||
case S1AP_ProcedureCode_id_NASNonDeliveryIndication: s1ap_xer_print_s1ap_nasnondeliveryindication_(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break;
|
||||
|
||||
default:
|
||||
AssertFatal( 0, "Unknown procedure ID (%d) for initiating message\n",
|
||||
(int)s1ap->pdu.choice.initiatingMessage.procedureCode);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case S1AP_S1AP_PDU_PR_successfulOutcome:
|
||||
switch(s1ap->pdu.choice.successfulOutcome.procedureCode) {
|
||||
case S1AP_ProcedureCode_id_S1Setup: s1ap_xer_print_s1ap_s1setupresponse(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break;
|
||||
|
||||
case S1AP_ProcedureCode_id_InitialContextSetup: s1ap_xer_print_s1ap_initialcontextsetupresponse(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break;
|
||||
|
||||
case S1AP_ProcedureCode_id_UEContextRelease: s1ap_xer_print_s1ap_uecontextreleasecomplete(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break;
|
||||
|
||||
default:
|
||||
AssertFatal(0, "Unknown procedure ID (%d) for successfull outcome message\n",
|
||||
(int)s1ap->pdu.choice.successfulOutcome.procedureCode);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case S1AP_S1AP_PDU_PR_unsuccessfulOutcome:
|
||||
switch(s1ap->pdu.choice.unsuccessfulOutcome.procedureCode) {
|
||||
case S1AP_ProcedureCode_id_S1Setup: s1ap_xer_print_s1ap_s1setupfailure(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break;
|
||||
|
||||
case S1AP_ProcedureCode_id_InitialContextSetup: s1ap_xer_print_s1ap_initialcontextsetupfailure(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break;
|
||||
|
||||
default:
|
||||
et_free_pointer(message_string);
|
||||
AssertFatal(0,"Unknown procedure ID (%d) for unsuccessfull outcome message\n",
|
||||
(int)s1ap->pdu.choice.unsuccessfulOutcome.procedureCode);
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
et_free_pointer(message_string);
|
||||
AssertFatal(0,"Unknown procedure ID (%d) for unsuccessfull outcome message\n",
|
||||
(int)s1ap->pdu.choice.unsuccessfulOutcome.procedureCode);
|
||||
AssertFatal(0, "Unknown presence (%d) or not implemented\n", (int)s1ap->pdu.present);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
AssertFatal(0, "Unknown presence (%d) or not implemented\n", (int)s1ap->pdu.present);
|
||||
break;
|
||||
}
|
||||
|
||||
fprintf(stdout, "\t\tSCTP.data XML dump:\n%s\n", message_string);
|
||||
et_free_pointer(message_string);
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void et_display_packet_sctp_init(const sctp_inithdr_t * const sctp)
|
||||
void et_display_packet_sctp_init(const sctp_inithdr_t *const sctp)
|
||||
{
|
||||
|
||||
if (sctp) {
|
||||
fprintf(stdout, "\t\tSCTP.init.init_tag : %u\n", sctp->init_tag);
|
||||
fprintf(stdout, "\t\tSCTP.init.a_rwnd : %u\n", sctp->a_rwnd);
|
||||
@@ -179,9 +203,8 @@ void et_display_packet_sctp_init(const sctp_inithdr_t * const sctp)
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void et_display_packet_sctp_initack(const sctp_initackhdr_t * const sctp)
|
||||
void et_display_packet_sctp_initack(const sctp_initackhdr_t *const sctp)
|
||||
{
|
||||
|
||||
if (sctp) {
|
||||
fprintf(stdout, "\t\tSCTP.initack.init_tag : %u\n", sctp->init_tag);
|
||||
fprintf(stdout, "\t\tSCTP.initack.a_rwnd : %u\n", sctp->a_rwnd);
|
||||
@@ -191,17 +214,20 @@ void et_display_packet_sctp_initack(const sctp_initackhdr_t * const sctp)
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void et_display_packet_sctp_data(const sctp_datahdr_t * const sctp)
|
||||
void et_display_packet_sctp_data(const sctp_datahdr_t *const sctp)
|
||||
{
|
||||
if (sctp) {
|
||||
fprintf(stdout, "\t\tSCTP.data.tsn : %u\n", sctp->tsn);
|
||||
fprintf(stdout, "\t\tSCTP.data.stream : %u\n", sctp->stream);
|
||||
fprintf(stdout, "\t\tSCTP.data.ssn : %u\n", sctp->ssn);
|
||||
fprintf(stdout, "\t\tSCTP.data.ppid : %u\n", sctp->ppid);
|
||||
|
||||
if (sctp->ppid == 18) {
|
||||
et_display_packet_s1ap_data(&sctp->payload);
|
||||
}
|
||||
|
||||
fprintf(stdout, "\t\tSCTP.data.binary_stream_allocated_size : %u\n", sctp->payload.binary_stream_allocated_size);
|
||||
|
||||
if (NULL != sctp->payload.binary_stream) {
|
||||
fprintf(stdout, "\t\tSCTP.data.binary_stream :\n");
|
||||
et_print_hex_octets(sctp->payload.binary_stream, sctp->payload.binary_stream_allocated_size);
|
||||
@@ -212,29 +238,33 @@ void et_display_packet_sctp_data(const sctp_datahdr_t * const sctp)
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void et_display_packet_sctp(const et_sctp_hdr_t * const sctp)
|
||||
void et_display_packet_sctp(const et_sctp_hdr_t *const sctp)
|
||||
{
|
||||
if (sctp) {
|
||||
fprintf(stdout, "\t\tSCTP.src_port : %u\n", sctp->src_port);
|
||||
fprintf(stdout, "\t\tSCTP.dst_port : %u\n", sctp->dst_port);
|
||||
fprintf(stdout, "\t\tSCTP.chunk_type : %s\n", et_chunk_type_cid2str(sctp->chunk_type));
|
||||
|
||||
switch (sctp->chunk_type) {
|
||||
case SCTP_CID_DATA:
|
||||
et_display_packet_sctp_data(&sctp->u.data_hdr);
|
||||
break;
|
||||
|
||||
case SCTP_CID_INIT:
|
||||
et_display_packet_sctp_initack(&sctp->u.init_hdr);
|
||||
break;
|
||||
|
||||
case SCTP_CID_INIT_ACK:
|
||||
et_display_packet_sctp_initack(&sctp->u.init_ack_hdr);
|
||||
break;
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void et_display_packet_ip(const et_ip_hdr_t * const ip)
|
||||
void et_display_packet_ip(const et_ip_hdr_t *const ip)
|
||||
{
|
||||
if (ip) {
|
||||
fprintf(stdout, "\t\tSource address : %s\n", et_ip2ip_str(&ip->src));
|
||||
@@ -243,61 +273,73 @@ void et_display_packet_ip(const et_ip_hdr_t * const ip)
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void et_display_packet(const et_packet_t * const packet)
|
||||
void et_display_packet(const et_packet_t *const packet)
|
||||
{
|
||||
if (packet) {
|
||||
fprintf(stdout, "-------------------------------------------------------------------------------\n");
|
||||
fprintf(stdout, "\tPacket:\tnum %u | original frame number %u \n", packet->packet_number, packet->original_frame_number);
|
||||
fprintf(stdout, "\tPacket:\ttime relative to 1st packet %ld.%06lu\n",
|
||||
packet->time_relative_to_first_packet.tv_sec, packet->time_relative_to_first_packet.tv_usec);
|
||||
packet->time_relative_to_first_packet.tv_sec, packet->time_relative_to_first_packet.tv_usec);
|
||||
fprintf(stdout, "\tPacket:\ttime relative to last tx packet %ld.%06lu\n",
|
||||
packet->time_relative_to_last_sent_packet.tv_sec, packet->time_relative_to_last_sent_packet.tv_usec);
|
||||
packet->time_relative_to_last_sent_packet.tv_sec, packet->time_relative_to_last_sent_packet.tv_usec);
|
||||
fprintf(stdout, "\tPacket:\ttime relative to last_received packet %ld.%06lu\n",
|
||||
packet->time_relative_to_last_received_packet.tv_sec, packet->time_relative_to_last_received_packet.tv_usec);
|
||||
packet->time_relative_to_last_received_packet.tv_sec, packet->time_relative_to_last_received_packet.tv_usec);
|
||||
|
||||
switch(packet->action) {
|
||||
case ET_PACKET_ACTION_S1C_SEND:
|
||||
fprintf(stdout, "\tPacket:\tAction SEND\n");
|
||||
break;
|
||||
case ET_PACKET_ACTION_S1C_RECEIVE:
|
||||
fprintf(stdout, "\tPacket:\tAction RECEIVE\n");
|
||||
break;
|
||||
default:
|
||||
fprintf(stdout, "\tPacket:\tAction UNKNOWN\n");
|
||||
case ET_PACKET_ACTION_S1C_SEND:
|
||||
fprintf(stdout, "\tPacket:\tAction SEND\n");
|
||||
break;
|
||||
|
||||
case ET_PACKET_ACTION_S1C_RECEIVE:
|
||||
fprintf(stdout, "\tPacket:\tAction RECEIVE\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stdout, "\tPacket:\tAction UNKNOWN\n");
|
||||
}
|
||||
|
||||
switch(packet->status) {
|
||||
case ET_PACKET_STATUS_NONE:
|
||||
fprintf(stdout, "\tPacket:\tStatus NONE\n");
|
||||
break;
|
||||
case ET_PACKET_STATUS_NOT_TAKEN_IN_ACCOUNT:
|
||||
fprintf(stdout, "\tPacket:\tStatus NOT_TAKEN_IN_ACCOUNT\n");
|
||||
break;
|
||||
case ET_PACKET_STATUS_SCHEDULED_FOR_SENDING:
|
||||
fprintf(stdout, "\tPacket:\tStatus SCHEDULED_FOR_SENDING\n");
|
||||
break;
|
||||
case ET_PACKET_STATUS_SENT:
|
||||
fprintf(stdout, "\tPacket:\tStatus SENT\n");
|
||||
break;
|
||||
case ET_PACKET_STATUS_SCHEDULED_FOR_RECEIVING:
|
||||
fprintf(stdout, "\tPacket:\tStatus SCHEDULED_FOR_RECEIVING\n");
|
||||
break;
|
||||
case ET_PACKET_STATUS_RECEIVED:
|
||||
fprintf(stdout, "\tPacket:\tStatus RECEIVED\n");
|
||||
break;
|
||||
default:
|
||||
fprintf(stdout, "\tPacket:\tStatus UNKNOWN\n");
|
||||
case ET_PACKET_STATUS_NONE:
|
||||
fprintf(stdout, "\tPacket:\tStatus NONE\n");
|
||||
break;
|
||||
|
||||
case ET_PACKET_STATUS_NOT_TAKEN_IN_ACCOUNT:
|
||||
fprintf(stdout, "\tPacket:\tStatus NOT_TAKEN_IN_ACCOUNT\n");
|
||||
break;
|
||||
|
||||
case ET_PACKET_STATUS_SCHEDULED_FOR_SENDING:
|
||||
fprintf(stdout, "\tPacket:\tStatus SCHEDULED_FOR_SENDING\n");
|
||||
break;
|
||||
|
||||
case ET_PACKET_STATUS_SENT:
|
||||
fprintf(stdout, "\tPacket:\tStatus SENT\n");
|
||||
break;
|
||||
|
||||
case ET_PACKET_STATUS_SCHEDULED_FOR_RECEIVING:
|
||||
fprintf(stdout, "\tPacket:\tStatus SCHEDULED_FOR_RECEIVING\n");
|
||||
break;
|
||||
|
||||
case ET_PACKET_STATUS_RECEIVED:
|
||||
fprintf(stdout, "\tPacket:\tStatus RECEIVED\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stdout, "\tPacket:\tStatus UNKNOWN\n");
|
||||
}
|
||||
|
||||
et_display_packet_ip(&packet->ip_hdr);
|
||||
et_display_packet_sctp(&packet->sctp_hdr);
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void et_display_scenario(const et_scenario_t * const scenario)
|
||||
void et_display_scenario(const et_scenario_t *const scenario)
|
||||
{
|
||||
et_packet_t *packet = NULL;
|
||||
|
||||
if (scenario) {
|
||||
fprintf(stdout, "Scenario: %s\n", (scenario->name != NULL) ? (char*)scenario->name:"UNKNOWN NAME");
|
||||
fprintf(stdout, "Scenario: %s\n", (scenario->name != NULL) ? (char *)scenario->name:"UNKNOWN NAME");
|
||||
packet = scenario->list_packet;
|
||||
|
||||
while (packet) {
|
||||
et_display_packet(packet);
|
||||
packet = packet->next;
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#include "platform_types.h"
|
||||
#include "assertions.h"
|
||||
#include "play_scenario.h"
|
||||
#include "s1ap_ies_defs.h"
|
||||
#include "play_scenario_s1ap_eNB_defs.h"
|
||||
#include "timer.h"
|
||||
|
||||
@@ -47,7 +46,7 @@ et_fsm_state_t g_fsm_state = ET_FSM_STATE_NULL;
|
||||
uint32_t g_constraints = ET_BIT_MASK_MATCH_SCTP_STREAM | ET_BIT_MASK_MATCH_SCTP_SSN;
|
||||
//------------------------------------------------------------------------------
|
||||
// it is assumed that if a time is negative tv_sec and tv_usec are both negative
|
||||
void timeval_add (struct timeval * const result, const struct timeval * const a, const struct timeval * const b)
|
||||
void timeval_add (struct timeval *const result, const struct timeval *const a, const struct timeval *const b)
|
||||
{
|
||||
AssertFatal(((a->tv_sec <= 0) && (a->tv_usec <= 0)) || ((a->tv_sec >= 0) && (a->tv_usec >= 0)), " Bad time format arg a\n");
|
||||
AssertFatal(((b->tv_sec <= 0) && (b->tv_usec <= 0)) || ((b->tv_sec >= 0) && (b->tv_usec >= 0)), " Bad time format arg b\n");
|
||||
@@ -55,6 +54,7 @@ void timeval_add (struct timeval * const result, const struct timeval * const a,
|
||||
long long int r = a->tv_usec + b->tv_usec + (a->tv_sec + b->tv_sec) * 1000000;
|
||||
result->tv_sec = r / (long long int)1000000;
|
||||
result->tv_usec = r % (long long int)1000000;
|
||||
|
||||
if ((result != a) && (result != b)) {
|
||||
LOG_D(ENB_APP, "timeval_add(%ld.%06d, %ld.%06d)=%ld.%06d\n", a->tv_sec, a->tv_usec, b->tv_sec, b->tv_usec, result->tv_sec, result->tv_usec);
|
||||
}
|
||||
@@ -63,7 +63,7 @@ void timeval_add (struct timeval * const result, const struct timeval * const a,
|
||||
//------------------------------------------------------------------------------
|
||||
// it is assumed that if a time is negative tv_sec and tv_usec are both negative
|
||||
// return true if result is positive
|
||||
int timeval_subtract (struct timeval * const result, struct timeval * const a, struct timeval * const b)
|
||||
int timeval_subtract (struct timeval *const result, struct timeval *const a, struct timeval *const b)
|
||||
{
|
||||
AssertFatal(((a->tv_sec <= 0) && (a->tv_usec <= 0)) || ((a->tv_sec >= 0) && (a->tv_usec >= 0)), " Bad time format arg a\n");
|
||||
AssertFatal(((b->tv_sec <= 0) && (b->tv_usec <= 0)) || ((b->tv_sec >= 0) && (b->tv_usec >= 0)), " Bad time format arg b\n");
|
||||
@@ -71,26 +71,30 @@ int timeval_subtract (struct timeval * const result, struct timeval * const a, s
|
||||
long long int r = a->tv_usec - b->tv_usec + (a->tv_sec - b->tv_sec) * 1000000;
|
||||
result->tv_sec = r / (long long int)1000000;
|
||||
result->tv_usec = r % (long long int)1000000;
|
||||
|
||||
if ((result != a) && (result != b)) {
|
||||
LOG_D(ENB_APP, "timeval_subtract(%ld.%06d, %ld.%06d)=%ld.%06d\n", a->tv_sec, a->tv_usec, b->tv_sec, b->tv_usec, result->tv_sec, result->tv_usec);
|
||||
}
|
||||
|
||||
return (result->tv_sec >= 0) && (result->tv_usec >= 0);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void et_scenario_wait_rx_packet(et_packet_t * const packet)
|
||||
void et_scenario_wait_rx_packet(et_packet_t *const packet)
|
||||
{
|
||||
packet->status = ET_PACKET_STATUS_SCHEDULED_FOR_RECEIVING;
|
||||
g_fsm_state = ET_FSM_STATE_WAITING_RX_EVENT;
|
||||
|
||||
if (timer_setup (ET_FSM_STATE_WAITING_RX_EVENT_DELAY_SEC, 0, TASK_S1AP, INSTANCE_DEFAULT, TIMER_ONE_SHOT,
|
||||
packet, &packet->timer_id) < 0) {
|
||||
packet, &packet->timer_id) < 0) {
|
||||
AssertFatal(0, " Can not start waiting RX event timer\n");
|
||||
}
|
||||
|
||||
g_scenario->timer_count++;
|
||||
LOG_D(ENB_APP, "Waiting RX packet num %d original frame number %u\n", packet->packet_number, packet->original_frame_number);
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void et_scenario_schedule_tx_packet(et_packet_t * packet)
|
||||
void et_scenario_schedule_tx_packet(et_packet_t *packet)
|
||||
{
|
||||
s1ap_eNB_instance_t *s1ap_eNB_instance = NULL;
|
||||
struct timeval now = { .tv_sec = 0, .tv_usec = 0 };
|
||||
@@ -101,11 +105,9 @@ void et_scenario_schedule_tx_packet(et_packet_t * packet)
|
||||
int last_packet_was_rx = 0;
|
||||
int we_are_too_late = 0;
|
||||
int original_frame_number = -1;
|
||||
|
||||
AssertFatal(NULL != packet, "packet argument is NULL");
|
||||
s1ap_eNB_instance = et_s1ap_eNB_get_instance(packet->enb_instance);
|
||||
AssertFatal(NULL != s1ap_eNB_instance, "Cannot get s1ap_eNB_instance_t for eNB instance %d", packet->enb_instance);
|
||||
|
||||
LOG_D(ENB_APP, "%s\n", __FUNCTION__);
|
||||
g_fsm_state = ET_FSM_STATE_WAITING_TX_EVENT;
|
||||
|
||||
@@ -118,8 +120,8 @@ void et_scenario_schedule_tx_packet(et_packet_t * packet)
|
||||
timeval_subtract(&offset_last_rx_packet,&now,&g_scenario->time_last_rx_packet);
|
||||
LOG_D(ENB_APP, "offset_last_tx_packet=%ld.%06d\n", offset_last_tx_packet.tv_sec, offset_last_tx_packet.tv_usec);
|
||||
LOG_D(ENB_APP, "offset_last_rx_packet=%ld.%06d\n", offset_last_rx_packet.tv_sec, offset_last_rx_packet.tv_usec);
|
||||
|
||||
last_packet_was_rx = timeval_subtract(&offset_tx_rx,&offset_last_tx_packet,&offset_last_rx_packet);
|
||||
|
||||
if (last_packet_was_rx) {
|
||||
LOG_D(ENB_APP, "last_packet_was_rx\n");
|
||||
we_are_too_late = timeval_subtract(&offset,&offset_last_rx_packet,&packet->time_relative_to_last_received_packet);
|
||||
@@ -129,30 +131,32 @@ void et_scenario_schedule_tx_packet(et_packet_t * packet)
|
||||
we_are_too_late = timeval_subtract(&offset,&offset_last_tx_packet,&packet->time_relative_to_last_sent_packet);
|
||||
LOG_D(ENB_APP, "we_are_too_late=%d, offset=%ld.%06d\n", we_are_too_late, offset.tv_sec, offset.tv_usec);
|
||||
}
|
||||
if ((0 == we_are_too_late) && (0 == g_max_speed)){
|
||||
|
||||
if ((0 == we_are_too_late) && (0 == g_max_speed)) {
|
||||
// set timer
|
||||
if ((offset.tv_sec <= 0) || (offset.tv_usec <= 0)){
|
||||
if ((offset.tv_sec <= 0) || (offset.tv_usec <= 0)) {
|
||||
offset.tv_sec = -offset.tv_sec;
|
||||
offset.tv_usec = -offset.tv_usec;
|
||||
}
|
||||
|
||||
LOG_D(ENB_APP, "Send packet num %u original frame number %u in %ld.%06d sec\n",
|
||||
packet->packet_number, packet->original_frame_number, offset.tv_sec, offset.tv_usec);
|
||||
|
||||
packet->packet_number, packet->original_frame_number, offset.tv_sec, offset.tv_usec);
|
||||
packet->status = ET_PACKET_STATUS_SCHEDULED_FOR_SENDING;
|
||||
|
||||
if (timer_setup (offset.tv_sec, offset.tv_usec, TASK_S1AP, INSTANCE_DEFAULT, TIMER_ONE_SHOT,packet, &packet->timer_id) < 0) {
|
||||
AssertFatal(0, " Can not start TX event timer\n");
|
||||
}
|
||||
|
||||
g_scenario->timer_count++;
|
||||
// Done g_fsm_state = ET_FSM_STATE_WAITING_TX_EVENT;
|
||||
} else {
|
||||
// send immediately
|
||||
AssertFatal(0 == gettimeofday(&packet->timestamp_packet, NULL), "gettimeofday() Failed");
|
||||
original_frame_number = packet->original_frame_number;
|
||||
|
||||
do {
|
||||
g_scenario->time_last_tx_packet.tv_sec = packet->timestamp_packet.tv_sec;
|
||||
g_scenario->time_last_tx_packet.tv_usec = packet->timestamp_packet.tv_usec;
|
||||
|
||||
LOG_D(ENB_APP, "Sending packet num %d original frame number %u immediately\n",packet->packet_number, packet->original_frame_number);
|
||||
et_s1ap_eNB_itti_send_sctp_data_req(
|
||||
packet->enb_instance,
|
||||
@@ -164,13 +168,17 @@ void et_scenario_schedule_tx_packet(et_packet_t * packet)
|
||||
g_scenario->next_packet = g_scenario->next_packet->next;
|
||||
packet = packet->next;
|
||||
} while ((NULL != packet) && (packet->original_frame_number == original_frame_number));
|
||||
|
||||
g_fsm_state = ET_FSM_STATE_RUNNING;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case SCTP_CID_INIT:
|
||||
case SCTP_CID_INIT_ACK:
|
||||
AssertFatal(0, "Invalid case TX packet SCTP_CID_INIT or SCTP_CID_INIT_ACK");
|
||||
break;
|
||||
|
||||
default:
|
||||
AssertFatal(0, "Invalid case TX packet SCTP_CID %d", packet->sctp_hdr.chunk_type);
|
||||
}
|
||||
@@ -178,23 +186,22 @@ void et_scenario_schedule_tx_packet(et_packet_t * packet)
|
||||
//------------------------------------------------------------------------------
|
||||
et_fsm_state_t et_scenario_fsm_notify_event_state_running(et_event_t event)
|
||||
{
|
||||
|
||||
switch (event.code){
|
||||
switch (event.code) {
|
||||
case ET_EVENT_TICK:
|
||||
while (NULL != g_scenario->next_packet) {
|
||||
LOG_D(ENB_APP, "EVENT_TICK: Considering packet num %d original frame number %u\n", g_scenario->next_packet->packet_number, g_scenario->next_packet->original_frame_number);
|
||||
|
||||
switch (g_scenario->next_packet->sctp_hdr.chunk_type) {
|
||||
case SCTP_CID_DATA :
|
||||
|
||||
// no init in this scenario, may be sub-scenario
|
||||
if (g_scenario->next_packet->action == ET_PACKET_ACTION_S1C_SEND) {
|
||||
if (g_scenario->next_packet->status == ET_PACKET_STATUS_NONE) {
|
||||
et_scenario_schedule_tx_packet(g_scenario->next_packet);
|
||||
pthread_mutex_unlock(&g_fsm_lock);
|
||||
|
||||
et_event_t continue_event;
|
||||
continue_event.code = ET_EVENT_TICK;
|
||||
et_scenario_fsm_notify_event(continue_event);
|
||||
|
||||
return g_fsm_state;
|
||||
} else if (g_scenario->next_packet->status != ET_PACKET_STATUS_SCHEDULED_FOR_SENDING) {
|
||||
AssertFatal(0, "Invalid packet status %d", g_scenario->next_packet->status);
|
||||
@@ -202,7 +209,6 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_running(et_event_t event)
|
||||
} else if (g_scenario->next_packet->action == ET_PACKET_ACTION_S1C_RECEIVE) {
|
||||
if (g_scenario->next_packet->status == ET_PACKET_STATUS_RECEIVED) {
|
||||
g_scenario->next_packet = g_scenario->next_packet->next;
|
||||
|
||||
} else if (g_scenario->next_packet->status == ET_PACKET_STATUS_NONE) {
|
||||
et_scenario_wait_rx_packet(g_scenario->next_packet);
|
||||
pthread_mutex_unlock(&g_fsm_lock);
|
||||
@@ -213,6 +219,7 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_running(et_event_t event)
|
||||
} else {
|
||||
AssertFatal(0, "Invalid packet action %d", g_scenario->next_packet->action);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case SCTP_CID_INIT:
|
||||
@@ -224,8 +231,8 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_running(et_event_t event)
|
||||
case SCTP_CID_ECN_ECNE:
|
||||
case SCTP_CID_ECN_CWR:
|
||||
LOG_D(ENB_APP, "EVENT_TICK: Ignoring packet num %d SCTP CID %s\n",
|
||||
g_scenario->next_packet->packet_number,
|
||||
et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type));
|
||||
g_scenario->next_packet->packet_number,
|
||||
et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type));
|
||||
g_scenario->next_packet->status = ET_PACKET_STATUS_NOT_TAKEN_IN_ACCOUNT;
|
||||
g_scenario->next_packet = g_scenario->next_packet->next;
|
||||
break;
|
||||
@@ -236,20 +243,22 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_running(et_event_t event)
|
||||
case SCTP_CID_ERROR:
|
||||
case SCTP_CID_SHUTDOWN_COMPLETE:
|
||||
AssertFatal(0, "The scenario should be cleaned (packet %s cannot be processed at this time)",
|
||||
et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type));
|
||||
et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type));
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_D(ENB_APP, "EVENT_TICK: Ignoring packet num %d SCTP CID %s\n",
|
||||
g_scenario->next_packet->packet_number,
|
||||
et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type));
|
||||
g_scenario->next_packet->packet_number,
|
||||
et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type));
|
||||
g_scenario->next_packet->status = ET_PACKET_STATUS_NOT_TAKEN_IN_ACCOUNT;
|
||||
g_scenario->next_packet = g_scenario->next_packet->next;
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr, "No Packet found in this scenario: %s\n", g_scenario->name);
|
||||
g_fsm_state = ET_FSM_STATE_NULL;
|
||||
pthread_mutex_unlock(&g_fsm_lock);
|
||||
|
||||
if (0 == g_scenario->timer_count) {
|
||||
fprintf(stderr, "End of scenario: %s\n", g_scenario->name);
|
||||
fflush(stderr);
|
||||
@@ -257,21 +266,27 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_running(et_event_t event)
|
||||
return 0;
|
||||
//exit(0);
|
||||
}
|
||||
|
||||
fprintf(stderr, "Remaining timers running: %d\n", g_scenario->timer_count);
|
||||
return g_fsm_state;
|
||||
break;
|
||||
|
||||
case ET_EVENT_RX_PACKET_TIME_OUT:
|
||||
AssertFatal(0, "Event ET_EVENT_RX_PACKET_TIME_OUT not handled in FSM state ET_FSM_STATE_RUNNING");
|
||||
break;
|
||||
|
||||
case ET_EVENT_TX_TIMED_PACKET:
|
||||
AssertFatal(0, "Event ET_EVENT_TX_TIMED_PACKET not handled in FSM state ET_FSM_STATE_RUNNING");
|
||||
break;
|
||||
|
||||
case ET_EVENT_RX_S1AP:
|
||||
et_s1ap_process_rx_packet(&event.u.s1ap_data_ind);
|
||||
break;
|
||||
|
||||
default:
|
||||
AssertFatal(0, "Case event %d not handled in ET_FSM_STATE_RUNNING", event.code);
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&g_fsm_lock);
|
||||
return 0;
|
||||
}
|
||||
@@ -283,7 +298,7 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_waiting_tx(et_event_t event)
|
||||
int original_frame_number = -1;
|
||||
et_packet_t *packet = NULL;
|
||||
|
||||
switch (event.code){
|
||||
switch (event.code) {
|
||||
case ET_EVENT_TICK:
|
||||
fprintf(stdout, "EVENT_TICK: waiting for tx event\n");
|
||||
break;
|
||||
@@ -296,23 +311,23 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_waiting_tx(et_event_t event)
|
||||
// send immediately
|
||||
packet = event.u.tx_timed_packet;
|
||||
AssertFatal(0 == gettimeofday(&packet->timestamp_packet, NULL), "gettimeofday() Failed");
|
||||
|
||||
original_frame_number = packet->original_frame_number;
|
||||
|
||||
do {
|
||||
g_scenario->time_last_tx_packet.tv_sec = packet->timestamp_packet.tv_sec;
|
||||
g_scenario->time_last_tx_packet.tv_usec = packet->timestamp_packet.tv_usec;
|
||||
|
||||
LOG_D(ENB_APP, "Sending packet num %d original frame number %u immediately\n",packet->packet_number, packet->original_frame_number);
|
||||
et_s1ap_eNB_itti_send_sctp_data_req(
|
||||
packet->enb_instance,
|
||||
packet->sctp_hdr.u.data_hdr.assoc_id,
|
||||
packet->sctp_hdr.u.data_hdr.payload.binary_stream,
|
||||
packet->sctp_hdr.u.data_hdr.payload.binary_stream_allocated_size,
|
||||
packet->sctp_hdr.u.data_hdr.stream);
|
||||
packet->enb_instance,
|
||||
packet->sctp_hdr.u.data_hdr.assoc_id,
|
||||
packet->sctp_hdr.u.data_hdr.payload.binary_stream,
|
||||
packet->sctp_hdr.u.data_hdr.payload.binary_stream_allocated_size,
|
||||
packet->sctp_hdr.u.data_hdr.stream);
|
||||
packet->status = ET_PACKET_STATUS_SENT;
|
||||
packet = packet->next;
|
||||
g_scenario->next_packet = packet;
|
||||
} while ( (NULL != packet) && (packet->original_frame_number == original_frame_number));
|
||||
|
||||
g_fsm_state = ET_FSM_STATE_RUNNING;
|
||||
break;
|
||||
|
||||
@@ -320,6 +335,7 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_waiting_tx(et_event_t event)
|
||||
default:
|
||||
AssertFatal(0, "Case event %d not handled in ET_FSM_STATE_WAITING_TX", event.code);
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&g_fsm_lock);
|
||||
return 0;
|
||||
}
|
||||
@@ -328,7 +344,8 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_waiting_tx(et_event_t event)
|
||||
et_fsm_state_t et_scenario_fsm_notify_event_state_waiting_rx(et_event_t event)
|
||||
{
|
||||
int rv = 0;
|
||||
switch (event.code){
|
||||
|
||||
switch (event.code) {
|
||||
case ET_EVENT_TICK:
|
||||
fprintf(stdout, "EVENT_TICK: waiting for rx event\n");
|
||||
break;
|
||||
@@ -341,16 +358,19 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_waiting_rx(et_event_t event)
|
||||
|
||||
case ET_EVENT_RX_S1AP:
|
||||
rv = et_s1ap_process_rx_packet(&event.u.s1ap_data_ind);
|
||||
|
||||
// waited packet
|
||||
if (rv == 0) {
|
||||
g_fsm_state = ET_FSM_STATE_RUNNING;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case ET_EVENT_TX_TIMED_PACKET:
|
||||
default:
|
||||
AssertFatal(0, "Case event %d not handled in ET_FSM_STATE_WAITING_RX", event.code);
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&g_fsm_lock);
|
||||
return 0;
|
||||
}
|
||||
@@ -358,8 +378,7 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_waiting_rx(et_event_t event)
|
||||
//------------------------------------------------------------------------------
|
||||
et_fsm_state_t et_scenario_fsm_notify_event_state_connecting_s1c(et_event_t event)
|
||||
{
|
||||
|
||||
switch (event.code){
|
||||
switch (event.code) {
|
||||
case ET_EVENT_TICK:
|
||||
break;
|
||||
|
||||
@@ -370,22 +389,20 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_connecting_s1c(et_event_t even
|
||||
while (NULL != g_scenario->next_packet) {
|
||||
switch (g_scenario->next_packet->sctp_hdr.chunk_type) {
|
||||
case SCTP_CID_DATA :
|
||||
|
||||
// no init in this scenario, may be sub-scenario
|
||||
if (g_scenario->next_packet->action == ET_PACKET_ACTION_S1C_SEND) {
|
||||
et_scenario_schedule_tx_packet(g_scenario->next_packet);
|
||||
pthread_mutex_unlock(&g_fsm_lock);
|
||||
|
||||
et_event_t continue_event;
|
||||
continue_event.code = ET_EVENT_TICK;
|
||||
et_scenario_fsm_notify_event(continue_event);
|
||||
|
||||
return g_fsm_state;
|
||||
} else if (g_scenario->next_packet->action == ET_PACKET_ACTION_S1C_RECEIVE) {
|
||||
if (g_scenario->next_packet->status == ET_PACKET_STATUS_RECEIVED) {
|
||||
g_scenario->last_rx_packet = g_scenario->next_packet;
|
||||
g_scenario->time_last_rx_packet = g_scenario->last_rx_packet->timestamp_packet;
|
||||
g_scenario->next_packet = g_scenario->next_packet->next;
|
||||
|
||||
} else if (g_scenario->next_packet->status == ET_PACKET_STATUS_NONE) {
|
||||
et_scenario_wait_rx_packet(g_scenario->next_packet);
|
||||
pthread_mutex_unlock(&g_fsm_lock);
|
||||
@@ -396,7 +413,8 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_connecting_s1c(et_event_t even
|
||||
} else {
|
||||
AssertFatal(0, "Invalid packet action %d", g_scenario->next_packet->action);
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
|
||||
case SCTP_CID_INIT:
|
||||
case SCTP_CID_INIT_ACK:
|
||||
@@ -416,7 +434,7 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_connecting_s1c(et_event_t even
|
||||
case SCTP_CID_ERROR:
|
||||
case SCTP_CID_SHUTDOWN_COMPLETE:
|
||||
AssertFatal(0, "The scenario should be cleaned (packet %s cannot be processed at this time)",
|
||||
et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type));
|
||||
et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type));
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -424,15 +442,18 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_connecting_s1c(et_event_t even
|
||||
g_scenario->next_packet = g_scenario->next_packet->next;
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr, "No Packet found in this scenario: %s\n", g_scenario->name);
|
||||
g_fsm_state = ET_FSM_STATE_NULL;
|
||||
pthread_mutex_unlock(&g_fsm_lock);
|
||||
|
||||
if (0 == g_scenario->timer_count) {
|
||||
fprintf(stderr, "End of scenario: %s\n", g_scenario->name);
|
||||
fflush(stderr);
|
||||
fflush(stdout);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
fprintf(stderr, "Remaining timers running: %d\n", g_scenario->timer_count);
|
||||
return g_fsm_state;
|
||||
break;
|
||||
@@ -440,13 +461,14 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_connecting_s1c(et_event_t even
|
||||
default:
|
||||
AssertFatal(0, "Case event %d not handled in ET_FSM_STATE_CONNECTING_S1C", event.code);
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&g_fsm_lock);
|
||||
return 0;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
et_fsm_state_t et_scenario_fsm_notify_event_state_null(et_event_t event)
|
||||
{
|
||||
switch (event.code){
|
||||
switch (event.code) {
|
||||
case ET_EVENT_TICK:
|
||||
break;
|
||||
|
||||
@@ -459,24 +481,21 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_null(et_event_t event)
|
||||
|
||||
while (NULL != g_scenario->next_packet) {
|
||||
switch (g_scenario->next_packet->sctp_hdr.chunk_type) {
|
||||
|
||||
case SCTP_CID_DATA :
|
||||
|
||||
// no init in this scenario, may be sub-scenario, ...
|
||||
if (g_scenario->next_packet->action == ET_PACKET_ACTION_S1C_SEND) {
|
||||
et_scenario_schedule_tx_packet(g_scenario->next_packet);
|
||||
pthread_mutex_unlock(&g_fsm_lock);
|
||||
|
||||
et_event_t continue_event;
|
||||
continue_event.code = ET_EVENT_TICK;
|
||||
et_scenario_fsm_notify_event(continue_event);
|
||||
|
||||
return g_fsm_state;
|
||||
} else if (g_scenario->next_packet->action == ET_PACKET_ACTION_S1C_RECEIVE) {
|
||||
if (g_scenario->next_packet->status == ET_PACKET_STATUS_RECEIVED) {
|
||||
g_scenario->last_rx_packet = g_scenario->next_packet;
|
||||
g_scenario->time_last_rx_packet = g_scenario->last_rx_packet->timestamp_packet;
|
||||
g_scenario->next_packet = g_scenario->next_packet->next;
|
||||
|
||||
} else if (g_scenario->next_packet->status == ET_PACKET_STATUS_NONE) {
|
||||
et_scenario_wait_rx_packet(g_scenario->next_packet);
|
||||
pthread_mutex_unlock(&g_fsm_lock);
|
||||
@@ -487,6 +506,7 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_null(et_event_t event)
|
||||
} else {
|
||||
AssertFatal(0, "Invalid packet action %d", g_scenario->next_packet->action);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case SCTP_CID_INIT:
|
||||
@@ -519,7 +539,7 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_null(et_event_t event)
|
||||
case SCTP_CID_ERROR:
|
||||
case SCTP_CID_SHUTDOWN_COMPLETE:
|
||||
AssertFatal(0, "The scenario should be cleaned (packet %s cannot be processed at this time)",
|
||||
et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type));
|
||||
et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type));
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -527,6 +547,7 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_null(et_event_t event)
|
||||
g_scenario->next_packet = g_scenario->next_packet->next;
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr, "No Useful packet found in this scenario: %s\n", g_scenario->name);
|
||||
g_fsm_state = ET_FSM_STATE_NULL;
|
||||
pthread_mutex_unlock(&g_fsm_lock);
|
||||
@@ -536,6 +557,7 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_null(et_event_t event)
|
||||
default:
|
||||
AssertFatal(0, "Case event %d not handled in ET_FSM_STATE_NULL", event.code);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -543,17 +565,23 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_null(et_event_t event)
|
||||
et_fsm_state_t et_scenario_fsm_notify_event(et_event_t event)
|
||||
{
|
||||
AssertFatal((event.code >= ET_EVENT_START) && (event.code < ET_EVENT_END), "Unknown et_event_t.code %d", event.code);
|
||||
|
||||
pthread_mutex_lock(&g_fsm_lock);
|
||||
switch (g_fsm_state){
|
||||
|
||||
switch (g_fsm_state) {
|
||||
case ET_FSM_STATE_NULL: return et_scenario_fsm_notify_event_state_null(event); break;
|
||||
|
||||
case ET_FSM_STATE_CONNECTING_S1C: return et_scenario_fsm_notify_event_state_connecting_s1c(event); break;
|
||||
|
||||
case ET_FSM_STATE_WAITING_TX_EVENT: return et_scenario_fsm_notify_event_state_waiting_tx(event); break;
|
||||
|
||||
case ET_FSM_STATE_WAITING_RX_EVENT: return et_scenario_fsm_notify_event_state_waiting_rx(event); break;
|
||||
|
||||
case ET_FSM_STATE_RUNNING: return et_scenario_fsm_notify_event_state_running(event); break;
|
||||
|
||||
default:
|
||||
AssertFatal(0, "Case fsm_state %d not handled", g_fsm_state);
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&g_fsm_lock);
|
||||
return g_fsm_state;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -56,402 +56,11 @@ extern et_scenario_t *g_scenario;
|
||||
extern uint32_t g_constraints;
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
asn_comp_rval_t * et_s1ap_ies_is_matching(const S1AP_PDU_PR present, s1ap_message * const m1, s1ap_message * const m2, const uint32_t constraints)
|
||||
{
|
||||
asn_comp_rval_t *ret = NULL;
|
||||
AssertFatal(m1 != NULL, "bad parameter m1");
|
||||
AssertFatal(m2 != NULL, "bad parameter m2");
|
||||
AssertFatal((present == S1AP_PDU_PR_initiatingMessage) ||
|
||||
(present == S1AP_PDU_PR_successfulOutcome) ||
|
||||
(present == S1AP_PDU_PR_unsuccessfulOutcome) , "Bad parameter S1AP_PDU_PR present ");
|
||||
AssertFatal( m1->procedureCode == m2->procedureCode, "Bad parameters: no matching procedure codes");
|
||||
//asn_comp_rval_t * et_s1ap_ies_is_matching(const S1AP_PDU_PR present, s1ap_message * const m1, s1ap_message * const m2, const uint32_t constraints)
|
||||
//{
|
||||
//}
|
||||
|
||||
|
||||
// some cases can never occur since uplink only.
|
||||
switch (m1->procedureCode) {
|
||||
case S1ap_ProcedureCode_id_HandoverPreparation:
|
||||
if (present == S1AP_PDU_PR_initiatingMessage) {
|
||||
ret = s1ap_compare_s1ap_handoverrequiredies(
|
||||
&m1->msg.s1ap_HandoverRequiredIEs,
|
||||
&m2->msg.s1ap_HandoverRequiredIEs);
|
||||
} else {
|
||||
ret = s1ap_compare_s1ap_handovercommandies(
|
||||
&m1->msg.s1ap_HandoverCommandIEs,
|
||||
&m2->msg.s1ap_HandoverCommandIEs);
|
||||
}
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_HandoverResourceAllocation:
|
||||
if (present == S1AP_PDU_PR_initiatingMessage) {
|
||||
ret = s1ap_compare_s1ap_handoverrequesties(
|
||||
&m1->msg.s1ap_HandoverRequestIEs,
|
||||
&m2->msg.s1ap_HandoverRequestIEs);
|
||||
} else if (present == S1AP_PDU_PR_successfulOutcome) {
|
||||
ret = s1ap_compare_s1ap_handoverrequestacknowledgeies(
|
||||
&m1->msg.s1ap_HandoverRequestAcknowledgeIEs,
|
||||
&m2->msg.s1ap_HandoverRequestAcknowledgeIEs);
|
||||
} else if (present == S1AP_PDU_PR_unsuccessfulOutcome) {
|
||||
ret = s1ap_compare_s1ap_handoverfailureies(
|
||||
&m1->msg.s1ap_HandoverFailureIEs,
|
||||
&m2->msg.s1ap_HandoverFailureIEs);
|
||||
}
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_HandoverNotification:
|
||||
ret = s1ap_compare_s1ap_handovernotifyies(
|
||||
&m1->msg.s1ap_HandoverNotifyIEs,
|
||||
&m2->msg.s1ap_HandoverNotifyIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_PathSwitchRequest:
|
||||
ret = s1ap_compare_s1ap_pathswitchrequesties(
|
||||
&m1->msg.s1ap_PathSwitchRequestIEs,
|
||||
&m2->msg.s1ap_PathSwitchRequestIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_HandoverCancel:
|
||||
ret = s1ap_compare_s1ap_handovercancelies(
|
||||
&m1->msg.s1ap_HandoverCancelIEs,
|
||||
&m2->msg.s1ap_HandoverCancelIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_E_RABSetup:
|
||||
if (present == S1AP_PDU_PR_initiatingMessage) {
|
||||
ret = s1ap_compare_s1ap_e_rabsetuprequesties(
|
||||
&m1->msg.s1ap_E_RABSetupRequestIEs,
|
||||
&m2->msg.s1ap_E_RABSetupRequestIEs);
|
||||
} else {
|
||||
ret = s1ap_compare_s1ap_e_rabsetupresponseies(
|
||||
&m1->msg.s1ap_E_RABSetupResponseIEs,
|
||||
&m2->msg.s1ap_E_RABSetupResponseIEs);
|
||||
}
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_E_RABModify:
|
||||
if (present == S1AP_PDU_PR_initiatingMessage) {
|
||||
ret = s1ap_compare_s1ap_e_rabmodifyrequesties(
|
||||
&m1->msg.s1ap_E_RABModifyRequestIEs,
|
||||
&m2->msg.s1ap_E_RABModifyRequestIEs);
|
||||
} else {
|
||||
ret = s1ap_compare_s1ap_e_rabmodifyresponseies(
|
||||
&m1->msg.s1ap_E_RABModifyResponseIEs,
|
||||
&m2->msg.s1ap_E_RABModifyResponseIEs);
|
||||
}
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_E_RABRelease:
|
||||
if (present == S1AP_PDU_PR_initiatingMessage) {
|
||||
ret = s1ap_compare_s1ap_e_rabreleasecommandies(
|
||||
&m1->msg.s1ap_E_RABReleaseCommandIEs,
|
||||
&m2->msg.s1ap_E_RABReleaseCommandIEs);
|
||||
} else {
|
||||
ret = s1ap_compare_s1ap_e_rabreleaseresponseies(
|
||||
&m1->msg.s1ap_E_RABReleaseResponseIEs,
|
||||
&m2->msg.s1ap_E_RABReleaseResponseIEs);
|
||||
}
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_E_RABReleaseIndication:
|
||||
ret = s1ap_compare_s1ap_e_rabreleaseindicationies(
|
||||
&m1->msg.s1ap_E_RABReleaseIndicationIEs,
|
||||
&m2->msg.s1ap_E_RABReleaseIndicationIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_InitialContextSetup:
|
||||
if (present == S1AP_PDU_PR_initiatingMessage) {
|
||||
ret = s1ap_compare_s1ap_initialcontextsetuprequesties(
|
||||
&m1->msg.s1ap_InitialContextSetupRequestIEs,
|
||||
&m2->msg.s1ap_InitialContextSetupRequestIEs);
|
||||
} else {
|
||||
ret = s1ap_compare_s1ap_initialcontextsetupresponseies(
|
||||
&m1->msg.s1ap_InitialContextSetupResponseIEs,
|
||||
&m2->msg.s1ap_InitialContextSetupResponseIEs);
|
||||
}
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_Paging:
|
||||
ret = s1ap_compare_s1ap_pagingies(
|
||||
&m1->msg.s1ap_PagingIEs,
|
||||
&m2->msg.s1ap_PagingIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_downlinkNASTransport:
|
||||
ret = s1ap_compare_s1ap_downlinknastransporties(
|
||||
&m1->msg.s1ap_DownlinkNASTransportIEs,
|
||||
&m2->msg.s1ap_DownlinkNASTransportIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_initialUEMessage:
|
||||
ret = s1ap_compare_s1ap_initialuemessageies(
|
||||
&m1->msg.s1ap_InitialUEMessageIEs,
|
||||
&m2->msg.s1ap_InitialUEMessageIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_uplinkNASTransport:
|
||||
ret = s1ap_compare_s1ap_uplinknastransporties(
|
||||
&m1->msg.s1ap_UplinkNASTransportIEs,
|
||||
&m2->msg.s1ap_UplinkNASTransportIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_Reset:
|
||||
ret = s1ap_compare_s1ap_reseties(
|
||||
&m1->msg.s1ap_ResetIEs,
|
||||
&m2->msg.s1ap_ResetIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_ErrorIndication:
|
||||
ret = s1ap_compare_s1ap_errorindicationies(
|
||||
&m1->msg.s1ap_ErrorIndicationIEs,
|
||||
&m2->msg.s1ap_ErrorIndicationIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_NASNonDeliveryIndication:
|
||||
ret = s1ap_compare_s1ap_nasnondeliveryindication_ies(
|
||||
&m1->msg.s1ap_NASNonDeliveryIndication_IEs,
|
||||
&m2->msg.s1ap_NASNonDeliveryIndication_IEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_S1Setup:
|
||||
if (present == S1AP_PDU_PR_initiatingMessage) {
|
||||
ret = s1ap_compare_s1ap_s1setuprequesties(
|
||||
&m1->msg.s1ap_S1SetupRequestIEs,
|
||||
&m2->msg.s1ap_S1SetupRequestIEs);
|
||||
} else if (present == S1AP_PDU_PR_successfulOutcome) {
|
||||
ret = s1ap_compare_s1ap_s1setupresponseies(
|
||||
&m1->msg.s1ap_S1SetupResponseIEs,
|
||||
&m2->msg.s1ap_S1SetupResponseIEs);
|
||||
} else if (present == S1AP_PDU_PR_unsuccessfulOutcome) {
|
||||
ret = s1ap_compare_s1ap_s1setupfailureies(
|
||||
&m1->msg.s1ap_S1SetupFailureIEs,
|
||||
&m2->msg.s1ap_S1SetupFailureIEs);
|
||||
}
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_UEContextReleaseRequest:
|
||||
ret = s1ap_compare_s1ap_uecontextreleaserequesties(
|
||||
&m1->msg.s1ap_UEContextReleaseRequestIEs,
|
||||
&m2->msg.s1ap_UEContextReleaseRequestIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_DownlinkS1cdma2000tunneling:
|
||||
ret = s1ap_compare_s1ap_downlinks1cdma2000tunnelingies(
|
||||
&m1->msg.s1ap_DownlinkS1cdma2000tunnelingIEs,
|
||||
&m2->msg.s1ap_DownlinkS1cdma2000tunnelingIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_UplinkS1cdma2000tunneling:
|
||||
ret = s1ap_compare_s1ap_uplinks1cdma2000tunnelingies(
|
||||
&m1->msg.s1ap_UplinkS1cdma2000tunnelingIEs,
|
||||
&m2->msg.s1ap_UplinkS1cdma2000tunnelingIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_UEContextModification:
|
||||
if (present == S1AP_PDU_PR_initiatingMessage) {
|
||||
ret = s1ap_compare_s1ap_uecontextmodificationrequesties(
|
||||
&m1->msg.s1ap_UEContextModificationRequestIEs,
|
||||
&m2->msg.s1ap_UEContextModificationRequestIEs);
|
||||
} else if (present == S1AP_PDU_PR_successfulOutcome) {
|
||||
ret = s1ap_compare_s1ap_uecontextmodificationresponseies(
|
||||
&m1->msg.s1ap_UEContextModificationResponseIEs,
|
||||
&m2->msg.s1ap_UEContextModificationResponseIEs);
|
||||
} else if (present == S1AP_PDU_PR_unsuccessfulOutcome) {
|
||||
ret = s1ap_compare_s1ap_uecontextmodificationfailureies(
|
||||
&m1->msg.s1ap_UEContextModificationFailureIEs,
|
||||
&m2->msg.s1ap_UEContextModificationFailureIEs);
|
||||
}
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_UECapabilityInfoIndication:
|
||||
ret = s1ap_compare_s1ap_uecapabilityinfoindicationies(
|
||||
&m1->msg.s1ap_UECapabilityInfoIndicationIEs,
|
||||
&m2->msg.s1ap_UECapabilityInfoIndicationIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_UEContextRelease:
|
||||
if (present == S1AP_PDU_PR_initiatingMessage) {
|
||||
ret = s1ap_compare_s1ap_uecontextreleasecommandies(
|
||||
&m1->msg.s1ap_UEContextReleaseCommandIEs,
|
||||
&m2->msg.s1ap_UEContextReleaseCommandIEs);
|
||||
} else {
|
||||
ret = s1ap_compare_s1ap_uecontextreleasecompleteies(
|
||||
&m1->msg.s1ap_UEContextReleaseCompleteIEs,
|
||||
&m2->msg.s1ap_UEContextReleaseCompleteIEs);
|
||||
}
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_eNBStatusTransfer:
|
||||
ret = s1ap_compare_s1ap_enbstatustransferies(
|
||||
&m1->msg.s1ap_ENBStatusTransferIEs,
|
||||
&m2->msg.s1ap_ENBStatusTransferIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_MMEStatusTransfer:
|
||||
ret = s1ap_compare_s1ap_mmestatustransferies(
|
||||
&m1->msg.s1ap_MMEStatusTransferIEs,
|
||||
&m2->msg.s1ap_MMEStatusTransferIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_DeactivateTrace:
|
||||
ret = s1ap_compare_s1ap_deactivatetraceies(
|
||||
&m1->msg.s1ap_DeactivateTraceIEs,
|
||||
&m2->msg.s1ap_DeactivateTraceIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_TraceStart:
|
||||
ret = s1ap_compare_s1ap_tracestarties(
|
||||
&m1->msg.s1ap_TraceStartIEs,
|
||||
&m2->msg.s1ap_TraceStartIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_TraceFailureIndication:
|
||||
ret = s1ap_compare_s1ap_tracefailureindicationies(
|
||||
&m1->msg.s1ap_TraceFailureIndicationIEs,
|
||||
&m2->msg.s1ap_TraceFailureIndicationIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_ENBConfigurationUpdate:
|
||||
if (present == S1AP_PDU_PR_initiatingMessage) {
|
||||
ret = s1ap_compare_s1ap_enbconfigurationupdateies(
|
||||
&m1->msg.s1ap_ENBConfigurationUpdateIEs,
|
||||
&m2->msg.s1ap_ENBConfigurationUpdateIEs);
|
||||
} else if (present == S1AP_PDU_PR_successfulOutcome) {
|
||||
ret = s1ap_compare_s1ap_enbconfigurationupdateacknowledgeies(
|
||||
&m1->msg.s1ap_ENBConfigurationUpdateAcknowledgeIEs,
|
||||
&m2->msg.s1ap_ENBConfigurationUpdateAcknowledgeIEs);
|
||||
} else {
|
||||
ret = s1ap_compare_s1ap_enbconfigurationupdatefailureies(
|
||||
&m1->msg.s1ap_ENBConfigurationUpdateFailureIEs,
|
||||
&m2->msg.s1ap_ENBConfigurationUpdateFailureIEs);
|
||||
}
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_MMEConfigurationUpdate:
|
||||
if (present == S1AP_PDU_PR_initiatingMessage) {
|
||||
ret = s1ap_compare_s1ap_mmeconfigurationupdateies(
|
||||
&m1->msg.s1ap_MMEConfigurationUpdateIEs,
|
||||
&m2->msg.s1ap_MMEConfigurationUpdateIEs);
|
||||
} else if (present == S1AP_PDU_PR_successfulOutcome) {
|
||||
ret = s1ap_compare_s1ap_mmeconfigurationupdateacknowledgeies(
|
||||
&m1->msg.s1ap_MMEConfigurationUpdateAcknowledgeIEs,
|
||||
&m2->msg.s1ap_MMEConfigurationUpdateAcknowledgeIEs);
|
||||
} else {
|
||||
ret = s1ap_compare_s1ap_mmeconfigurationupdatefailureies(
|
||||
&m1->msg.s1ap_MMEConfigurationUpdateFailureIEs,
|
||||
&m2->msg.s1ap_MMEConfigurationUpdateFailureIEs);
|
||||
}
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_LocationReportingControl:
|
||||
ret = s1ap_compare_s1ap_locationreportingcontrolies(
|
||||
&m1->msg.s1ap_LocationReportingControlIEs,
|
||||
&m2->msg.s1ap_LocationReportingControlIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_LocationReportingFailureIndication:
|
||||
ret = s1ap_compare_s1ap_locationreportingfailureindicationies(
|
||||
&m1->msg.s1ap_LocationReportingFailureIndicationIEs,
|
||||
&m2->msg.s1ap_LocationReportingFailureIndicationIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_LocationReport:
|
||||
ret = s1ap_compare_s1ap_locationreporties(
|
||||
&m1->msg.s1ap_LocationReportIEs,
|
||||
&m2->msg.s1ap_LocationReportIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_OverloadStart:
|
||||
ret = s1ap_compare_s1ap_overloadstarties(
|
||||
&m1->msg.s1ap_OverloadStartIEs,
|
||||
&m2->msg.s1ap_OverloadStartIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_OverloadStop:
|
||||
ret = s1ap_compare_s1ap_overloadstopies(
|
||||
&m1->msg.s1ap_OverloadStopIEs,
|
||||
&m2->msg.s1ap_OverloadStopIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_WriteReplaceWarning:
|
||||
if (present == S1AP_PDU_PR_initiatingMessage) {
|
||||
ret = s1ap_compare_s1ap_writereplacewarningrequesties(
|
||||
&m1->msg.s1ap_WriteReplaceWarningRequestIEs,
|
||||
&m2->msg.s1ap_WriteReplaceWarningRequestIEs);
|
||||
} else {
|
||||
ret = s1ap_compare_s1ap_writereplacewarningresponseies(
|
||||
&m1->msg.s1ap_WriteReplaceWarningResponseIEs,
|
||||
&m2->msg.s1ap_WriteReplaceWarningResponseIEs);
|
||||
}
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_eNBDirectInformationTransfer:
|
||||
ret = s1ap_compare_s1ap_enbdirectinformationtransferies(
|
||||
&m1->msg.s1ap_ENBDirectInformationTransferIEs,
|
||||
&m2->msg.s1ap_ENBDirectInformationTransferIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_MMEDirectInformationTransfer:
|
||||
|
||||
ret = s1ap_compare_s1ap_mmedirectinformationtransferies(
|
||||
&m1->msg.s1ap_MMEDirectInformationTransferIEs,
|
||||
&m2->msg.s1ap_MMEDirectInformationTransferIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_PrivateMessage:
|
||||
case S1ap_ProcedureCode_id_eNBConfigurationTransfer:
|
||||
case S1ap_ProcedureCode_id_MMEConfigurationTransfer:
|
||||
AssertFatal(0, "TODO");
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_CellTrafficTrace:
|
||||
ret = s1ap_compare_s1ap_celltraffictraceies(
|
||||
&m1->msg.s1ap_CellTrafficTraceIEs,
|
||||
&m2->msg.s1ap_CellTrafficTraceIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_Kill:
|
||||
if (present == S1AP_PDU_PR_initiatingMessage) {
|
||||
ret = s1ap_compare_s1ap_killrequesties(
|
||||
&m1->msg.s1ap_KillRequestIEs,
|
||||
&m2->msg.s1ap_KillRequestIEs);
|
||||
} else {
|
||||
ret = s1ap_compare_s1ap_killresponseies(
|
||||
&m1->msg.s1ap_KillResponseIEs,
|
||||
&m2->msg.s1ap_KillResponseIEs);
|
||||
}
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_downlinkUEAssociatedLPPaTransport:
|
||||
ret = s1ap_compare_s1ap_downlinkueassociatedlppatransport_ies(
|
||||
&m1->msg.s1ap_DownlinkUEAssociatedLPPaTransport_IEs,
|
||||
&m2->msg.s1ap_DownlinkUEAssociatedLPPaTransport_IEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_uplinkUEAssociatedLPPaTransport:
|
||||
ret = s1ap_compare_s1ap_uplinkueassociatedlppatransport_ies(
|
||||
&m1->msg.s1ap_UplinkUEAssociatedLPPaTransport_IEs,
|
||||
&m2->msg.s1ap_UplinkUEAssociatedLPPaTransport_IEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_downlinkNonUEAssociatedLPPaTransport:
|
||||
ret = s1ap_compare_s1ap_downlinknonueassociatedlppatransport_ies(
|
||||
&m1->msg.s1ap_DownlinkNonUEAssociatedLPPaTransport_IEs,
|
||||
&m2->msg.s1ap_DownlinkNonUEAssociatedLPPaTransport_IEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_uplinkNonUEAssociatedLPPaTransport:
|
||||
ret = s1ap_compare_s1ap_uplinknonueassociatedlppatransport_ies(
|
||||
&m1->msg.s1ap_UplinkNonUEAssociatedLPPaTransport_IEs,
|
||||
&m2->msg.s1ap_UplinkNonUEAssociatedLPPaTransport_IEs);
|
||||
break;
|
||||
|
||||
default:
|
||||
AssertFatal(0, "Unknown procedure code %ld", m1->procedureCode);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void update_xpath_node_mme_ue_s1ap_id(et_s1ap_t * const s1ap, xmlNode *node, const S1ap_MME_UE_S1AP_ID_t new_id)
|
||||
void update_xpath_node_mme_ue_s1ap_id(et_s1ap_t *const s1ap, xmlNode *node, const S1AP_MME_UE_S1AP_ID_t new_id)
|
||||
{
|
||||
xmlNode *cur_node = NULL;
|
||||
xmlAttrPtr attr = NULL;
|
||||
@@ -464,24 +73,30 @@ void update_xpath_node_mme_ue_s1ap_id(et_s1ap_t * const s1ap, xmlNode *node, con
|
||||
// modify
|
||||
for (cur_node = (xmlNode *)node; cur_node; cur_node = cur_node->next) {
|
||||
go_deeper_in_tree = 1;
|
||||
|
||||
if ((!xmlStrcmp(cur_node->name, (const xmlChar *)"field"))) {
|
||||
// do not get hidden fields
|
||||
xml_char = xmlGetProp((xmlNode *)cur_node, (const xmlChar *)"hide");
|
||||
|
||||
if (NULL != xml_char) {
|
||||
if ((!xmlStrcmp(xml_char, (const xmlChar *)"yes"))) {
|
||||
go_deeper_in_tree = 0;
|
||||
}
|
||||
|
||||
xmlFree(xml_char);
|
||||
}
|
||||
|
||||
if (0 < go_deeper_in_tree) {
|
||||
// first get size
|
||||
xml_char = xmlGetProp((xmlNode *)cur_node, (const xmlChar *)"pos");
|
||||
|
||||
if (NULL != xml_char) {
|
||||
pos = strtoul((const char *)xml_char, NULL, 0);
|
||||
pos -= s1ap->xml_stream_pos_offset;
|
||||
AssertFatal(pos >= 0, "Bad pos %d xml_stream_pos_offset %d", pos, s1ap->xml_stream_pos_offset);
|
||||
xmlFree(xml_char);
|
||||
xml_char = xmlGetProp((xmlNode *)cur_node, (const xmlChar *)"size");
|
||||
|
||||
if (NULL != xml_char) {
|
||||
const xmlChar value_d[32];
|
||||
const xmlChar value_h[20];
|
||||
@@ -491,7 +106,6 @@ void update_xpath_node_mme_ue_s1ap_id(et_s1ap_t * const s1ap, xmlNode *node, con
|
||||
unsigned long int uli = 0;
|
||||
char hex[3] = {0,0,0};
|
||||
char *end_ptr = NULL;
|
||||
|
||||
size = strtoul((const char *)xml_char, NULL, 0);
|
||||
xmlFree(xml_char);
|
||||
// second: try to set value (always hex)
|
||||
@@ -501,12 +115,12 @@ void update_xpath_node_mme_ue_s1ap_id(et_s1ap_t * const s1ap, xmlNode *node, con
|
||||
AssertFatal((ret > 0) && (ret < 20), "Could not convert int to hex str");
|
||||
ret = snprintf((char *)showname, 64, "MME-UE-S1AP-ID: %d", new_id);
|
||||
AssertFatal((ret > 0) && (ret < 64), "Could not convert int to dec str");
|
||||
|
||||
attr = xmlSetProp((xmlNode *)cur_node, (const xmlChar *)"value", value_h);
|
||||
attr = xmlSetProp((xmlNode *)cur_node, (const xmlChar *)"show", value_d);
|
||||
attr = xmlSetProp((xmlNode *)cur_node, (const xmlChar *)"showname", showname);
|
||||
//TODO update s1ap->binary_stream @pos with new_id_hex, size
|
||||
AssertFatal((pos+size) < s1ap->binary_stream_allocated_size, "Rewrite of mme_ue_s1ap_id out of bounds of binary_stream");
|
||||
|
||||
//avoid endianess issues
|
||||
do {
|
||||
hex[0] = value_h[pos2++];
|
||||
@@ -517,6 +131,7 @@ void update_xpath_node_mme_ue_s1ap_id(et_s1ap_t * const s1ap, xmlNode *node, con
|
||||
AssertFatal((uli != ULONG_MAX) && (end_ptr != NULL) && (*end_ptr == '\0'), "Conversion of hexstring %s failed returned %ld errno %d", hex, uli, errno);
|
||||
s1ap->binary_stream[pos++] = (unsigned char)uli;
|
||||
} while (pos2 < (2*5));
|
||||
|
||||
// update ASN1
|
||||
et_decode_s1ap(s1ap);
|
||||
//S1AP_INFO("Updated ASN1 for %s\n", showname);
|
||||
@@ -524,6 +139,7 @@ void update_xpath_node_mme_ue_s1ap_id(et_s1ap_t * const s1ap, xmlNode *node, con
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (0 < go_deeper_in_tree) {
|
||||
update_xpath_node_mme_ue_s1ap_id(s1ap, cur_node->children, new_id);
|
||||
}
|
||||
@@ -538,12 +154,11 @@ void update_xpath_node_mme_ue_s1ap_id(et_s1ap_t * const s1ap, xmlNode *node, con
|
||||
* Prints the @nodes content to @output.
|
||||
* From http://www.xmlsoft.org/examples/#xpath2.c
|
||||
*/
|
||||
void update_xpath_nodes_mme_ue_s1ap_id(et_s1ap_t * const s1ap_payload, xmlNodeSetPtr nodes, const S1ap_MME_UE_S1AP_ID_t new_id)
|
||||
void update_xpath_nodes_mme_ue_s1ap_id(et_s1ap_t *const s1ap_payload, xmlNodeSetPtr nodes, const S1AP_MME_UE_S1AP_ID_t new_id)
|
||||
{
|
||||
int size = 0;
|
||||
int i = 0;
|
||||
xmlNode *s1ap_node = NULL;
|
||||
|
||||
size = (nodes) ? nodes->nodeNr : 0;
|
||||
//S1AP_DEBUG("%s() num nodes %u\n", __FUNCTION__, size);
|
||||
|
||||
@@ -559,6 +174,7 @@ void update_xpath_nodes_mme_ue_s1ap_id(et_s1ap_t * const s1ap_payload, xmlNodeSe
|
||||
s1ap_node = nodes->nodeTab[i];
|
||||
AssertFatal(NULL != s1ap_node, "One element of resultset of XPATH expression is NULL\n");
|
||||
update_xpath_node_mme_ue_s1ap_id(s1ap_payload, s1ap_node, new_id);
|
||||
|
||||
/*
|
||||
* All the elements returned by an XPath query are pointers to
|
||||
* elements from the tree *except* namespace nodes where the XPath
|
||||
@@ -581,28 +197,24 @@ void update_xpath_nodes_mme_ue_s1ap_id(et_s1ap_t * const s1ap_payload, xmlNodeSe
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
int et_s1ap_update_mme_ue_s1ap_id(et_packet_t * const packet, const S1ap_MME_UE_S1AP_ID_t old_id, const S1ap_MME_UE_S1AP_ID_t new_id)
|
||||
int et_s1ap_update_mme_ue_s1ap_id(et_packet_t *const packet, const S1AP_MME_UE_S1AP_ID_t old_id, const S1AP_MME_UE_S1AP_ID_t new_id)
|
||||
{
|
||||
|
||||
|
||||
xmlChar xpath_expression[ET_XPATH_EXPRESSION_MAX_LENGTH];
|
||||
int ret = 0;
|
||||
xmlDocPtr doc = NULL;
|
||||
xmlXPathContextPtr xpath_ctx = NULL;
|
||||
xmlXPathObjectPtr xpath_obj = NULL;
|
||||
|
||||
//S1AP_DEBUG("%s() packet num %u original frame number %u, mme_ue_s1ap_id %u -> %u\n", __FUNCTION__, packet->packet_number, packet->original_frame_number, old_id, new_id);
|
||||
|
||||
ret = snprintf(xpath_expression, ET_XPATH_EXPRESSION_MAX_LENGTH, "//field[@name=\"s1ap.MME_UE_S1AP_ID\"][@show=\"%u\"]", old_id);
|
||||
AssertFatal((ret > 0) && (ret < ET_XPATH_EXPRESSION_MAX_LENGTH), "Could not build XPATH expression err=%d", ret);
|
||||
|
||||
doc = packet->sctp_hdr.u.data_hdr.payload.doc;
|
||||
// Create xpath evaluation context
|
||||
xpath_ctx = xmlXPathNewContext(doc);
|
||||
|
||||
if(xpath_ctx == NULL) {
|
||||
fprintf(stderr,"Error: unable to create new XPath context\n");
|
||||
xmlFreeDoc(doc);
|
||||
return(-1);
|
||||
fprintf(stderr,"Error: unable to create new XPath context\n");
|
||||
xmlFreeDoc(doc);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
// Evaluate xpath expression
|
||||
@@ -610,17 +222,16 @@ int et_s1ap_update_mme_ue_s1ap_id(et_packet_t * const packet, const S1ap_MME_UE_
|
||||
xmlXPathFreeContext(xpath_ctx);
|
||||
AssertFatal(xpath_obj != NULL, "Unable to evaluate XPATH expression \"%s\"\n", xpath_expression);
|
||||
|
||||
if(xmlXPathNodeSetIsEmpty(xpath_obj->nodesetval)){
|
||||
if(xmlXPathNodeSetIsEmpty(xpath_obj->nodesetval)) {
|
||||
xmlXPathFreeObject(xpath_obj);
|
||||
S1AP_DEBUG("%s() No match \"%s\"packet num %u original frame number %u, mme_ue_s1ap_id %u -> %u\n",
|
||||
__FUNCTION__, xpath_expression, packet->packet_number, packet->original_frame_number, old_id, new_id);
|
||||
__FUNCTION__, xpath_expression, packet->packet_number, packet->original_frame_number, old_id, new_id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// update selected nodes
|
||||
update_xpath_nodes_mme_ue_s1ap_id(&packet->sctp_hdr.u.data_hdr.payload, xpath_obj->nodesetval, new_id);
|
||||
|
||||
// Cleanup of XPath data
|
||||
xmlXPathFreeObject(xpath_obj);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -36,22 +36,25 @@
|
||||
#include "play_scenario.h"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
asn_comp_rval_t * et_sctp_data_is_matching(sctp_datahdr_t * const sctp1, sctp_datahdr_t * const sctp2, const uint32_t constraints)
|
||||
asn_comp_rval_t *et_sctp_data_is_matching(sctp_datahdr_t *const sctp1, sctp_datahdr_t *const sctp2, const uint32_t constraints)
|
||||
{
|
||||
asn_comp_rval_t *rv = NULL;
|
||||
|
||||
// no comparison for ports
|
||||
if (sctp1->ppid != sctp2->ppid) {
|
||||
if (sctp1->ppid != sctp2->ppid) {
|
||||
S1AP_WARN("No Matching SCTP PPID %u %u\n", sctp1->ppid, sctp2->ppid);
|
||||
rv = calloc(1, sizeof(asn_comp_rval_t));
|
||||
rv->err_code = ET_ERROR_MATCH_PACKET_SCTP_PPID;
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (sctp1->assoc_id != sctp2->assoc_id) {
|
||||
S1AP_WARN("No Matching SCTP assoc id %u %u\n", sctp1->assoc_id, sctp2->assoc_id);
|
||||
rv = calloc(1, sizeof(asn_comp_rval_t));
|
||||
rv->err_code = ET_ERROR_MATCH_PACKET_SCTP_ASSOC_ID;
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (sctp1->stream != sctp2->stream) {
|
||||
if (constraints & ET_BIT_MASK_MATCH_SCTP_STREAM) {
|
||||
rv = calloc(1, sizeof(asn_comp_rval_t));
|
||||
@@ -61,30 +64,33 @@ asn_comp_rval_t * et_sctp_data_is_matching(sctp_datahdr_t * const sctp1, sctp_da
|
||||
S1AP_WARN("No Matching SCTP stream %u %u\n", sctp1->stream, sctp2->stream);
|
||||
}
|
||||
}
|
||||
|
||||
// We do not have SSN from lower layers
|
||||
// if (sctp1->ssn != sctp2->ssn) {
|
||||
// if (constraints & ET_BIT_MASK_MATCH_SCTP_SSN) {
|
||||
// rv = calloc(1, sizeof(asn_comp_rval_t));
|
||||
// rv->err_code = ET_ERROR_MATCH_PACKET_SCTP_SSN;
|
||||
// return rv;
|
||||
// } else {
|
||||
// S1AP_WARN("No Matching SCTP STREAM SN %u %u\n", sctp1->ssn, sctp2->ssn);
|
||||
// }
|
||||
// }
|
||||
// if (sctp1->ssn != sctp2->ssn) {
|
||||
// if (constraints & ET_BIT_MASK_MATCH_SCTP_SSN) {
|
||||
// rv = calloc(1, sizeof(asn_comp_rval_t));
|
||||
// rv->err_code = ET_ERROR_MATCH_PACKET_SCTP_SSN;
|
||||
// return rv;
|
||||
// } else {
|
||||
// S1AP_WARN("No Matching SCTP STREAM SN %u %u\n", sctp1->ssn, sctp2->ssn);
|
||||
// }
|
||||
// }
|
||||
return et_s1ap_is_matching(&sctp1->payload, &sctp2->payload, constraints);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
asn_comp_rval_t * et_sctp_is_matching(et_sctp_hdr_t * const sctp1, et_sctp_hdr_t * const sctp2, const uint32_t constraints)
|
||||
asn_comp_rval_t *et_sctp_is_matching(et_sctp_hdr_t *const sctp1, et_sctp_hdr_t *const sctp2, const uint32_t constraints)
|
||||
{
|
||||
// no comparison for ports
|
||||
asn_comp_rval_t *rv = NULL;
|
||||
if (sctp1->chunk_type != sctp2->chunk_type){
|
||||
|
||||
if (sctp1->chunk_type != sctp2->chunk_type) {
|
||||
S1AP_WARN("No Matching chunk_type %u %u\n", sctp1->chunk_type, sctp2->chunk_type);
|
||||
rv = calloc(1, sizeof(asn_comp_rval_t));
|
||||
rv->err_code = ET_ERROR_MATCH_PACKET_SCTP_CHUNK_TYPE;
|
||||
return rv;
|
||||
}
|
||||
|
||||
switch (sctp1->chunk_type) {
|
||||
case SCTP_CID_DATA:
|
||||
return et_sctp_data_is_matching(&sctp1->u.data_hdr, &sctp2->u.data_hdr, constraints);
|
||||
@@ -93,9 +99,11 @@ asn_comp_rval_t * et_sctp_is_matching(et_sctp_hdr_t * const sctp1, et_sctp_hdr_
|
||||
case SCTP_CID_INIT:
|
||||
AssertFatal(0, "Not needed now");
|
||||
break;
|
||||
|
||||
case SCTP_CID_INIT_ACK:
|
||||
AssertFatal(0, "Not needed now");
|
||||
break;
|
||||
|
||||
default:
|
||||
AssertFatal(0, "Not needed now cid %d", sctp1->chunk_type);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#include "s1ap_common.h"
|
||||
#include "s1ap_eNB.h"
|
||||
#include "s1ap_mme.h"
|
||||
#include "s1ap_ies_defs.h"
|
||||
|
||||
char ip_addr[] = "127.0.0.1";
|
||||
|
||||
@@ -60,13 +59,10 @@ int s1ap_eNB_generate_initial_ue_message(uint8_t **buffer,
|
||||
{
|
||||
InitialUEMessageIEs initialUEmessageIEs;
|
||||
InitialUEMessageIEs *initialUEmessageIEs_p = &initialUEmessageIEs;
|
||||
|
||||
memset(initialUEmessageIEs_p, 0, sizeof(InitialUEMessageIEs));
|
||||
|
||||
initialUEmessageIEs.eNB_UE_S1AP_ID = eNB_UE_S1AP_ID;
|
||||
initialUEmessageIEs.nas_pdu.buf = infoNAS;
|
||||
initialUEmessageIEs.nas_pdu.size = sizeof(infoNAS);
|
||||
|
||||
initialUEmessageIEs.tai.tAC.buf = tac;
|
||||
initialUEmessageIEs.tai.tAC.size = 2;
|
||||
initialUEmessageIEs.tai.pLMNidentity.buf = identity;
|
||||
@@ -76,9 +72,7 @@ int s1ap_eNB_generate_initial_ue_message(uint8_t **buffer,
|
||||
initialUEmessageIEs.eutran_cgi.cell_ID.buf = id;
|
||||
initialUEmessageIEs.eutran_cgi.cell_ID.size = 4;
|
||||
initialUEmessageIEs.eutran_cgi.cell_ID.bits_unused = 4;
|
||||
|
||||
initialUEmessageIEs.rrC_Establishment_Cause = RRC_Establishment_Cause_mo_Data;
|
||||
|
||||
return s1ap_eNB_encode_initial_ue_message(initialUEmessageIEs_p, buffer, length);
|
||||
}
|
||||
|
||||
@@ -95,13 +89,10 @@ int main(int argc, char *argv[])
|
||||
asn_enc_rval_t retVal;
|
||||
uint8_t *buffer;
|
||||
uint32_t len;
|
||||
|
||||
SupportedTAs_Item_t ta;
|
||||
PLMNidentity_t plmnIdentity;
|
||||
|
||||
asn_debug = 0;
|
||||
asn1_xer_print = 0;
|
||||
|
||||
S1SetupRequestIEs s1SetupRequest;
|
||||
memset(&s1SetupRequest, 0, sizeof(S1SetupRequestIEs));
|
||||
s1SetupRequest.global_ENB_ID.eNB_ID.present = ENB_ID_PR_macroENB_ID;
|
||||
@@ -109,32 +100,23 @@ int main(int argc, char *argv[])
|
||||
s1SetupRequest.global_ENB_ID.eNB_ID.choice.macroENB_ID.size = 3;
|
||||
s1SetupRequest.global_ENB_ID.eNB_ID.choice.macroENB_ID.bits_unused = 4;
|
||||
OCTET_STRING_fromBuf(&s1SetupRequest.global_ENB_ID.pLMNidentity, identity, 3);
|
||||
|
||||
s1SetupRequest.presenceMask |= S1SETUPREQUESTIES_ENBNAME_PRESENT;
|
||||
OCTET_STRING_fromBuf(&s1SetupRequest.eNBname, "ENB 1 eurecom",
|
||||
strlen("ENB 1 eurecom"));
|
||||
|
||||
memset(&ta, 0, sizeof(SupportedTAs_Item_t));
|
||||
memset(&plmnIdentity, 0, sizeof(PLMNidentity_t));
|
||||
OCTET_STRING_fromBuf(&ta.tAC, tac, 2);
|
||||
OCTET_STRING_fromBuf(&plmnIdentity, identity, 3);
|
||||
ASN_SEQUENCE_ADD(&ta.broadcastPLMNs, &plmnIdentity);
|
||||
ASN_SEQUENCE_ADD(&s1SetupRequest.supportedTAs, &ta);
|
||||
|
||||
s1SetupRequest.defaultPagingDRX = PagingDRX_v64;
|
||||
|
||||
s1ap_eNB_encode_s1setuprequest(&s1SetupRequest, &buffer, &len);
|
||||
|
||||
assoc[0] = sctp_connect_to_remote_host(ip_addr, 36412, &recv_callback);
|
||||
sctp_send_msg(0, 0, buffer, len);
|
||||
|
||||
free(buffer);
|
||||
|
||||
// generateUplinkNASTransport(&buffer, &len);
|
||||
// sctp_send_msg(assoc[0], 0, buffer, len);
|
||||
// s1ap_mme_decode_pdu(buffer, len);
|
||||
|
||||
pthread_join(sctp_get_receiver_thread(assoc[0]), NULL);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#include "s1ap_common.h"
|
||||
#include "s1ap_eNB.h"
|
||||
#include "s1ap_mme.h"
|
||||
#include "s1ap_ies_defs.h"
|
||||
|
||||
#include "s1ap_eNB_encoder.h"
|
||||
#include "s1ap_eNB_decoder.h"
|
||||
@@ -79,27 +78,22 @@ void s1ap_test_generate_s1_setup_request(uint32_t eNB_id, uint8_t **buffer,
|
||||
SupportedTAs_Item_t ta;
|
||||
PLMNidentity_t plmnIdentity;
|
||||
uint8_t *id_p = (uint8_t *)(&eNB_id + 1);
|
||||
|
||||
memset(&s1SetupRequest, 0, sizeof(S1SetupRequestIEs_t));
|
||||
s1SetupRequest.global_ENB_ID.eNB_ID.present = ENB_ID_PR_macroENB_ID;
|
||||
s1SetupRequest.global_ENB_ID.eNB_ID.choice.macroENB_ID.buf = id_p;
|
||||
s1SetupRequest.global_ENB_ID.eNB_ID.choice.macroENB_ID.size = 3;
|
||||
s1SetupRequest.global_ENB_ID.eNB_ID.choice.macroENB_ID.bits_unused = 4;
|
||||
OCTET_STRING_fromBuf(&s1SetupRequest.global_ENB_ID.pLMNidentity, identity, 3);
|
||||
|
||||
s1SetupRequest.presenceMask |= S1SETUPREQUESTIES_ENBNAME_PRESENT;
|
||||
OCTET_STRING_fromBuf(&s1SetupRequest.eNBname, "ENB 1 eurecom",
|
||||
strlen("ENB 1 eurecom"));
|
||||
|
||||
memset(&ta, 0, sizeof(SupportedTAs_Item_t));
|
||||
memset(&plmnIdentity, 0, sizeof(PLMNidentity_t));
|
||||
OCTET_STRING_fromBuf(&ta.tAC, tac, 2);
|
||||
OCTET_STRING_fromBuf(&plmnIdentity, identity, 3);
|
||||
ASN_SEQUENCE_ADD(&ta.broadcastPLMNs, &plmnIdentity);
|
||||
ASN_SEQUENCE_ADD(&s1SetupRequest.supportedTAs, &ta);
|
||||
|
||||
s1SetupRequest.defaultPagingDRX = PagingDRX_v64;
|
||||
|
||||
s1ap_eNB_encode_s1_setup_request(&s1SetupRequest, buffer, length);
|
||||
}
|
||||
|
||||
@@ -109,13 +103,10 @@ int s1ap_test_generate_initial_ue_message(uint32_t eNB_UE_S1AP_ID,
|
||||
{
|
||||
InitialUEMessageIEs_t initialUEmessageIEs;
|
||||
InitialUEMessageIEs_t *initialUEmessageIEs_p = &initialUEmessageIEs;
|
||||
|
||||
memset(initialUEmessageIEs_p, 0, sizeof(InitialUEMessageIEs_t));
|
||||
|
||||
initialUEmessageIEs.eNB_UE_S1AP_ID = eNB_UE_S1AP_ID & 0x00ffffff;
|
||||
initialUEmessageIEs.nas_pdu.buf = (uint8_t *)infoNAS;
|
||||
initialUEmessageIEs.nas_pdu.size = sizeof(infoNAS);
|
||||
|
||||
initialUEmessageIEs.tai.tAC.buf = (uint8_t *)tac;
|
||||
initialUEmessageIEs.tai.tAC.size = 2;
|
||||
initialUEmessageIEs.tai.pLMNidentity.buf = (uint8_t *)identity;
|
||||
@@ -125,9 +116,7 @@ int s1ap_test_generate_initial_ue_message(uint32_t eNB_UE_S1AP_ID,
|
||||
initialUEmessageIEs.eutran_cgi.cell_ID.buf = (uint8_t *)id;
|
||||
initialUEmessageIEs.eutran_cgi.cell_ID.size = 4;
|
||||
initialUEmessageIEs.eutran_cgi.cell_ID.bits_unused = 4;
|
||||
|
||||
initialUEmessageIEs.rrC_Establishment_Cause = RRC_Establishment_Cause_mo_Data;
|
||||
|
||||
return s1ap_eNB_encode_initial_ue_message(initialUEmessageIEs_p, buffer, length);
|
||||
}
|
||||
|
||||
@@ -140,26 +129,19 @@ int s1ap_test_generate_initial_setup_resp(uint32_t eNB_UE_S1AP_ID,
|
||||
{
|
||||
InitialContextSetupResponseIEs_t initialResponseIEs;
|
||||
InitialContextSetupResponseIEs_t *initialResponseIEs_p = &initialResponseIEs;
|
||||
|
||||
E_RABSetupItemCtxtSURes_t e_RABSetupItemCtxtSURes;
|
||||
|
||||
memset(initialResponseIEs_p, 0, sizeof(InitialContextSetupResponseIEs_t));
|
||||
memset(&e_RABSetupItemCtxtSURes, 0, sizeof(E_RABSetupItemCtxtSURes_t));
|
||||
|
||||
initialResponseIEs_p->mme_ue_s1ap_id = mme_UE_S1AP_ID;
|
||||
initialResponseIEs_p->eNB_UE_S1AP_ID = eNB_UE_S1AP_ID;
|
||||
|
||||
e_RABSetupItemCtxtSURes.e_RAB_ID = eRAB_id;
|
||||
e_RABSetupItemCtxtSURes.transportLayerAddress.buf = (uint8_t *)&ipv4_local;
|
||||
e_RABSetupItemCtxtSURes.transportLayerAddress.size = 4;
|
||||
|
||||
e_RABSetupItemCtxtSURes.gTP_TEID.buf = (uint8_t *)&teid;
|
||||
e_RABSetupItemCtxtSURes.gTP_TEID.size = 4;
|
||||
|
||||
ASN_SEQUENCE_ADD(
|
||||
&initialResponseIEs_p->e_RABSetupListCtxtSURes.e_RABSetupItemCtxtSURes,
|
||||
&e_RABSetupItemCtxtSURes);
|
||||
|
||||
return s1ap_eNB_encode_initial_context_setup_response(initialResponseIEs_p,
|
||||
buffer, length);
|
||||
}
|
||||
@@ -169,19 +151,19 @@ int recv_callback(uint32_t assocId,
|
||||
uint8_t *buffer,
|
||||
uint32_t length)
|
||||
{
|
||||
s1ap_message message;
|
||||
S1AP_S1AP_PDU_t pdu;
|
||||
uint8_t *buffer2;
|
||||
uint32_t len;
|
||||
int j;
|
||||
|
||||
if (s1ap_eNB_decode_pdu(&message, buffer, length) < 0) {
|
||||
if (s1ap_eNB_decode_pdu(&pdu, buffer, length) < 0) {
|
||||
fprintf(stderr, "s1ap_eNB_decode_pdu returned status < 0\n");
|
||||
free(buffer);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (message.procedureCode == ProcedureCode_id_S1Setup
|
||||
&& message.direction == S1AP_PDU_PR_successfulOutcome) {
|
||||
if (pdu.initiatingMessage.procedureCode == S1AP_ProcedureCode_id_S1Setup
|
||||
&& pdu.present == S1AP_S1AP_PDU_PR_successfulOutcome) {
|
||||
for (j = 0; j < nb_ue; j++) {
|
||||
s1ap_test_generate_initial_ue_message(j, &buffer2, &len);
|
||||
|
||||
@@ -194,8 +176,8 @@ int recv_callback(uint32_t assocId,
|
||||
|
||||
free(buffer2);
|
||||
}
|
||||
} else if (message.procedureCode == ProcedureCode_id_InitialContextSetup
|
||||
&& message.direction == S1AP_PDU_PR_initiatingMessage) {
|
||||
} else if (pdu.initiatingMessage.procedureCode == S1AP_ProcedureCode_id_InitialContextSetup
|
||||
&& pdu.present == S1AP_PDU_PR_initiatingMessage) {
|
||||
fprintf(stdout, "Received InitialContextSetup request\n");
|
||||
s1ap_test_generate_initial_setup_resp(
|
||||
message.msg.initialContextSetupRequestIEs.eNB_UE_S1AP_ID,
|
||||
@@ -220,7 +202,6 @@ int recv_callback(uint32_t assocId,
|
||||
}
|
||||
|
||||
free(buffer);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -231,9 +212,7 @@ int sctp_connected(void *args,
|
||||
{
|
||||
uint8_t *buffer;
|
||||
uint32_t len;
|
||||
|
||||
fprintf(stdout, "New association %d\n", assocId);
|
||||
|
||||
s1ap_test_generate_s1_setup_request(assocId * nb_eNB, &buffer, &len);
|
||||
|
||||
if (sctp_send_msg(assocId, 0, buffer, len) < 0) {
|
||||
@@ -244,7 +223,6 @@ int sctp_connected(void *args,
|
||||
}
|
||||
|
||||
free(buffer);
|
||||
|
||||
connected_eNB++;
|
||||
return 0;
|
||||
}
|
||||
@@ -252,12 +230,9 @@ int sctp_connected(void *args,
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
asn_enc_rval_t retVal;
|
||||
|
||||
int i;
|
||||
|
||||
SupportedTAs_Item_t ta;
|
||||
PLMNidentity_t plmnIdentity;
|
||||
|
||||
asn_debug = 0;
|
||||
asn1_xer_print = 0;
|
||||
|
||||
@@ -278,12 +253,9 @@ int main(int argc, char *argv[])
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
|
||||
// generateUplinkNASTransport(&buffer, &len);
|
||||
// sctp_send_msg(assoc[0], 0, buffer, len);
|
||||
// s1ap_mme_decode_pdu(buffer, len);
|
||||
|
||||
sctp_terminate();
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -145,16 +145,16 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
for (i = 0; i < sizeof(s1ap_test) / sizeof(s1ap_test_t); i++) {
|
||||
struct s1ap_message_s message;
|
||||
S1AP_S1AP_PDU_t pdu;
|
||||
uint8_t *buffer;
|
||||
uint32_t length;
|
||||
memset(&message, 0, sizeof(struct s1ap_message_s));
|
||||
memset(&pdu, 0, sizeof(pdu));
|
||||
printf("Trying to decode %s procedure with asn1c decoder\n",
|
||||
s1ap_test[i].procedure_name);
|
||||
|
||||
if (s1ap_mme_decode_pdu(&message, s1ap_test[i].buffer,
|
||||
if (s1ap_mme_decode_pdu(&pdu, s1ap_test[i].buffer,
|
||||
s1ap_test[i].buf_len) < 0) {
|
||||
if (s1ap_eNB_decode_pdu(&message, s1ap_test[i].buffer,
|
||||
if (s1ap_eNB_decode_pdu(&pdu, s1ap_test[i].buffer,
|
||||
s1ap_test[i].buf_len) < 0) {
|
||||
printf("Failed to decode this message\n");
|
||||
} else {
|
||||
@@ -167,7 +167,7 @@ int main(int argc, char *argv[])
|
||||
printf("Trying to encode %s procedure with asn1c encoder\n",
|
||||
s1ap_test[i].procedure_name);
|
||||
|
||||
if (s1ap_eNB_encode_pdu(&message, &buffer, &length) < 0) {
|
||||
if (s1ap_eNB_encode_pdu(&pdu, &buffer, &length) < 0) {
|
||||
printf("Failed to encode this message on MME side, trying eNB side\n");
|
||||
} else {
|
||||
compare_buffer(buffer, length, s1ap_test[i].buffer, s1ap_test[i].buf_len);
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#include "s1ap_common.h"
|
||||
#include "s1ap_eNB.h"
|
||||
#include "s1ap_mme.h"
|
||||
#include "s1ap_ies_defs.h"
|
||||
|
||||
#include "s1ap_eNB_encoder.h"
|
||||
#include "s1ap_eNB_decoder.h"
|
||||
@@ -45,9 +44,7 @@ int recv_callback(uint32_t assocId,
|
||||
uint8_t *buffer,
|
||||
uint32_t length)
|
||||
{
|
||||
|
||||
free(buffer);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -56,14 +53,12 @@ int sctp_connected(void *args,
|
||||
uint32_t instreams,
|
||||
uint32_t outstreams)
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
asn_enc_rval_t retVal;
|
||||
|
||||
int i;
|
||||
|
||||
for (i = 0; i < nb_eNB; i++) {
|
||||
@@ -75,6 +70,5 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
sctp_terminate();
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -43,7 +43,6 @@
|
||||
#include "intertask_interface.h"
|
||||
#include "s1ap_eNB_default_values.h"
|
||||
#include "s1ap_common.h"
|
||||
#include "s1ap_ies_defs.h"
|
||||
#include "s1ap_eNB_defs.h"
|
||||
#include "s1ap_eNB_management_procedures.h"
|
||||
#include "assertions.h"
|
||||
@@ -55,11 +54,9 @@
|
||||
void s1ap_eNB_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind)
|
||||
{
|
||||
int result;
|
||||
|
||||
DevAssert(sctp_data_ind != NULL);
|
||||
mme_test_s1_notify_sctp_data_ind(sctp_data_ind->assoc_id, sctp_data_ind->stream,
|
||||
sctp_data_ind->buffer, sctp_data_ind->buffer_length);
|
||||
|
||||
sctp_data_ind->buffer, sctp_data_ind->buffer_length);
|
||||
result = itti_free(TASK_UNKNOWN, sctp_data_ind->buffer);
|
||||
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
|
||||
}
|
||||
@@ -70,16 +67,12 @@ void s1ap_eNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uin
|
||||
{
|
||||
MessageDef *message_p;
|
||||
sctp_data_req_t *sctp_data_req;
|
||||
|
||||
message_p = itti_alloc_new_message(TASK_S1AP, SCTP_DATA_REQ);
|
||||
|
||||
sctp_data_req = &message_p->ittiMsg.sctp_data_req;
|
||||
|
||||
sctp_data_req->assoc_id = assoc_id;
|
||||
sctp_data_req->buffer = buffer;
|
||||
sctp_data_req->buffer_length = buffer_length;
|
||||
sctp_data_req->stream = stream;
|
||||
|
||||
itti_send_msg_to_task(TASK_SCTP, instance, message_p);
|
||||
}
|
||||
|
||||
@@ -100,7 +93,6 @@ void s1ap_handle_s1_setup_message(s1ap_eNB_mme_data_t *mme_desc_p, int sctp_shut
|
||||
/* If there are no more associated MME, inform eNB app */
|
||||
if (mme_desc_p->s1ap_eNB_instance->s1ap_mme_associated_nb == 0) {
|
||||
MessageDef *message_p;
|
||||
|
||||
message_p = itti_alloc_new_message(TASK_S1AP, S1AP_DEREGISTERED_ENB_IND);
|
||||
S1AP_DEREGISTERED_ENB_IND(message_p).nb_mme = 0;
|
||||
itti_send_msg_to_task(TASK_ENB_APP, mme_desc_p->s1ap_eNB_instance->instance, message_p);
|
||||
@@ -119,7 +111,6 @@ void s1ap_handle_s1_setup_message(s1ap_eNB_mme_data_t *mme_desc_p, int sctp_shut
|
||||
/* If there are no more pending messages, inform eNB app */
|
||||
if (mme_desc_p->s1ap_eNB_instance->s1ap_mme_pending_nb == 0) {
|
||||
MessageDef *message_p;
|
||||
|
||||
message_p = itti_alloc_new_message(TASK_S1AP, S1AP_REGISTER_ENB_CNF);
|
||||
S1AP_REGISTER_ENB_CNF(message_p).nb_mme = mme_desc_p->s1ap_eNB_instance->s1ap_mme_associated_nb;
|
||||
itti_send_msg_to_task(TASK_ENB_APP, mme_desc_p->s1ap_eNB_instance->instance, message_p);
|
||||
@@ -131,12 +122,9 @@ void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa
|
||||
{
|
||||
s1ap_eNB_instance_t *instance_p;
|
||||
s1ap_eNB_mme_data_t *s1ap_mme_data_p;
|
||||
|
||||
DevAssert(sctp_new_association_resp != NULL);
|
||||
|
||||
instance_p = s1ap_eNB_get_instance(instance);
|
||||
DevAssert(instance_p != NULL);
|
||||
|
||||
s1ap_mme_data_p = s1ap_eNB_get_MME(instance_p, -1,
|
||||
sctp_new_association_resp->ulp_cnx_id);
|
||||
DevAssert(s1ap_mme_data_p != NULL);
|
||||
@@ -146,9 +134,7 @@ void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa
|
||||
sctp_new_association_resp->sctp_state,
|
||||
instance,
|
||||
sctp_new_association_resp->ulp_cnx_id);
|
||||
|
||||
s1ap_handle_s1_setup_message(s1ap_mme_data_p, sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -156,49 +142,37 @@ void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa
|
||||
s1ap_mme_data_p->assoc_id = sctp_new_association_resp->assoc_id;
|
||||
s1ap_mme_data_p->in_streams = sctp_new_association_resp->in_streams;
|
||||
s1ap_mme_data_p->out_streams = sctp_new_association_resp->out_streams;
|
||||
|
||||
/* Prepare new S1 Setup Request */
|
||||
mme_test_s1_start_test(instance_p, s1ap_mme_data_p);
|
||||
}
|
||||
|
||||
void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p,
|
||||
net_ip_address_t *mme_ip_address,
|
||||
net_ip_address_t *local_ip_addr)
|
||||
net_ip_address_t *mme_ip_address,
|
||||
net_ip_address_t *local_ip_addr)
|
||||
{
|
||||
MessageDef *message_p = NULL;
|
||||
sctp_new_association_req_t *sctp_new_association_req_p = NULL;
|
||||
s1ap_eNB_mme_data_t *s1ap_mme_data_p = NULL;
|
||||
|
||||
DevAssert(instance_p != NULL);
|
||||
DevAssert(mme_ip_address != NULL);
|
||||
|
||||
message_p = itti_alloc_new_message(TASK_S1AP, SCTP_NEW_ASSOCIATION_REQ);
|
||||
|
||||
sctp_new_association_req_p = &message_p->ittiMsg.sctp_new_association_req;
|
||||
|
||||
sctp_new_association_req_p->port = S1AP_PORT_NUMBER;
|
||||
sctp_new_association_req_p->ppid = S1AP_SCTP_PPID;
|
||||
|
||||
memcpy(&sctp_new_association_req_p->remote_address,
|
||||
mme_ip_address,
|
||||
sizeof(*mme_ip_address));
|
||||
|
||||
memcpy(&sctp_new_association_req_p->local_address,
|
||||
local_ip_addr,
|
||||
sizeof(*local_ip_addr));
|
||||
|
||||
/* Create new MME descriptor */
|
||||
s1ap_mme_data_p = calloc(1, sizeof(*s1ap_mme_data_p));
|
||||
DevAssert(s1ap_mme_data_p != NULL);
|
||||
|
||||
s1ap_mme_data_p->cnx_id = s1ap_eNB_fetch_add_global_cnx_id();
|
||||
sctp_new_association_req_p->ulp_cnx_id = s1ap_mme_data_p->cnx_id;
|
||||
|
||||
s1ap_mme_data_p->assoc_id = -1;
|
||||
s1ap_mme_data_p->s1ap_eNB_instance = instance_p;
|
||||
|
||||
STAILQ_INIT(&s1ap_mme_data_p->served_gummei);
|
||||
|
||||
/* Insert the new descriptor in list of known MME
|
||||
* but not yet associated.
|
||||
*/
|
||||
@@ -206,7 +180,6 @@ void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p,
|
||||
s1ap_mme_data_p->state = S1AP_ENB_STATE_WAITING;
|
||||
instance_p->s1ap_mme_nb ++;
|
||||
instance_p->s1ap_mme_pending_nb ++;
|
||||
|
||||
itti_send_msg_to_task(TASK_SCTP, instance_p->instance, message_p);
|
||||
}
|
||||
|
||||
@@ -216,9 +189,7 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *
|
||||
{
|
||||
s1ap_eNB_instance_t *new_instance;
|
||||
uint8_t index;
|
||||
|
||||
DevAssert(s1ap_register_eNB != NULL);
|
||||
|
||||
/* Look if the provided instance already exists */
|
||||
new_instance = s1ap_eNB_get_instance(instance);
|
||||
|
||||
@@ -234,10 +205,8 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *
|
||||
} else {
|
||||
new_instance = calloc(1, sizeof(s1ap_eNB_instance_t));
|
||||
DevAssert(new_instance != NULL);
|
||||
|
||||
RB_INIT(&new_instance->s1ap_ue_head);
|
||||
RB_INIT(&new_instance->s1ap_mme_head);
|
||||
|
||||
/* Copy usefull parameters */
|
||||
new_instance->instance = instance;
|
||||
new_instance->eNB_name = s1ap_register_eNB->eNB_name;
|
||||
@@ -248,10 +217,8 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *
|
||||
new_instance->mnc = s1ap_register_eNB->mnc;
|
||||
new_instance->mnc_digit_length = s1ap_register_eNB->mnc_digit_length;
|
||||
new_instance->default_drx = s1ap_register_eNB->default_drx;
|
||||
|
||||
/* Add the new instance to the list of eNB (meaningfull in virtual mode) */
|
||||
s1ap_eNB_insert_new_instance(new_instance);
|
||||
|
||||
S1AP_DEBUG("Registered new eNB[%d] and %s eNB id %u\n",
|
||||
instance,
|
||||
s1ap_register_eNB->cell_type == CELL_MACRO_ENB ? "macro" : "home",
|
||||
@@ -275,54 +242,48 @@ void *s1ap_eNB_task(void *arg)
|
||||
{
|
||||
MessageDef *received_msg = NULL;
|
||||
int result;
|
||||
|
||||
S1AP_DEBUG("Starting S1AP layer\n");
|
||||
|
||||
s1ap_eNB_prepare_internal_data();
|
||||
|
||||
itti_mark_task_ready(TASK_S1AP);
|
||||
|
||||
while (1) {
|
||||
itti_receive_msg(TASK_S1AP, &received_msg);
|
||||
|
||||
switch (ITTI_MSG_ID(received_msg)) {
|
||||
case TERMINATE_MESSAGE:
|
||||
itti_exit_task();
|
||||
case TERMINATE_MESSAGE:
|
||||
itti_exit_task();
|
||||
break;
|
||||
|
||||
case S1AP_REGISTER_ENB_REQ: {
|
||||
/* Register a new eNB.
|
||||
* in Virtual mode eNBs will be distinguished using the mod_id/
|
||||
* Each eNB has to send an S1AP_REGISTER_ENB message with its
|
||||
* own parameters.
|
||||
*/
|
||||
s1ap_eNB_handle_register_eNB(ITTI_MESSAGE_GET_INSTANCE(received_msg),
|
||||
&S1AP_REGISTER_ENB_REQ(received_msg));
|
||||
}
|
||||
break;
|
||||
|
||||
case S1AP_REGISTER_ENB_REQ: {
|
||||
/* Register a new eNB.
|
||||
* in Virtual mode eNBs will be distinguished using the mod_id/
|
||||
* Each eNB has to send an S1AP_REGISTER_ENB message with its
|
||||
* own parameters.
|
||||
*/
|
||||
s1ap_eNB_handle_register_eNB(ITTI_MESSAGE_GET_INSTANCE(received_msg),
|
||||
&S1AP_REGISTER_ENB_REQ(received_msg));
|
||||
}
|
||||
break;
|
||||
|
||||
case SCTP_NEW_ASSOCIATION_RESP: {
|
||||
s1ap_eNB_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
|
||||
&received_msg->ittiMsg.sctp_new_association_resp);
|
||||
}
|
||||
break;
|
||||
|
||||
case SCTP_DATA_IND: {
|
||||
s1ap_eNB_handle_sctp_data_ind(&received_msg->ittiMsg.sctp_data_ind);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
|
||||
default:
|
||||
S1AP_ERROR("Received unhandled message: %d:%s\n",
|
||||
ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg));
|
||||
case SCTP_NEW_ASSOCIATION_RESP: {
|
||||
s1ap_eNB_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
|
||||
&received_msg->ittiMsg.sctp_new_association_resp);
|
||||
}
|
||||
break;
|
||||
|
||||
case SCTP_DATA_IND: {
|
||||
s1ap_eNB_handle_sctp_data_ind(&received_msg->ittiMsg.sctp_data_ind);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
S1AP_ERROR("Received unhandled message: %d:%s\n",
|
||||
ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg));
|
||||
break;
|
||||
}
|
||||
|
||||
result = itti_free (ITTI_MSG_ORIGIN_ID(received_msg), received_msg);
|
||||
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
|
||||
|
||||
received_msg = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -153,22 +153,20 @@ static int compare_buffer(uint8_t *buffer, uint32_t length_buffer,
|
||||
void doit (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
break_on_error = 1;
|
||||
|
||||
// asn1_xer_print = 1;
|
||||
// asn_debug = 1;
|
||||
|
||||
for (i = 0; i < sizeof(s1ap_test) / sizeof(s1ap_test_t); i++) {
|
||||
struct s1ap_message_s message;
|
||||
S1AP_S1AP_PDU_t pdu;
|
||||
uint8_t *buffer;
|
||||
uint32_t length;
|
||||
|
||||
memset(&message, 0, sizeof(struct s1ap_message_s));
|
||||
memset(&pdu, 0, sizeof(pdu));
|
||||
|
||||
if (s1ap_test[i].originating == ENB) {
|
||||
/* eNB originated procedure -> USE MME decoder */
|
||||
if (s1ap_mme_decode_pdu(&message, s1ap_test[i].buffer,
|
||||
if (s1ap_mme_decode_pdu(&pdu, s1ap_test[i].buffer,
|
||||
s1ap_test[i].buf_len) < 0) {
|
||||
fail("Failed to decode %s\n", s1ap_test[i].procedure_name);
|
||||
} else {
|
||||
@@ -176,7 +174,7 @@ void doit (void)
|
||||
}
|
||||
} else {
|
||||
/* MME originated procedure -> USE eNB decoder */
|
||||
if (s1ap_eNB_decode_pdu(&message, s1ap_test[i].buffer,
|
||||
if (s1ap_eNB_decode_pdu(&pdu, s1ap_test[i].buffer,
|
||||
s1ap_test[i].buf_len) < 0) {
|
||||
fail("Failed to decode %s\n", s1ap_test[i].procedure_name);
|
||||
} else {
|
||||
@@ -186,14 +184,14 @@ void doit (void)
|
||||
|
||||
if (s1ap_test[i].originating == ENB) {
|
||||
/* eNB originated procedure -> USE eNB encoder */
|
||||
if (s1ap_eNB_encode_pdu(&message, &buffer, &length) < 0) {
|
||||
if (s1ap_eNB_encode_pdu(&pdu, &buffer, &length) < 0) {
|
||||
fail("Failed to decode %s\n", s1ap_test[i].procedure_name);
|
||||
} else {
|
||||
success("Encoded %s correctly\n", s1ap_test[i].procedure_name);
|
||||
}
|
||||
} else {
|
||||
/* MME originated procedure -> USE mme encoder */
|
||||
if (s1ap_mme_encode_pdu(&message, &buffer, &length) < 0) {
|
||||
if (s1ap_mme_encode_pdu(&pdu, &buffer, &length) < 0) {
|
||||
fail("Failed to encode %s\n", s1ap_test[i].procedure_name);
|
||||
} else {
|
||||
success("Encoded %s correctly\n", s1ap_test[i].procedure_name);
|
||||
|
||||
Reference in New Issue
Block a user